Skip to content

Commit

Permalink
feat: adding created field to QCEvaluation (#1192)
Browse files Browse the repository at this point in the history
* feat: adding create field to QCEvaluation

* chore: lint

* tests: fix example issue

---------

Co-authored-by: Saskia de Vries <[email protected]>
  • Loading branch information
dbirman and saskiad authored Jan 2, 2025
1 parent 86a57bd commit a1163c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
11 changes: 7 additions & 4 deletions examples/quality_control.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"tags": null,
"notes": "",
"allow_failed_metrics": false,
"latest_status": "Pending"
"latest_status": "Pending",
"created": "2022-11-22T00:00:00Z"
},
{
"modality": {
Expand Down Expand Up @@ -140,9 +141,10 @@
}
],
"tags": null,
"notes": null,
"notes": "Pass when video_1_num_frames==video_2_num_frames",
"allow_failed_metrics": false,
"latest_status": "Pass"
"latest_status": "Pass",
"created": "2022-11-22T00:00:00Z"
},
{
"modality": {
Expand Down Expand Up @@ -199,7 +201,8 @@
"tags": null,
"notes": null,
"allow_failed_metrics": false,
"latest_status": "Pass"
"latest_status": "Pass",
"created": "2022-11-22T00:00:00Z"
}
],
"notes": null
Expand Down
4 changes: 4 additions & 0 deletions examples/quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
QCMetric(name="Probe C drift", value="Low", reference="ecephys-drift-map", status_history=[s]),
],
notes="",
created=t,
)

eval1 = QCEvaluation(
Expand All @@ -85,6 +86,8 @@
status_history=[s],
),
],
notes="Pass when video_1_num_frames==video_2_num_frames",
created=t,
)

eval2 = QCEvaluation(
Expand All @@ -97,6 +100,7 @@
QCMetric(name="ProbeB", value=True, status_history=[s]),
QCMetric(name="ProbeC", value=True, status_history=[s]),
],
created=t,
)

q = QualityControl(evaluations=[eval0, eval1, eval2])
Expand Down
3 changes: 3 additions & 0 deletions src/aind_data_schema/core/quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class QCEvaluation(AindModel):
),
)
latest_status: Status = Field(default=None, title="Evaluation status")
created: AwareDatetimeWithDefault = Field(
default_factory=lambda: datetime.now(tz=timezone.utc), title="Evaluation creation date"
)

def status(self, date: datetime = datetime.now(tz=timezone.utc)) -> Status:
"""DEPRECATED
Expand Down

0 comments on commit a1163c7

Please sign in to comment.