From 53d452677b0f66252bb7eb762c7fcba3dd6123a7 Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Tue, 30 Apr 2024 10:27:34 -0700 Subject: [PATCH] Update schema.py --- src/meds/schema.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/meds/schema.py b/src/meds/schema.py index 03f978a..cc503b3 100644 --- a/src/meds/schema.py +++ b/src/meds/schema.py @@ -21,11 +21,9 @@ birth_code = "SNOMED/184099003" death_code = "SNOMED/419620001" -# We define static events as always occurring on January 1st, 1 AD -static_event_time = datetime.datetime(1, 1, 1) - -def patient_schema(per_event_properties_schema=pa.null()): - # Return a patient schema with a particular per event metadata subschema +def patient_schema(per_event_properties_schema=pa.null(), per_patient_properties_schema=pa.null()): + # Return a patient schema with a particular per event and per patient properties shcemas + event = pa.struct( [ pa.field("time", pa.timestamp("us"), nullable=False), @@ -41,6 +39,7 @@ def patient_schema(per_event_properties_schema=pa.null()): [ pa.field("patient_id", pa.int64(), nullable=False), pa.field("events", pa.list_(event), nullable=False), # Require ordered by time + pa.field("properties", per_patient_properties_schema), ] )