Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 5 additions & 31 deletions petab/v2/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"CheckUnusedExperiments",
"CheckObservablesDoNotShadowModelEntities",
"CheckUnusedConditions",
"CheckAllObservablesDefined",
"CheckPriorDistribution",
"lint_problem",
"default_validation_tasks",
Expand Down Expand Up @@ -261,8 +260,9 @@ def run(self, problem: Problem) -> ValidationIssue | None:
}
if undefined_observables := (used_observables - defined_observables):
return ValidationError(
f"Observables {undefined_observables} used in "
"measurement table but not defined in observable table."
f"Observable(s) {undefined_observables} are used in the "
"measurement table but are not defined in the observable "
"table."
)

return None
Expand All @@ -289,8 +289,8 @@ def run(self, problem: Problem) -> ValidationIssue | None:
expected = observable_parameters_count[m.observable_id]
except KeyError:
messages.append(
f"Observable {m.observable_id} used in measurement "
f"table is not defined."
f"Observable {m.observable_id} is used in the measurement "
f"table but is not defined in the observable table."
)
continue

Expand Down Expand Up @@ -443,31 +443,6 @@ def run(self, problem: Problem) -> ValidationIssue | None:
return None


class CheckAllObservablesDefined(ValidationTask):
"""A task to validate that all observables in the measurement table are
defined in the observable table."""

def run(self, problem: Problem) -> ValidationIssue | None:
if problem.measurement_df is None:
return None

measurement_df = problem.measurement_df
observable_df = problem.observable_df
used_observables = set(measurement_df[OBSERVABLE_ID].values)
defined_observables = (
set(observable_df.index.values)
if observable_df is not None
else set()
)
if undefined_observables := (used_observables - defined_observables):
return ValidationError(
f"Observables {undefined_observables} are used in the"
"measurements table but are not defined in observables table."
)

return None


class CheckUniquePrimaryKeys(ValidationTask):
"""Check that all primary keys are unique."""

Expand Down Expand Up @@ -1092,7 +1067,6 @@ def get_placeholders(
# CheckVisualizationTable(),
# TODO validate mapping table
CheckValidParameterInConditionOrParameterTable(),
CheckAllObservablesDefined(),
CheckAllParametersPresentInParameterTable(),
CheckValidConditionTargets(),
CheckPriorDistribution(),
Expand Down