Skip to content

Commit

Permalink
Merge pull request #13 from Medical-Event-Data-Standard/static_measur…
Browse files Browse the repository at this point in the history
…ements

Re-add static measurements
  • Loading branch information
mmcdermott authored Feb 19, 2024
2 parents 274ba5c + 245104a commit 419caa7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The Python type signature for the schema is as follows:

Patient = TypedDict('Patient', {
'patient_id': int,
'static_measurements': List[Measurement],
'events': List[Event],
})

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "meds"
version = "0.1.1"
version = "0.1.2"
description = "A data standard for working with event stream data"
readme = "README.md"
license = {text = "Apache-2.0"}
Expand Down
3 changes: 2 additions & 1 deletion src/meds/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def patient_schema(per_event_metadata_schema=pa.null()):
patient = pa.schema(
[
("patient_id", pa.int64()),
("static_measurements", pa.list_(measurement)),
("events", pa.list_(event)), # Require ordered by time
]
)
Expand All @@ -61,7 +62,7 @@ def patient_schema(per_event_metadata_schema=pa.null()):

Event = TypedDict("Event", {"time": datetime.datetime, "measurements": List[Measurement]})

Patient = TypedDict("Patient", {"patient_id": int, "events": List[Event]})
Patient = TypedDict("Patient", {"patient_id": int, "static_measurements": List[Measurement], "events": List[Event]})

############################################################

Expand Down
7 changes: 7 additions & 0 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def test_patient_schema():
patient_data = [
{
"patient_id": 123,
"static_measurements": [{
"code": "some_static_code",
"text_value": "example",
"numeric_value": 1.0,
"datetime_value": datetime.datetime(2019, 1, 1, 0, 0, 0),
"metadata": None,
}],
"events": [{ # Nested list for events
"time": datetime.datetime(2020, 1, 1, 12, 0, 0),
"measurements": [{ # Nested list for measurements
Expand Down

0 comments on commit 419caa7

Please sign in to comment.