From db1fa5275345db1f00294108d131614c02544af2 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 28 Nov 2023 12:58:05 -0500 Subject: [PATCH 01/11] ensure appendicitis and rupture conditions are ended --- src/main/resources/modules/appendicitis.json | 27 +++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/resources/modules/appendicitis.json b/src/main/resources/modules/appendicitis.json index 4679636f80..e80f9fa4f2 100644 --- a/src/main/resources/modules/appendicitis.json +++ b/src/main/resources/modules/appendicitis.json @@ -309,8 +309,7 @@ "Avg operative time is ~55 minutes", "https://www.ncbi.nlm.nih.gov/pubmed/17658102" ], - "direct_transition": "Appendicitis_Symptom1_Ends", - "name": "Appendectomy" + "direct_transition": "End_Appendicitis" }, "Appendicitis_Symptom1_Ends": { "type": "Symptom", @@ -407,8 +406,28 @@ }, "Transfer_To_Inpatient": { "type": "EncounterEnd", - "direct_transition": "Appendectomy_Encounter", - "name": "Transfer_To_Inpatient" + "direct_transition": "Appendectomy_Encounter" + }, + "End_Appendicitis": { + "type": "ConditionEnd", + "condition_onset": "Appendicitis", + "conditional_transition": [ + { + "transition": "End_Rupture", + "condition": { + "condition_type": "PriorState", + "name": "Rupture" + } + }, + { + "transition": "Appendicitis_Symptom1_Ends" + } + ] + }, + "End_Rupture": { + "type": "ConditionEnd", + "direct_transition": "Appendicitis_Symptom1_Ends", + "condition_onset": "Rupture" } }, "gmf_version": 1 From 7d9386696b2e7511465fa60a0f70a3e7baaae234 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 28 Nov 2023 13:01:32 -0500 Subject: [PATCH 02/11] ensure hypoxemia is ended --- .../resources/modules/covid19/end_outcomes.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/resources/modules/covid19/end_outcomes.json b/src/main/resources/modules/covid19/end_outcomes.json index fe7e2c3e11..371dac1a63 100644 --- a/src/main/resources/modules/covid19/end_outcomes.json +++ b/src/main/resources/modules/covid19/end_outcomes.json @@ -20,7 +20,7 @@ "display": "Pneumonia (disorder)" } ], - "direct_transition": "End Mild Respiratory Distress" + "direct_transition": "End Hypoxemia" }, "End ARDS": { "type": "ConditionEnd", @@ -150,6 +150,17 @@ } ], "direct_transition": "End Heart Failure" + }, + "End Hypoxemia": { + "type": "ConditionEnd", + "direct_transition": "End Mild Respiratory Distress", + "codes": [ + { + "system": "SNOMED-CT", + "code": 389087006, + "display": "Hypoxemia (disorder)" + } + ] } }, "gmf_version": 1 From 777671ca70118d5f4fd8e61a7f75752c4b38e881 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 28 Nov 2023 13:03:14 -0500 Subject: [PATCH 03/11] remove 'transition' condition --- .../modules/home_health_treatment.json | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/main/resources/modules/home_health_treatment.json b/src/main/resources/modules/home_health_treatment.json index 4fdb1ad75e..9e3e454b8a 100644 --- a/src/main/resources/modules/home_health_treatment.json +++ b/src/main/resources/modules/home_health_treatment.json @@ -18,8 +18,7 @@ } ], "direct_transition": "Referral_Home_Health_Care", - "encounter_class": "urgentcare", - "reason": "Transition_To_Home" + "encounter_class": "urgentcare" }, "Referral_Home_Health_Care": { "type": "Procedure", @@ -64,8 +63,7 @@ } ], "direct_transition": "Initial_Patient_Assessment", - "encounter_class": "home", - "reason": "Transition_To_Home" + "encounter_class": "home" }, "Initial_Patient_Assessment": { "type": "Procedure", @@ -125,8 +123,7 @@ } ], "direct_transition": "Begin_Visit", - "encounter_class": "home", - "reason": "Transition_To_Home" + "encounter_class": "home" }, "Begin_Visit": { "type": "Counter", @@ -225,7 +222,7 @@ "display": "Patient discharge (procedure)" } ], - "direct_transition": "End_Transition_To_Home" + "direct_transition": "Last Visit" }, "Nursing_Care": { "type": "Procedure", @@ -352,30 +349,13 @@ } ] }, - "direct_transition": "Transition_To_Home" + "direct_transition": "Face_to_Face_Encounter" }, "Reset Home Health": { "type": "SetAttribute", "attribute": "home_health", "direct_transition": "Wait Until Home Health", "value": false - }, - "Transition_To_Home": { - "type": "ConditionOnset", - "target_encounter": "Face_to_Face_Encounter", - "codes": [ - { - "system": "SNOMED-CT", - "code": 1871000124103, - "display": "Transition from acute care to home-health care (finding)" - } - ], - "direct_transition": "Face_to_Face_Encounter" - }, - "End_Transition_To_Home": { - "type": "ConditionEnd", - "direct_transition": "Last Visit", - "condition_onset": "Transition_To_Home" } }, "gmf_version": 1 From e8bfda77737f18d173a719c844cdb29debdf8f0c Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 28 Nov 2023 13:04:31 -0500 Subject: [PATCH 04/11] no prediabetes diagnosis after diabetes --- .../resources/modules/metabolic_syndrome_care.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/resources/modules/metabolic_syndrome_care.json b/src/main/resources/modules/metabolic_syndrome_care.json index 1c32ebe76e..56af274597 100644 --- a/src/main/resources/modules/metabolic_syndrome_care.json +++ b/src/main/resources/modules/metabolic_syndrome_care.json @@ -288,7 +288,18 @@ "remarks": [ "setting prediabetes as severity 0 makes some things easier" ], - "direct_transition": "Diagnose_Prediabetes" + "conditional_transition": [ + { + "transition": "Check_CarePlan", + "condition": { + "condition_type": "PriorState", + "name": "Diagnose_Diabetes" + } + }, + { + "transition": "Diagnose_Prediabetes" + } + ] }, "Diagnose_Prediabetes": { "type": "ConditionOnset", From b1288d31b1a4ac06c8e82016218bfe7519bdfb52 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 28 Nov 2023 13:05:12 -0500 Subject: [PATCH 05/11] ensure overdose conditions are ended --- .../resources/modules/opioid_addiction.json | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/src/main/resources/modules/opioid_addiction.json b/src/main/resources/modules/opioid_addiction.json index 70afb2a978..f8062feb84 100644 --- a/src/main/resources/modules/opioid_addiction.json +++ b/src/main/resources/modules/opioid_addiction.json @@ -645,7 +645,7 @@ "distributed_transition": [ { "distribution": 0.98747, - "transition": "End_Directed_Use_Overdose_Encounter" + "transition": "End_Directed_Use_Overdose" }, { "distribution": 0.01253, @@ -683,7 +683,7 @@ "distributed_transition": [ { "distribution": 0.98747, - "transition": "End_Misuse_Overdose_Encounter" + "transition": "End_Misuse_Overdose" }, { "distribution": 0.01253, @@ -738,19 +738,7 @@ } }, "unit": "hours", - "conditional_transition": [ - { - "condition": { - "condition_type": "Attribute", - "attribute": "opioid_addiction_careplan", - "operator": "is nil" - }, - "transition": "Opioid_Addiction_CarePlan" - }, - { - "transition": "End_Addiction_Overdose_Encounter" - } - ] + "direct_transition": "End_Addiction_Overdose" }, "Opioid_Addiction_CarePlan": { "type": "CarePlanStart", @@ -928,6 +916,33 @@ ], "direct_transition": "Recovery_Management", "assign_to_attribute": "opioid_drug_addiction" + }, + "End_Addiction_Overdose": { + "type": "ConditionEnd", + "conditional_transition": [ + { + "condition": { + "condition_type": "Attribute", + "attribute": "opioid_addiction_careplan", + "operator": "is nil" + }, + "transition": "Opioid_Addiction_CarePlan" + }, + { + "transition": "End_Addiction_Overdose_Encounter" + } + ], + "condition_onset": "Addiction_Overdose" + }, + "End_Misuse_Overdose": { + "type": "ConditionEnd", + "direct_transition": "End_Misuse_Overdose_Encounter", + "condition_onset": "Misuse_Overdose" + }, + "End_Directed_Use_Overdose": { + "type": "ConditionEnd", + "direct_transition": "End_Directed_Use_Overdose_Encounter", + "condition_onset": "Directed_Use_Overdose" } }, "gmf_version": 1 From 3602a55f207fe54d198cb05ab4dee0b291a46db0 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 28 Nov 2023 13:07:16 -0500 Subject: [PATCH 06/11] ensure miscarriage condition is ended, and add history of miscarriage instead --- src/main/resources/modules/pregnancy.json | 56 +++++++++++++++-------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/src/main/resources/modules/pregnancy.json b/src/main/resources/modules/pregnancy.json index 92a6a1fd26..4d02ef103b 100644 --- a/src/main/resources/modules/pregnancy.json +++ b/src/main/resources/modules/pregnancy.json @@ -1919,11 +1919,11 @@ "Miscarriage_Fatal_Pregnancy_Complication_Ends": { "type": "ConditionEnd", "referenced_by_attribute": "fatal_pregnancy_complication", - "direct_transition": "End_Miscarriage_Followup_Encounter" + "direct_transition": "History_of_Miscarriage" }, "End_Miscarriage_Followup_Encounter": { "type": "EncounterEnd", - "direct_transition": "Miscarriage_Ends" + "direct_transition": "End_Miscarriage_Condition" }, "Wait_For_Induced_Abortion": { "type": "Delay", @@ -2129,24 +2129,6 @@ } ] }, - "Miscarriage_Ends": { - "type": "ConditionEnd", - "condition_onset": "Become_Pregnant", - "conditional_transition": [ - { - "transition": "Anemia_End_2", - "condition": { - "condition_type": "Attribute", - "attribute": "anemia_pregnancy", - "operator": "==", - "value": 1 - } - }, - { - "transition": "Unset_Pregnant_Attribute" - } - ] - }, "Abortion_Ends": { "type": "ConditionEnd", "condition_onset": "Become_Pregnant", @@ -2326,6 +2308,40 @@ ], "assign_to_attribute": "fatal_pregnancy_complication", "direct_transition": "End_Initial_Visit_Towards_Ectopic_Pregnancy" + }, + "Miscarriage_Ends_Pregnancy": { + "type": "ConditionEnd", + "condition_onset": "Become_Pregnant", + "conditional_transition": [ + { + "transition": "Anemia_End_2", + "condition": { + "condition_type": "Attribute", + "attribute": "anemia_pregnancy", + "operator": "==", + "value": 1 + } + }, + { + "transition": "Unset_Pregnant_Attribute" + } + ] + }, + "End_Miscarriage_Condition": { + "type": "ConditionEnd", + "direct_transition": "Miscarriage_Ends_Pregnancy", + "referenced_by_attribute": "miscarriage" + }, + "History_of_Miscarriage": { + "type": "ConditionOnset", + "codes": [ + { + "system": "SNOMED-CT", + "code": 161744009, + "display": "Past pregnancy history of miscarriage (situation)" + } + ], + "direct_transition": "End_Miscarriage_Followup_Encounter" } }, "gmf_version": 1 From ba9066d9c447b56d43b871bd4df7bfc51d6a66c5 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 28 Nov 2023 13:07:53 -0500 Subject: [PATCH 07/11] remove 'transfer' condition --- .../modules/snf/skilled_nursing_facility.json | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/main/resources/modules/snf/skilled_nursing_facility.json b/src/main/resources/modules/snf/skilled_nursing_facility.json index 3ab3476414..e3691254ea 100644 --- a/src/main/resources/modules/snf/skilled_nursing_facility.json +++ b/src/main/resources/modules/snf/skilled_nursing_facility.json @@ -6,7 +6,7 @@ "states": { "Initial": { "type": "Initial", - "direct_transition": "Transition_To_SNF_Reason" + "direct_transition": "SNF_Admission" }, "SNF_Admission": { "type": "Encounter", @@ -41,8 +41,7 @@ { "transition": "History_Physical_Exam" } - ], - "reason": "Transition_To_SNF_Reason" + ] }, "Determine_LOS": { "type": "SetAttribute", @@ -296,7 +295,7 @@ }, "End Encounter": { "type": "EncounterEnd", - "direct_transition": "End_Transition_To_SNF_Reason" + "direct_transition": "Terminal" }, "Facility_Wheelchair": { "type": "Device", @@ -318,23 +317,6 @@ "attribute": "snf_days", "value": 100, "direct_transition": "History_Physical_Exam" - }, - "Transition_To_SNF_Reason": { - "type": "ConditionOnset", - "target_encounter": "SNF_Admission", - "codes": [ - { - "system": "SNOMED-CT", - "code": 25675004, - "display": "Patient transfer to skilled nursing facility (procedure)" - } - ], - "direct_transition": "SNF_Admission" - }, - "End_Transition_To_SNF_Reason": { - "type": "ConditionEnd", - "direct_transition": "Terminal", - "condition_onset": "Transition_To_SNF_Reason" } }, "gmf_version": 1 From 3a0d47b5cfb2e0d324e9edda5df78288ba1c7688 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 5 Dec 2023 14:24:47 -0500 Subject: [PATCH 08/11] bring back reasons for SNF and home health modules --- .../modules/home_health_treatment.json | 9 ++-- .../resources/modules/home_hospice_snf.json | 12 +++++- .../modules/snf/skilled_nursing_facility.json | 15 ++++++- .../modules/total_joint_replacement.json | 43 ++++++++++++++++++- 4 files changed, 71 insertions(+), 8 deletions(-) diff --git a/src/main/resources/modules/home_health_treatment.json b/src/main/resources/modules/home_health_treatment.json index 9e3e454b8a..5bf7f232ec 100644 --- a/src/main/resources/modules/home_health_treatment.json +++ b/src/main/resources/modules/home_health_treatment.json @@ -18,7 +18,8 @@ } ], "direct_transition": "Referral_Home_Health_Care", - "encounter_class": "urgentcare" + "encounter_class": "urgentcare", + "reason": "home_health_reason" }, "Referral_Home_Health_Care": { "type": "Procedure", @@ -63,7 +64,8 @@ } ], "direct_transition": "Initial_Patient_Assessment", - "encounter_class": "home" + "encounter_class": "home", + "reason": "home_health_reason" }, "Initial_Patient_Assessment": { "type": "Procedure", @@ -123,7 +125,8 @@ } ], "direct_transition": "Begin_Visit", - "encounter_class": "home" + "encounter_class": "home", + "reason": "home_health_reason" }, "Begin_Visit": { "type": "Counter", diff --git a/src/main/resources/modules/home_hospice_snf.json b/src/main/resources/modules/home_hospice_snf.json index c6bca0a84b..e16888960d 100644 --- a/src/main/resources/modules/home_hospice_snf.json +++ b/src/main/resources/modules/home_hospice_snf.json @@ -431,7 +431,7 @@ "type": "SetAttribute", "attribute": "home_health", "value": true, - "direct_transition": "Wait for Next Decade" + "direct_transition": "Set Home Health Reason" }, "Wait for Next Decade": { "type": "Simple", @@ -776,6 +776,16 @@ "attribute": "hospice_reason", "value_attribute": "colorectal_cancer", "direct_transition": "Initiate Hospice" + }, + "Set Home Health Reason": { + "type": "SetAttribute", + "attribute": "home_health_reason", + "direct_transition": "Wait for Next Decade", + "value_code": { + "system": "SNOMED-CT", + "code": "1871000124103", + "display": "Transition from acute care to home-health care (finding)" + } } }, "gmf_version": 1 diff --git a/src/main/resources/modules/snf/skilled_nursing_facility.json b/src/main/resources/modules/snf/skilled_nursing_facility.json index e3691254ea..bc62c59b87 100644 --- a/src/main/resources/modules/snf/skilled_nursing_facility.json +++ b/src/main/resources/modules/snf/skilled_nursing_facility.json @@ -6,7 +6,7 @@ "states": { "Initial": { "type": "Initial", - "direct_transition": "SNF_Admission" + "direct_transition": "Transition_To_SNF_Reason" }, "SNF_Admission": { "type": "Encounter", @@ -41,7 +41,8 @@ { "transition": "History_Physical_Exam" } - ] + ], + "reason": "snf_reason" }, "Determine_LOS": { "type": "SetAttribute", @@ -317,6 +318,16 @@ "attribute": "snf_days", "value": 100, "direct_transition": "History_Physical_Exam" + }, + "Transition_To_SNF_Reason": { + "type": "SetAttribute", + "attribute": "snf_reason", + "direct_transition": "SNF_Admission", + "value_code": { + "system": "SNOMED-CT", + "code": "25675004", + "display": "Patient transfer to skilled nursing facility (procedure)" + } } }, "gmf_version": 1 diff --git a/src/main/resources/modules/total_joint_replacement.json b/src/main/resources/modules/total_joint_replacement.json index f82716790e..38b3a824ad 100644 --- a/src/main/resources/modules/total_joint_replacement.json +++ b/src/main/resources/modules/total_joint_replacement.json @@ -335,8 +335,27 @@ "Home Health Visits": { "type": "SetAttribute", "attribute": "home_health", - "direct_transition": "Delay_For_Recovery", - "value": true + "value": true, + "conditional_transition": [ + { + "transition": "Home Health Reason Knee", + "condition": { + "condition_type": "Attribute", + "attribute": "joint_replacement", + "operator": "==", + "value": "knee" + } + }, + { + "transition": "Home Health Reason Hip", + "condition": { + "condition_type": "Attribute", + "attribute": "joint_replacement", + "operator": "==", + "value": "hip" + } + } + ] }, "DME End": { "type": "DeviceEnd", @@ -369,6 +388,26 @@ "code": 110466009, "display": "Pre-surgery evaluation (procedure)" } + }, + "Home Health Reason Knee": { + "type": "SetAttribute", + "attribute": "home_health_reason", + "direct_transition": "Delay_For_Recovery", + "value_code": { + "system": "SNOMED-CT", + "code": "609588000", + "display": "Total knee replacement" + } + }, + "Home Health Reason Hip": { + "type": "SetAttribute", + "attribute": "home_health_reason", + "direct_transition": "Delay_For_Recovery", + "value_code": { + "system": "SNOMED-CT", + "code": "52734007", + "display": "Total replacement of hip" + } } }, "gmf_version": 1 From f7aa62171532668e499ad254491d279265027c43 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 5 Dec 2023 14:28:18 -0500 Subject: [PATCH 09/11] set reason code only if not already set --- .../modules/snf/skilled_nursing_facility.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/resources/modules/snf/skilled_nursing_facility.json b/src/main/resources/modules/snf/skilled_nursing_facility.json index bc62c59b87..9883293ef2 100644 --- a/src/main/resources/modules/snf/skilled_nursing_facility.json +++ b/src/main/resources/modules/snf/skilled_nursing_facility.json @@ -6,7 +6,19 @@ "states": { "Initial": { "type": "Initial", - "direct_transition": "Transition_To_SNF_Reason" + "conditional_transition": [ + { + "transition": "Transition_To_SNF_Reason", + "condition": { + "condition_type": "Attribute", + "attribute": "snf_reason", + "operator": "is nil" + } + }, + { + "transition": "SNF_Admission" + } + ] }, "SNF_Admission": { "type": "Encounter", From ef064a8cb0ba3bfdb8b816626df43765af9e8c72 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 5 Dec 2023 14:34:19 -0500 Subject: [PATCH 10/11] revert home_hospice_snf --- src/main/resources/modules/home_hospice_snf.json | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/main/resources/modules/home_hospice_snf.json b/src/main/resources/modules/home_hospice_snf.json index e16888960d..c6bca0a84b 100644 --- a/src/main/resources/modules/home_hospice_snf.json +++ b/src/main/resources/modules/home_hospice_snf.json @@ -431,7 +431,7 @@ "type": "SetAttribute", "attribute": "home_health", "value": true, - "direct_transition": "Set Home Health Reason" + "direct_transition": "Wait for Next Decade" }, "Wait for Next Decade": { "type": "Simple", @@ -776,16 +776,6 @@ "attribute": "hospice_reason", "value_attribute": "colorectal_cancer", "direct_transition": "Initiate Hospice" - }, - "Set Home Health Reason": { - "type": "SetAttribute", - "attribute": "home_health_reason", - "direct_transition": "Wait for Next Decade", - "value_code": { - "system": "SNOMED-CT", - "code": "1871000124103", - "display": "Transition from acute care to home-health care (finding)" - } } }, "gmf_version": 1 From 275fa44a9275e1cb3fd2b6c480777dacb6530c5f Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 5 Dec 2023 14:42:54 -0500 Subject: [PATCH 11/11] clear out attributes at completion of module --- .../modules/home_health_treatment.json | 31 +++++++++++++++++-- .../modules/snf/skilled_nursing_facility.json | 7 ++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/main/resources/modules/home_health_treatment.json b/src/main/resources/modules/home_health_treatment.json index 5bf7f232ec..ee22176942 100644 --- a/src/main/resources/modules/home_health_treatment.json +++ b/src/main/resources/modules/home_health_treatment.json @@ -352,13 +352,40 @@ } ] }, - "direct_transition": "Face_to_Face_Encounter" + "conditional_transition": [ + { + "transition": "Default_Home_Health_Reason", + "condition": { + "condition_type": "Attribute", + "attribute": "home_health_reason", + "operator": "is nil" + } + }, + { + "transition": "Face_to_Face_Encounter" + } + ] }, "Reset Home Health": { "type": "SetAttribute", "attribute": "home_health", - "direct_transition": "Wait Until Home Health", + "direct_transition": "Reset Home Health Reason", "value": false + }, + "Default_Home_Health_Reason": { + "type": "SetAttribute", + "attribute": "home_health_reason", + "direct_transition": "Face_to_Face_Encounter", + "value_code": { + "system": "SNOMED-CT", + "code": "1871000124103", + "display": "Transition from acute care to home-health care (finding)" + } + }, + "Reset Home Health Reason": { + "type": "SetAttribute", + "attribute": "home_health_reason", + "direct_transition": "Wait Until Home Health" } }, "gmf_version": 1 diff --git a/src/main/resources/modules/snf/skilled_nursing_facility.json b/src/main/resources/modules/snf/skilled_nursing_facility.json index 9883293ef2..f419cdd90d 100644 --- a/src/main/resources/modules/snf/skilled_nursing_facility.json +++ b/src/main/resources/modules/snf/skilled_nursing_facility.json @@ -308,7 +308,7 @@ }, "End Encounter": { "type": "EncounterEnd", - "direct_transition": "Terminal" + "direct_transition": "Clear SNF Reason" }, "Facility_Wheelchair": { "type": "Device", @@ -340,6 +340,11 @@ "code": "25675004", "display": "Patient transfer to skilled nursing facility (procedure)" } + }, + "Clear SNF Reason": { + "type": "SetAttribute", + "attribute": "snf_reason", + "direct_transition": "Terminal" } }, "gmf_version": 1