From bc5ca00d565e50ecfc34aeb693968452321ecd8d Mon Sep 17 00:00:00 2001 From: Geert Hesselink <54070862+Ghesselink@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:58:21 +0200 Subject: [PATCH] IVS-63 ValidationOutcome to dict in DEV --- models.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/models.py b/models.py index 493b20a..7af8e00 100644 --- a/models.py +++ b/models.py @@ -1107,6 +1107,19 @@ def __str__(self): 'Observed': self.observed } return f' '.join(f'{k}={v}' for k, v in members.items() if v) + + def to_dict(self): + return { + "id": self.id, + "instance_id": self.instance_public_id, + "validation_task_id": self.validation_task_public_id, + "feature": self.feature, + "feature_version": self.feature_version, + "severity": self.get_severity_display(), # Convert the integer to a human-readable string + "outcome_code": self.outcome_code, + "expected": self.expected, + "observed": self.observed, + } @property def instance_public_id(self):