Skip to content

Commit

Permalink
fix: unifying name of temporal attributes on example dataset to "time"
Browse files Browse the repository at this point in the history
  • Loading branch information
MarIniOnz committed Dec 2, 2024
1 parent 6de900c commit 96bacd4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 12 deletions.
8 changes: 4 additions & 4 deletions crates/medmodels-core/src/medrecord/example_dataset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ impl MedRecord {
nodes: HashMap::new(),
edges: HashMap::from([
(
"diagnosis_time".into(),
"time".into(),
(DataType::DateTime, AttributeType::Temporal).into(),
),
(
"duration_days".into(),
(
DataType::Option(Box::new(DataType::Float)),
DataType::Option(Box::new(DataType::Int)),
AttributeType::Continuous,
)
.into(),
Expand All @@ -211,7 +211,7 @@ impl MedRecord {
nodes: HashMap::new(),
edges: HashMap::from([
(
"start_time".into(),
"time".into(),
(DataType::DateTime, AttributeType::Temporal).into(),
),
(
Expand All @@ -232,7 +232,7 @@ impl MedRecord {
nodes: HashMap::new(),
edges: HashMap::from([
(
"procedure_time".into(),
"time".into(),
(DataType::DateTime, AttributeType::Temporal).into(),
),
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ There are 60 diagnosis instances for the five patients.

- **patient_id:** Linked to the Patient Demographics
- **diagnosis_code:** Unique code identifiying a specific diagnosis
- **diagnosis_time:** Date of the diagnosis
- **time:** Date of the diagnosis
- **duration_days** Duration in days in which the diagnosis held true

### 2. `patient_procedure.csv`
Expand All @@ -54,7 +54,7 @@ For all five patients there are 50 procedures in the dataset.

- **patient_id:** Linked to the Patient Demographics
- **procedure_code:** Unique identifier for each procedure
- **procedure_time:** Exact time and date for the procedure
- **time:** Exact time and date for the procedure
- **duration_minutes:** How long the procedure needed in minutes

### 3. `patient_drug.csv`
Expand All @@ -63,6 +63,6 @@ There are also 50 prescribed medications for the five patients combined.

- **patient_id:** Linked to the Patient Demographics
- **drug_code:** Unique identifier for the medication prescribed
- **start_time:** Time and date when the medication was prescribed
- **time:** Time and date when the medication was prescribed
- **quantity:** how many doses were prescribed
- **cost:** Cost of the medication order in Dollar
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
patient_id,diagnosis_code,diagnosis_time,duration_days
patient_id,diagnosis_code,time,duration_days
pat_1,diagnosis_82423001,2014-02-06,
pat_1,diagnosis_73595000,2014-04-08,1113.0
pat_1,diagnosis_741062008,2014-04-08,371.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
patient_id,drug_code,start_time,quantity,cost
patient_id,drug_code,time,quantity,cost
pat_1,drug_856987,2014-04-08T12:54:59Z,3,215.58
pat_1,drug_856987,2015-04-14T12:54:59Z,3,281.4
pat_1,drug_856987,2017-04-25T12:54:59Z,3,105.15
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
patient_id,procedure_code,procedure_time,duration_minutes
patient_id,procedure_code,time,duration_minutes
pat_1,procedure_710824005,2017-04-25T12:54:59Z,30
pat_1,procedure_763302001,2018-05-01T15:02:56Z,21
pat_1,procedure_171207006,2020-05-12T14:05:34Z,11
Expand Down
2 changes: 1 addition & 1 deletion medmodels/medrecord/tests/test_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def query7(edge: EdgeOperand):
self.assertDictEqual(
patient_diagnosis,
{
"diagnosis_time": {
"time": {
"min": datetime(1962, 10, 21, 0, 0),
"max": datetime(2024, 4, 12, 0, 0),
},
Expand Down
16 changes: 15 additions & 1 deletion medmodels/medrecord/tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_nodes(self):
def test_edges(self):
self.assertEqual(
{
"diagnosis_time": (mr.DateTime(), mr.AttributeType.Temporal),
"time": (mr.DateTime(), mr.AttributeType.Temporal),
"duration_days": (mr.Option(mr.Float()), mr.AttributeType.Continuous),
},
self.schema.group("patient_diagnosis").edges,
Expand Down Expand Up @@ -236,3 +236,17 @@ def test_eq(self):
self.assertEqual(mr.AttributeType.Temporal, PyAttributeType.Temporal)
self.assertNotEqual(mr.AttributeType.Temporal, mr.AttributeType.Categorical)
self.assertNotEqual(mr.AttributeType.Temporal, PyAttributeType.Categorical)


if __name__ == "__main__":
run_test = unittest.TestLoader().loadTestsFromTestCase(TestAttributeType)
unittest.TextTestRunner(verbosity=2).run(run_test)

run_test = unittest.TestLoader().loadTestsFromTestCase(TestAttributesSchema)
unittest.TextTestRunner(verbosity=2).run(run_test)

run_test = unittest.TestLoader().loadTestsFromTestCase(TestGroupSchema)
unittest.TextTestRunner(verbosity=2).run(run_test)

run_test = unittest.TestLoader().loadTestsFromTestCase(TestSchema)
unittest.TextTestRunner(verbosity=2).run(run_test)

0 comments on commit 96bacd4

Please sign in to comment.