Skip to content

Commit

Permalink
better validation error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
janekg89 committed Jun 21, 2022
1 parent 8e8d85f commit 171294f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/pkdb_app/data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def validate_timecourse(self, timecourse):
name = self.get_name(timecourse[key], value)
else:
name = list(timecourse[key])
raise ValueError(f"Subset used for timecourse is not unique on '{key}'. Values are '{name}'. "
label = timecourse['label']
raise ValueError(f"Subset with label '{label}' used for timecourse is not unique on '{key}'. Values are '{name}'. "
f"Check uniqueness of labels for timecourses.")


Expand Down
2 changes: 2 additions & 0 deletions backend/pkdb_app/outputs/pk_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ def pkoutputs_from_timecourse(subset: Subset) -> List[Dict]:
if dosing:
if dosing.application.info_node.name == "single dose" and timecourse["substance"] == dosing.substance.pk:
pkinf = pharmacokinetics.TimecoursePK(**variables)

if not pkinf:
_ = variables.pop("dosing", None)
_ = variables.pop("intervention_time", None)
print(variables)
pkinf = pharmacokinetics.TimecoursePKNoDosing(**variables)

pk = pkinf.pk
Expand Down

0 comments on commit 171294f

Please sign in to comment.