From c2c6949d91b1cd0777c335f81d41246539d00366 Mon Sep 17 00:00:00 2001 From: sm2511 Date: Wed, 13 Mar 2024 16:15:22 +0000 Subject: [PATCH 01/59] add latest version of costing resource file --- resources/costing/ResourceFile_Costing.xlsx | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 resources/costing/ResourceFile_Costing.xlsx diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx new file mode 100644 index 0000000000..033e2ad96a --- /dev/null +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6702c24e0f9833ccdb18cc5f218ddf84a402864d26b01540799a01887f42e1c7 +size 484822 From dbcf1fbc4f7d0b3073b6148f61423d991a74364f Mon Sep 17 00:00:00 2001 From: sm2511 Date: Sun, 24 Mar 2024 20:04:41 +0000 Subject: [PATCH 02/59] add latest version of costing resource file - with updated units for cost of consumables --- resources/costing/ResourceFile_Costing.xlsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index 033e2ad96a..aba0cb2e3b 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6702c24e0f9833ccdb18cc5f218ddf84a402864d26b01540799a01887f42e1c7 -size 484822 +oid sha256:3bc42251e33aac15438923141ca4568b284465a0a7a8ac6bfc46c4bf525c4e9a +size 1006885 From 1d21999fc9e459cc8f1d0ec98d5c513a4d23362a Mon Sep 17 00:00:00 2001 From: sm2511 Date: Sun, 24 Mar 2024 20:23:10 +0000 Subject: [PATCH 03/59] update Gentamycin (units) --- resources/costing/ResourceFile_Costing.xlsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index aba0cb2e3b..b2f146c2fe 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3bc42251e33aac15438923141ca4568b284465a0a7a8ac6bfc46c4bf525c4e9a -size 1006885 +oid sha256:f053aa28de62547d6a1f36ace122fe62e3caff03e4fc5babbf157a9e14b66fc2 +size 1005374 From ba0f65805894afd235bba7465a223daf2ccdca22 Mon Sep 17 00:00:00 2001 From: tdm32 Date: Mon, 25 Mar 2024 16:26:47 +0000 Subject: [PATCH 04/59] update item quantities for HIV prep and infant prep --- src/tlo/methods/hiv.py | 44 ++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/tlo/methods/hiv.py b/src/tlo/methods/hiv.py index 6a1e7f0245..4601e2117e 100644 --- a/src/tlo/methods/hiv.py +++ b/src/tlo/methods/hiv.py @@ -958,31 +958,32 @@ def initialise_simulation(self, sim): self.item_codes_for_consumables_required['circ'] = \ hs.get_item_codes_from_package_name("Male circumcision ") - self.item_codes_for_consumables_required['prep'] = { - hs.get_item_code_from_item_name("Tenofovir (TDF)/Emtricitabine (FTC), tablet, 300/200 mg"): 1} + # 1 tablet daily + self.item_codes_for_consumables_required['prep'] = \ + hs.get_item_code_from_item_name("Tenofovir (TDF)/Emtricitabine (FTC), tablet, 300/200 mg") - # infant NVP given in 3-monthly dosages - self.item_codes_for_consumables_required['infant_prep'] = { - hs.get_item_code_from_item_name("Nevirapine, oral solution, 10 mg/ml"): 1} + # infant NVP 1.5mg daily for birth weight 2500g or above, 6 weeks + self.item_codes_for_consumables_required['infant_prep'] = \ + hs.get_item_code_from_item_name("Nevirapine, oral solution, 10 mg/ml") # First - line ART for adults(age > "ART_age_cutoff_older_child") - self.item_codes_for_consumables_required['First-line ART regimen: adult'] = { - hs.get_item_code_from_item_name("First-line ART regimen: adult"): 1} - self.item_codes_for_consumables_required['First-line ART regimen: adult: cotrimoxazole'] = { - hs.get_item_code_from_item_name("Cotrimoxizole, 960mg pppy"): 1} + self.item_codes_for_consumables_required['First-line ART regimen: adult'] = \ + hs.get_item_code_from_item_name("First-line ART regimen: adult") + self.item_codes_for_consumables_required['First-line ART regimen: adult: cotrimoxazole'] = \ + hs.get_item_code_from_item_name("Cotrimoxizole, 960mg pppy") # ART for older children aged ("ART_age_cutoff_younger_child" < age <= "ART_age_cutoff_older_child"): # cotrim is separate item - optional in get_cons call - self.item_codes_for_consumables_required['First line ART regimen: older child'] = { - hs.get_item_code_from_item_name("First line ART regimen: older child"): 1} - self.item_codes_for_consumables_required['First line ART regimen: older child: cotrimoxazole'] = { - hs.get_item_code_from_item_name("Sulfamethoxazole + trimethropin, tablet 400 mg + 80 mg"): 1} + self.item_codes_for_consumables_required['First line ART regimen: older child'] = \ + hs.get_item_code_from_item_name("First line ART regimen: older child") + self.item_codes_for_consumables_required['First line ART regimen: older child: cotrimoxazole'] = \ + hs.get_item_code_from_item_name("Sulfamethoxazole + trimethropin, tablet 400 mg + 80 mg") # ART for younger children aged (age < "ART_age_cutoff_younger_child"): - self.item_codes_for_consumables_required['First line ART regimen: young child'] = { - hs.get_item_code_from_item_name("First line ART regimen: young child"): 1} - self.item_codes_for_consumables_required['First line ART regimen: young child: cotrimoxazole'] = { - hs.get_item_code_from_item_name("Sulfamethoxazole + trimethropin, oral suspension, 240 mg, 100 ml"): 1} + self.item_codes_for_consumables_required['First line ART regimen: young child'] = \ + hs.get_item_code_from_item_name("First line ART regimen: young child") + self.item_codes_for_consumables_required['First line ART regimen: young child: cotrimoxazole'] = \ + hs.get_item_code_from_item_name("Sulfamethoxazole + trimethropin, oral suspension, 240 mg, 100 ml") # 7) Define the DxTests # HIV Rapid Diagnostic Test: @@ -2320,7 +2321,9 @@ def apply(self, person_id, squeeze_factor): return self.sim.modules["HealthSystem"].get_blank_appt_footprint() # Check that infant prophylaxis is available and if it is, initiate: - if self.get_consumables(item_codes=self.module.item_codes_for_consumables_required['infant_prep']): + if self.get_consumables( + item_codes={self.module.item_codes_for_consumables_required['infant_prep']: 63} + ): df.at[person_id, "hv_is_on_prep"] = True # Schedule follow-up visit for 3 months time @@ -2400,7 +2403,10 @@ def apply(self, person_id, squeeze_factor): return self.make_appt_footprint({"Over5OPD": 1, "VCTPositive": 1}) # Check that PrEP is available and if it is, initiate or continue PrEP: - if self.get_consumables(item_codes=self.module.item_codes_for_consumables_required['prep']): + quantity_required = self.module.parameters['dispensation_period_months'] * 30 + if self.get_consumables( + item_codes={self.module.item_codes_for_consumables_required['prep']: quantity_required} + ): df.at[person_id, "hv_is_on_prep"] = True # Schedule 'decision about whether to continue on PrEP' for 3 months time From ae1dc16a697ff730eab1dcc5c8ff797483e44f4c Mon Sep 17 00:00:00 2001 From: sm2511 Date: Tue, 26 Mar 2024 10:57:05 +0000 Subject: [PATCH 05/59] update 1g to 1mg for Albendazole (Item code 52) --- resources/costing/ResourceFile_Costing.xlsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index b2f146c2fe..2fde5966be 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f053aa28de62547d6a1f36ace122fe62e3caff03e4fc5babbf157a9e14b66fc2 -size 1005374 +oid sha256:faa917052b0c99ae60174c884b4e104be59b0b7d9afebe6f8ed47902ace1b2a3 +size 1005652 From fcee46707fed9de4f232557a1aa70facf43cad95 Mon Sep 17 00:00:00 2001 From: sm2511 Date: Tue, 26 Mar 2024 17:02:23 +0000 Subject: [PATCH 06/59] update units for gloves from 1 glove to "1 pair of gloves" --- resources/costing/ResourceFile_Costing.xlsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index 2fde5966be..cd9c0e63a6 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:faa917052b0c99ae60174c884b4e104be59b0b7d9afebe6f8ed47902ace1b2a3 -size 1005652 +oid sha256:c02f133045eaa139e37af44e9f88da6c954e3254ca7c8f8a7327ca4b80876dcf +size 1005696 From c352bee2c59b13b0f5fa1d18a6aa3b5ef1ad3040 Mon Sep 17 00:00:00 2001 From: tdm32 Date: Wed, 27 Mar 2024 11:52:41 +0000 Subject: [PATCH 07/59] update item quantities for TB drugs add 3HP as new consumable for IPT --- resources/costing/ResourceFile_Costing.xlsx | 4 +- resources/costing/~$ResourceFile_Costing.xlsx | 3 + .../analysis_scenarios_draws.json | 245 ++++++++++++++++++ src/tlo/methods/hiv.py | 37 ++- src/tlo/methods/tb.py | 42 ++- 5 files changed, 304 insertions(+), 27 deletions(-) create mode 100644 resources/costing/~$ResourceFile_Costing.xlsx create mode 100644 src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index b2f146c2fe..f6e8ff9344 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f053aa28de62547d6a1f36ace122fe62e3caff03e4fc5babbf157a9e14b66fc2 -size 1005374 +oid sha256:2e73c37d42dbb70c452d5abe3fbaa09be11430dcb0e730b05a736d8c79a65c4a +size 1006136 diff --git a/resources/costing/~$ResourceFile_Costing.xlsx b/resources/costing/~$ResourceFile_Costing.xlsx new file mode 100644 index 0000000000..d5d6d83ccc --- /dev/null +++ b/resources/costing/~$ResourceFile_Costing.xlsx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:019349b15c524cfef4b39db4dd792de3376f4bc3da9b6b298a1fee07c4eb219e +size 165 diff --git a/src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json b/src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json new file mode 100644 index 0000000000..f456b70bd1 --- /dev/null +++ b/src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json @@ -0,0 +1,245 @@ +{ + "scenario_script_path": "src/scripts/malaria/impact_analysis/analysis_scenarios.py", + "scenario_seed": 0, + "runs_per_draw": 5, + "draws": [ + { + "draw_number": 0, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "*" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 0 + } + } + }, + { + "draw_number": 1, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "*" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 1 + } + } + }, + { + "draw_number": 2, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "*" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 2 + } + } + }, + { + "draw_number": 3, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "*" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 3 + } + } + }, + { + "draw_number": 4, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "*" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 5 + } + } + }, + { + "draw_number": 5, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "Alri_*", + "AntenatalCare_*", + "BladderCancer_*", + "BreastCancer_*", + "CardioMetabolicDisorders_*", + "Contraception_*", + "Copd_*", + "DeliveryCare_*", + "Depression_*", + "Diarrhoea_*", + "Epi_*", + "Epilepsy_*", + "FirstAttendance_*", + "Malaria_*", + "Measles_*", + "OesophagealCancer_*", + "OtherAdultCancer_*", + "PostnatalCare_*", + "ProstateCancer_*", + "Rti_*", + "Schisto_*", + "Tb_*", + "Undernutrition_*", + "Hiv_PalliativeCare" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 0 + } + } + }, + { + "draw_number": 6, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "Alri_*", + "AntenatalCare_*", + "BladderCancer_*", + "BreastCancer_*", + "CardioMetabolicDisorders_*", + "Contraception_*", + "Copd_*", + "DeliveryCare_*", + "Depression_*", + "Diarrhoea_*", + "Epi_*", + "Epilepsy_*", + "FirstAttendance_*", + "Hiv_*", + "Malaria_*", + "Measles_*", + "OesophagealCancer_*", + "OtherAdultCancer_*", + "PostnatalCare_*", + "ProstateCancer_*", + "Rti_*", + "Schisto_*", + "Undernutrition_*", + "Tb_PalliativeCare" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 0 + } + } + }, + { + "draw_number": 7, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "Alri_*", + "AntenatalCare_*", + "BladderCancer_*", + "BreastCancer_*", + "CardioMetabolicDisorders_*", + "Contraception_*", + "Copd_*", + "DeliveryCare_*", + "Depression_*", + "Diarrhoea_*", + "Epi_*", + "Epilepsy_*", + "FirstAttendance_*", + "Hiv_*", + "Measles_*", + "OesophagealCancer_*", + "OtherAdultCancer_*", + "PostnatalCare_*", + "ProstateCancer_*", + "Rti_*", + "Schisto_*", + "Tb_*", + "Undernutrition_*", + "Malaria_Treatment_Complicated" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 3 + } + } + }, + { + "draw_number": 8, + "parameters": { + "HealthSystem": { + "Service_Availability": [ + "Alri_*", + "AntenatalCare_*", + "BladderCancer_*", + "BreastCancer_*", + "CardioMetabolicDisorders_*", + "Contraception_*", + "Copd_*", + "DeliveryCare_*", + "Depression_*", + "Diarrhoea_*", + "Epi_*", + "Epilepsy_*", + "FirstAttendance_*", + "Measles_*", + "OesophagealCancer_*", + "OtherAdultCancer_*", + "PostnatalCare_*", + "ProstateCancer_*", + "Rti_*", + "Schisto_*", + "Undernutrition_*", + "Hiv_PalliativeCare", + "Tb_PalliativeCare", + "Malaria_Treatment_Complicated" + ], + "use_funded_or_actual_staffing": "funded", + "mode_appt_constraints": 1, + "policy_name": "Naive" + }, + "Hiv": { + "scenario": 3 + } + } + } + ], + "commit": "bc91bdca536aace9c51a36b72628d532ef172019", + "github": "https://github.com/UCL/TLOmodel/tree/bc91bdca536aace9c51a36b72628d532ef172019" +} \ No newline at end of file diff --git a/src/tlo/methods/hiv.py b/src/tlo/methods/hiv.py index 4601e2117e..7377b93f51 100644 --- a/src/tlo/methods/hiv.py +++ b/src/tlo/methods/hiv.py @@ -958,32 +958,37 @@ def initialise_simulation(self, sim): self.item_codes_for_consumables_required['circ'] = \ hs.get_item_codes_from_package_name("Male circumcision ") - # 1 tablet daily + # adult prep: 1 tablet daily self.item_codes_for_consumables_required['prep'] = \ hs.get_item_code_from_item_name("Tenofovir (TDF)/Emtricitabine (FTC), tablet, 300/200 mg") - # infant NVP 1.5mg daily for birth weight 2500g or above, 6 weeks + # infant NVP 1.5mg daily for birth weight 2500g or above, for 6 weeks self.item_codes_for_consumables_required['infant_prep'] = \ hs.get_item_code_from_item_name("Nevirapine, oral solution, 10 mg/ml") # First - line ART for adults(age > "ART_age_cutoff_older_child") + # TDF/3TC/DTG 120/60/50mg, 1 tablet per day + # cotrim adult tablet, 1 tablet per day self.item_codes_for_consumables_required['First-line ART regimen: adult'] = \ hs.get_item_code_from_item_name("First-line ART regimen: adult") self.item_codes_for_consumables_required['First-line ART regimen: adult: cotrimoxazole'] = \ hs.get_item_code_from_item_name("Cotrimoxizole, 960mg pppy") # ART for older children aged ("ART_age_cutoff_younger_child" < age <= "ART_age_cutoff_older_child"): - # cotrim is separate item - optional in get_cons call + # ABC/3TC/DTG 120/60/50mg, 3 tablets per day + # cotrim paediatric tablet, 4 tablets per day self.item_codes_for_consumables_required['First line ART regimen: older child'] = \ hs.get_item_code_from_item_name("First line ART regimen: older child") self.item_codes_for_consumables_required['First line ART regimen: older child: cotrimoxazole'] = \ - hs.get_item_code_from_item_name("Sulfamethoxazole + trimethropin, tablet 400 mg + 80 mg") + hs.get_item_code_from_item_name("Cotrimoxazole 120mg_1000_CMST") # ART for younger children aged (age < "ART_age_cutoff_younger_child"): + # ABC/3TC/DTG 120/60/10mg, 2 tablets per day + # cotrim paediatric tablet, 2 tablets per day self.item_codes_for_consumables_required['First line ART regimen: young child'] = \ hs.get_item_code_from_item_name("First line ART regimen: young child") self.item_codes_for_consumables_required['First line ART regimen: young child: cotrimoxazole'] = \ - hs.get_item_code_from_item_name("Sulfamethoxazole + trimethropin, oral suspension, 240 mg, 100 ml") + hs.get_item_code_from_item_name("Cotrimoxazole 120mg_1000_CMST") # 7) Define the DxTests # HIV Rapid Diagnostic Test: @@ -2630,29 +2635,33 @@ def get_drugs(self, age_of_person): whether individual drugs were available""" p = self.module.parameters + dispensation_days = 30 * self.module.parameters['dispensation_period_months'] if age_of_person < p["ART_age_cutoff_young_child"]: # Formulation for young children drugs_available = self.get_consumables( - item_codes=self.module.item_codes_for_consumables_required['First line ART regimen: young child'], - optional_item_codes=self.module.item_codes_for_consumables_required[ - 'First line ART regimen: young child: cotrimoxazole'], + item_codes={self.module.item_codes_for_consumables_required[ + 'First line ART regimen: young child']: dispensation_days * 2}, + optional_item_codes={self.module.item_codes_for_consumables_required[ + 'First line ART regimen: young child: cotrimoxazole']: dispensation_days * 2}, return_individual_results=True) elif age_of_person <= p["ART_age_cutoff_older_child"]: # Formulation for older children drugs_available = self.get_consumables( - item_codes=self.module.item_codes_for_consumables_required['First line ART regimen: older child'], - optional_item_codes=self.module.item_codes_for_consumables_required[ - 'First line ART regimen: older child: cotrimoxazole'], + item_codes={self.module.item_codes_for_consumables_required[ + 'First line ART regimen: older child']: dispensation_days * 3}, + optional_item_codes={self.module.item_codes_for_consumables_required[ + 'First line ART regimen: older child: cotrimoxazole']: dispensation_days * 4}, return_individual_results=True) else: # Formulation for adults drugs_available = self.get_consumables( - item_codes=self.module.item_codes_for_consumables_required['First-line ART regimen: adult'], - optional_item_codes=self.module.item_codes_for_consumables_required[ - 'First-line ART regimen: adult: cotrimoxazole'], + item_codes={self.module.item_codes_for_consumables_required[ + 'First-line ART regimen: adult']: dispensation_days}, + optional_item_codes={self.module.item_codes_for_consumables_required[ + 'First-line ART regimen: adult: cotrimoxazole']: dispensation_days}, return_individual_results=True) # add drug names to dict diff --git a/src/tlo/methods/tb.py b/src/tlo/methods/tb.py index 79afd6fa5f..6995cf1eba 100644 --- a/src/tlo/methods/tb.py +++ b/src/tlo/methods/tb.py @@ -740,6 +740,7 @@ def get_consumables_for_dx_and_tx(self): ) # 4) -------- Define the treatment options -------- + # treatment supplied as full kits for duration of treatment # adult treatment - primary self.item_codes_for_consumables_required['tb_tx_adult'] = \ hs.get_item_code_from_item_name("Cat. I & III Patient Kit A") @@ -761,12 +762,16 @@ def get_consumables_for_dx_and_tx(self): hs.get_item_code_from_item_name("Cat. II Patient Kit A2") # mdr treatment - self.item_codes_for_consumables_required['tb_mdrtx'] = { - hs.get_item_code_from_item_name("Treatment: second-line drugs"): 1} + self.item_codes_for_consumables_required['tb_mdrtx'] = \ + hs.get_item_code_from_item_name("Treatment: second-line drugs") # ipt - self.item_codes_for_consumables_required['tb_ipt'] = { - hs.get_item_code_from_item_name("Isoniazid/Pyridoxine, tablet 300 mg"): 1} + self.item_codes_for_consumables_required['tb_isoniazid'] = \ + hs.get_item_code_from_item_name("Isoniazid/Pyridoxine, tablet 300 mg") + + # todo not yet on consumables database + # self.item_codes_for_consumables_required['tb_3HP'] = { + # hs.get_item_code_from_item_name("Isoniazid/Rifapentine"): 1} def initialise_population(self, population): @@ -2192,8 +2197,9 @@ def apply(self, person_id, squeeze_factor): return self.sim.modules["HealthSystem"].get_blank_appt_footprint() treatment_regimen = self.select_treatment(person_id) + # treatment supplied in kits, one kit per treatment course treatment_available = self.get_consumables( - item_codes=self.module.item_codes_for_consumables_required[treatment_regimen] + item_codes={self.module.item_codes_for_consumables_required[treatment_regimen]: 1} ) if treatment_available: @@ -2432,8 +2438,9 @@ class HSI_Tb_Start_or_Continue_Ipt(HSI_Event, IndividualScopeEventMixin): * HIV.HSI_Hiv_StartOrContinueTreatment for PLHIV, diagnosed and on ART * Tb.HSI_Tb_StartTreatment for up to 5 contacts of diagnosed active TB case - if person referred by ART initiation (HIV+), IPT given for 36 months - paediatric IPT is 6-9 months + Isoniazid preventive therapy for HIV-infected children : 6 months, 180 doses + 3HP (Isoniazid/Rifapentine) for adults: 12 weeks, 12 doses + 3HP for children ages >2 yrs hiv- """ def __init__(self, module, person_id): @@ -2473,10 +2480,23 @@ def apply(self, person_id, squeeze_factor): else: # Check/log use of consumables, and give IPT if available - # if not available, reschedule IPT start - if self.get_consumables( - item_codes=self.module.item_codes_for_consumables_required["tb_ipt"] - ): + + # if child and HIV+ or child under 2 yrs + if ((person["age_years"] <= 15) and person["hv_inf"]) or (person["age_years"] <= 2): + + # 6 months dispensation, once daily + drugs_available = self.get_consumables( + item_codes={self.module.item_codes_for_consumables_required["tb_ipt"]: 180}) + + # for all others + # todo check 3HP listed in database + else: + # 12 weeks dispensation, once weekly + drugs_available = self.get_consumables( + item_codes={self.module.item_codes_for_consumables_required["tb_3HP"]: 12}) + + # if available, schedule IPT decision + if drugs_available: # Update properties df.at[person_id, "tb_on_ipt"] = True df.at[person_id, "tb_date_ipt"] = self.sim.date From 7d67c5c3097efb787c8fb9dc609cc89928d0347b Mon Sep 17 00:00:00 2001 From: tdm32 Date: Wed, 27 Mar 2024 12:02:24 +0000 Subject: [PATCH 08/59] add conditions for each IPT recommendation --- resources/costing/~$ResourceFile_Costing.xlsx | 3 --- src/tlo/methods/tb.py | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 resources/costing/~$ResourceFile_Costing.xlsx diff --git a/resources/costing/~$ResourceFile_Costing.xlsx b/resources/costing/~$ResourceFile_Costing.xlsx deleted file mode 100644 index d5d6d83ccc..0000000000 --- a/resources/costing/~$ResourceFile_Costing.xlsx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:019349b15c524cfef4b39db4dd792de3376f4bc3da9b6b298a1fee07c4eb219e -size 165 diff --git a/src/tlo/methods/tb.py b/src/tlo/methods/tb.py index 6995cf1eba..59f360780f 100644 --- a/src/tlo/methods/tb.py +++ b/src/tlo/methods/tb.py @@ -770,8 +770,8 @@ def get_consumables_for_dx_and_tx(self): hs.get_item_code_from_item_name("Isoniazid/Pyridoxine, tablet 300 mg") # todo not yet on consumables database - # self.item_codes_for_consumables_required['tb_3HP'] = { - # hs.get_item_code_from_item_name("Isoniazid/Rifapentine"): 1} + self.item_codes_for_consumables_required['tb_3HP'] = { + hs.get_item_code_from_item_name("Isoniazid/Rifapentine"): 1} def initialise_population(self, population): From ae0d18f0cb3389853ca9bbcc077d56816b7e1b45 Mon Sep 17 00:00:00 2001 From: sm2511 Date: Thu, 28 Mar 2024 14:57:15 +0000 Subject: [PATCH 09/59] add prices for ARVs - and create placeholder for Isoniazid/Rifapentine --- resources/costing/ResourceFile_Costing.xlsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index cd9c0e63a6..4207f556c0 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c02f133045eaa139e37af44e9f88da6c954e3254ca7c8f8a7327ca4b80876dcf -size 1005696 +oid sha256:7fc22d8bd0ac4b1b1777ce816acfd44c4430932a4f4619abae144a3d7c9d4dc4 +size 1007307 From c666e502b75d3e35479647bbecb319a1d7ade0f4 Mon Sep 17 00:00:00 2001 From: sm2511 Date: Thu, 28 Mar 2024 15:12:04 +0000 Subject: [PATCH 10/59] add Isoniazid/Rifapentine to `ResourceFile_Consumables_Items_and_Packages.csv` --- ...urceFile_Consumables_Items_and_Packages.csv | 4 ++-- ...rate_consumables_item_codes_and_packages.py | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv index 8af8f070b2..98c85fb1cb 100644 --- a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv +++ b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:85e2c3ba8037e74490751fbb8384709dff1907c785c856f0394f40b4fc024da3 -size 253400 +oid sha256:743c05348267ae887993b280cfb28752a8353a356566e5ab41276160ea7276ef +size 249149 diff --git a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py index 3fcbccf9e2..f9f5149097 100644 --- a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py +++ b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py @@ -21,7 +21,8 @@ # Set local Dropbox source path_to_dropbox = Path( # <-- point to the TLO dropbox locally - '/Users/tbh03/Dropbox (SPH Imperial College)/Thanzi la Onse Theme 1 SHARE') + # '/Users/tbh03/Dropbox (SPH Imperial College)/Thanzi la Onse Theme 1 SHARE' + '/Users/sm2511/Dropbox/Thanzi La Onse') resourcefilepath = Path("./resources") path_for_new_resourcefiles = resourcefilepath / "healthsystem/consumables" @@ -245,7 +246,7 @@ def add_record(df: pd.DataFrame, record: Dict): """Add a row to the bottom of the dataframe, where the row is specified by a dict keyed by the target columns.""" - assert list(df.columns) == list(record.keys()) + assert set(df.columns) == set(record.keys()) return pd.concat([df, pd.DataFrame.from_records([record])], ignore_index=True) @@ -328,6 +329,19 @@ def add_record(df: pd.DataFrame, record: Dict): }, ) +cons = add_record( + cons, + { + 'Intervention_Cat': "Added by SM (Recommended by TM)", + 'Intervention_Pkg': "Misc", + 'Intervention_Pkg_Code': -99, + 'Items': "Isoniazid/Rifapentine", + 'Item_Code': 2675, + 'Expected_Units_Per_Case': 1.0, + 'Unit_Cost': 1.0 + }, +) + # -------------- # -------------- # -------------- From 2667397053f5dc2752e29c2218affa58bbb95aa1 Mon Sep 17 00:00:00 2001 From: sm2511 Date: Wed, 3 Apr 2024 15:58:39 +0100 Subject: [PATCH 11/59] add Isoniazid/Rifapentine to all relevant RFs - 1. `ResourceFile_Consumables_Items_and_Packages.csv` - list of item codes and names - 2. `ResourceFile_consumabes_matched.csv` - crosswalk between consumables in the TLO model and the OpenLMIS dataset to extract availability (used proxy 'Isoniazid, 100mg' OR 'Isoniazid, 300mg') - 3. `ResourceFile_Consumables_availability_small.csv` - Final availability estimates - updated by running `consumables_availability_estimation.py` - 4 `ResourceFile_Costing.xlsx` - cost of tablet based on external web report --- resources/costing/ResourceFile_Costing.xlsx | 4 ++-- .../ResourceFile_Consumables_Items_and_Packages.csv | 4 ++-- .../ResourceFile_Consumables_availability_small.csv | 4 ++-- .../consumables/ResourceFile_consumables_matched.csv | 4 ++-- .../consumables_availability_estimation.py | 2 +- .../generate_consumables_item_codes_and_packages.py | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index 4207f556c0..840fdbca8f 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7fc22d8bd0ac4b1b1777ce816acfd44c4430932a4f4619abae144a3d7c9d4dc4 -size 1007307 +oid sha256:070cc08625170fab8e11198a350822b427c84add24444b6293bc830102c9b612 +size 1007683 diff --git a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv index 98c85fb1cb..e5e17d740c 100644 --- a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv +++ b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:743c05348267ae887993b280cfb28752a8353a356566e5ab41276160ea7276ef -size 249149 +oid sha256:a188114a407bb28dc663a41a2854cb9d75c207dbb0809ff3ce8c1f88eca378aa +size 249189 diff --git a/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv b/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv index 54453cbc2f..7db58ae153 100644 --- a/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv +++ b/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69a5143c0b7307c7bb48726aa73d6c2f61de2a69aeb445eec87494cf9d4a1041 -size 6087331 +oid sha256:2261b945069955c025e106116ae167cd8dc167a962d7387b9e808b9683f5fa69 +size 6122712 diff --git a/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv b/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv index 7754d65118..73fd80d045 100644 --- a/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv +++ b/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fbfe91222d3a2a32ed44a4be711b30c5323276a71df802f6c9249eb4c21f8d43 -size 90158 +oid sha256:d8649f9521dfd5bdbf2bc525c7dd0922a32d657fd8f69394bd997d7a595b9576 +size 90430 diff --git a/src/scripts/data_file_processing/healthsystem/consumables/consumable_resource_analyses_with_lmis/consumables_availability_estimation.py b/src/scripts/data_file_processing/healthsystem/consumables/consumable_resource_analyses_with_lmis/consumables_availability_estimation.py index ccef5c219d..44868b562a 100644 --- a/src/scripts/data_file_processing/healthsystem/consumables/consumable_resource_analyses_with_lmis/consumables_availability_estimation.py +++ b/src/scripts/data_file_processing/healthsystem/consumables/consumable_resource_analyses_with_lmis/consumables_availability_estimation.py @@ -277,7 +277,7 @@ def custom_agg(x): return _collapsed_df # Hold out the dataframe with no naming inconsistencies -list_of_items_with_inconsistent_names_zipped = list(zip(inconsistent_item_names_mapping.keys(), inconsistent_item_names_mapping.values())) +list_of_items_with_inconsistent_names_zipped = set(zip(inconsistent_item_names_mapping.keys(), inconsistent_item_names_mapping.values())) list_of_items_with_inconsistent_names = [item for sublist in list_of_items_with_inconsistent_names_zipped for item in sublist] df_with_consistent_item_names = lmis_df_wide_flat[~lmis_df_wide_flat[('item',)].isin(list_of_items_with_inconsistent_names)] df_without_consistent_item_names = lmis_df_wide_flat[lmis_df_wide_flat[('item',)].isin(list_of_items_with_inconsistent_names)] diff --git a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py index f9f5149097..3e5b742a3e 100644 --- a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py +++ b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py @@ -333,10 +333,10 @@ def add_record(df: pd.DataFrame, record: Dict): cons, { 'Intervention_Cat': "Added by SM (Recommended by TM)", - 'Intervention_Pkg': "Misc", - 'Intervention_Pkg_Code': -99, + 'Intervention_Pkg': "Isoniazid preventative therapy for HIV+ no TB", + 'Intervention_Pkg_Code': 82, 'Items': "Isoniazid/Rifapentine", - 'Item_Code': 2675, + 'Item_Code': 2678, 'Expected_Units_Per_Case': 1.0, 'Unit_Cost': 1.0 }, From ab7328a97df7f174bf80a07a995d3433465906cf Mon Sep 17 00:00:00 2001 From: joehcollins Date: Fri, 5 Apr 2024 13:26:57 +0100 Subject: [PATCH 12/59] Update to the functionality for requesting consumables across the MNH modules to allow for clearer requesting of units of consumables for costing (correct number of units not yet implemented for all consumables) --- .../methods/care_of_women_during_pregnancy.py | 295 ++++++++++-------- src/tlo/methods/labour.py | 286 +++++++++-------- src/tlo/methods/newborn_outcomes.py | 62 ++-- src/tlo/methods/postnatal_supervisor.py | 32 +- src/tlo/methods/pregnancy_helper_functions.py | 17 +- 5 files changed, 381 insertions(+), 311 deletions(-) diff --git a/src/tlo/methods/care_of_women_during_pregnancy.py b/src/tlo/methods/care_of_women_during_pregnancy.py index 42e026478c..b30b191066 100644 --- a/src/tlo/methods/care_of_women_during_pregnancy.py +++ b/src/tlo/methods/care_of_women_during_pregnancy.py @@ -1,6 +1,7 @@ from pathlib import Path import pandas as pd +import numpy as np from tlo import DateOffset, Module, Parameter, Property, Types, logging from tlo.events import IndividualScopeEventMixin, PopulationScopeEventMixin, RegularEvent @@ -202,157 +203,162 @@ def get_and_store_pregnancy_item_codes(self): This function defines the required consumables for each intervention delivered during this module and stores them in a module level dictionary called within HSIs """ - get_list_of_items = pregnancy_helper_functions.get_list_of_items + ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name + # First we store the item codes for the consumables for which their quantity varies for individuals based on + # length of pregnancy # ---------------------------------- BLOOD TEST EQUIPMENT --------------------------------------------------- self.item_codes_preg_consumables['blood_test_equipment'] = \ - get_list_of_items(self, ['Blood collecting tube, 5 ml', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box']) - + {ic('Blood collecting tube, 5 ml'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1 + } # ---------------------------------- IV DRUG ADMIN EQUIPMENT ------------------------------------------------- self.item_codes_preg_consumables['iv_drug_equipment'] = \ - get_list_of_items(self, ['Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box']) + {ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1 + } # -------------------------------------------- ECTOPIC PREGNANCY --------------------------------------------- self.item_codes_preg_consumables['ectopic_pregnancy_core'] = \ - get_list_of_items(self, ['Halothane (fluothane)_250ml_CMST']) + {ic('Halothane (fluothane)_250ml_CMST'): 1} # TODO: dose self.item_codes_preg_consumables['ectopic_pregnancy_optional'] = \ - get_list_of_items(self, ['Scalpel blade size 22 (individually wrapped)_100_CMST', - 'Sodium chloride, injectable solution, 0,9 %, 500 ml', - 'Paracetamol, tablet, 500 mg', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Suture pack', - 'Gauze, absorbent 90cm x 40m_each_CMST', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box' - ]) + {ic('Scalpel blade size 22 (individually wrapped)_100_CMST'): 1, + ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Paracetamol, tablet, 500 mg'): 8000, + ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, # todo: dose + ic('Suture pack'): 1, + ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + } # ------------------------------------------- POST ABORTION CARE - GENERAL ----------------------------------- self.item_codes_preg_consumables['post_abortion_care_core'] = \ - get_list_of_items(self, ['Misoprostol, tablet, 200 mcg']) + {ic('Misoprostol, tablet, 200 mcg'): 1} # TODO: dose self.item_codes_preg_consumables['post_abortion_care_optional'] = \ - get_list_of_items(self, ['Complete blood count', - 'Blood collecting tube, 5 ml', - 'Paracetamol, tablet, 500 mg', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box' - ]) + {ic('Complete blood count'): 1, + ic('Blood collecting tube, 5 ml'): 1, + ic('Paracetamol, tablet, 500 mg'): 8000, + ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + } # ------------------------------------------- POST ABORTION CARE - SEPSIS ------------------------------------- self.item_codes_preg_consumables['post_abortion_care_sepsis_core'] = \ - get_list_of_items(self, ['Benzylpenicillin 3g (5MU), PFR_each_CMST', - 'Gentamycin, injection, 40 mg/ml in 2 ml vial']) + {ic('Benzylpenicillin 3g (5MU), PFR_each_CMST'): 1, # TODO: dose + ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 1, # TODO: dose + } self.item_codes_preg_consumables['post_abortion_care_sepsis_optional'] = \ - get_list_of_items(self, ['Sodium chloride, injectable solution, 0,9 %, 500 ml', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Oxygen, 1000 liters, primarily with oxygen cylinders']) - - # ------------------------------------------- POST ABORTION CARE - SHOCK ------------------------------------- + {ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # TODO: dose + } + + # ------------------------------------------- POST ABORTION CARE - SHOCK ------------------------------------ self.item_codes_preg_consumables['post_abortion_care_shock'] = \ - get_list_of_items(self, ['Sodium chloride, injectable solution, 0,9 %, 500 ml', - 'Oxygen, 1000 liters, primarily with oxygen cylinders']) + {ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # TODO: dose + } self.item_codes_preg_consumables['post_abortion_care_shock_optional'] = \ - get_list_of_items(self, ['Cannula iv (winged with injection pot) 18_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box', - 'Giving set iv administration + needle 15 drops/ml_each_CMST']) - + {ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + } # ---------------------------------- URINE DIPSTICK ---------------------------------------------------------- - self.item_codes_preg_consumables['urine_dipstick'] = get_list_of_items(self, ['Urine analysis']) + self.item_codes_preg_consumables['urine_dipstick'] = {ic('Urine analysis'): 1} # ---------------------------------- IRON AND FOLIC ACID ------------------------------------------------------ - self.item_codes_preg_consumables['iron_folic_acid'] = get_list_of_items( - self, ['Ferrous Salt + Folic Acid, tablet, 200 + 0.25 mg']) + # Dose changes at run time + self.item_codes_preg_consumables['iron_folic_acid'] = \ + {ic('Ferrous Salt + Folic Acid, tablet, 200 + 0.25 mg'): 1} # TODO: update con requested here # --------------------------------- BALANCED ENERGY AND PROTEIN ---------------------------------------------- - self.item_codes_preg_consumables['balanced_energy_protein'] = get_list_of_items( - self, ['Dietary supplements (country-specific)']) + # Dose changes at run time + self.item_codes_preg_consumables['balanced_energy_protein'] = \ + {ic('Dietary supplements (country-specific)'): 1} # --------------------------------- INSECTICIDE TREATED NETS ------------------------------------------------ - self.item_codes_preg_consumables['itn'] = get_list_of_items(self, ['Insecticide-treated net']) + self.item_codes_preg_consumables['itn'] = {ic('Insecticide-treated net'): 1} # --------------------------------- CALCIUM SUPPLEMENTS ----------------------------------------------------- - self.item_codes_preg_consumables['calcium'] = get_list_of_items(self, ['Calcium, tablet, 600 mg']) + self.item_codes_preg_consumables['calcium'] = {ic('Calcium, tablet, 600 mg'): 1} # -------------------------------- HAEMOGLOBIN TESTING ------------------------------------------------------- - self.item_codes_preg_consumables['hb_test'] = get_list_of_items(self, ['Haemoglobin test (HB)']) + self.item_codes_preg_consumables['hb_test'] = {ic('Haemoglobin test (HB)'): 1} # ------------------------------------------- ALBENDAZOLE ----------------------------------------------------- - self.item_codes_preg_consumables['albendazole'] = get_list_of_items(self, ['Albendazole 200mg_1000_CMST']) + self.item_codes_preg_consumables['albendazole'] = {ic('Albendazole 200mg_1000_CMST'): 400} # ------------------------------------------- HEP B TESTING --------------------------------------------------- - self.item_codes_preg_consumables['hep_b_test'] = get_list_of_items( - self, ['Hepatitis B test kit-Dertemine_100 tests_CMST']) + self.item_codes_preg_consumables['hep_b_test'] = {ic('Hepatitis B test kit-Dertemine_100 tests_CMST'): 1} # ------------------------------------------- SYPHILIS TESTING ------------------------------------------------ - self.item_codes_preg_consumables['syphilis_test'] = get_list_of_items( - self, ['Test, Rapid plasma reagin (RPR)']) + self.item_codes_preg_consumables['syphilis_test'] = {ic('Test, Rapid plasma reagin (RPR)'): 1} # ------------------------------------------- SYPHILIS TREATMENT ---------------------------------------------- - self.item_codes_preg_consumables['syphilis_treatment'] = get_list_of_items( - self, ['Benzathine benzylpenicillin, powder for injection, 2.4 million IU']) - - # ----------------------------------------------- IPTP -------------------------------------------------------- - self.item_codes_preg_consumables['iptp'] = get_list_of_items( - self, ['Sulfamethoxazole + trimethropin, tablet 400 mg + 80 mg']) + self.item_codes_preg_consumables['syphilis_treatment'] =\ + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 1} # ----------------------------------------------- GDM TEST ---------------------------------------------------- - self.item_codes_preg_consumables['gdm_test'] = get_list_of_items(self, ['Blood glucose level test']) + self.item_codes_preg_consumables['gdm_test'] = {ic('Blood glucose level test'): 1} # ------------------------------------------ FULL BLOOD COUNT ------------------------------------------------- - self.item_codes_preg_consumables['full_blood_count'] = get_list_of_items(self, ['Complete blood count']) + self.item_codes_preg_consumables['full_blood_count'] = {ic('Complete blood count'): 1} # ---------------------------------------- BLOOD TRANSFUSION ------------------------------------------------- - self.item_codes_preg_consumables['blood_transfusion'] = get_list_of_items(self, ['Blood, one unit']) + self.item_codes_preg_consumables['blood_transfusion'] = {ic('Blood, one unit'): 2} # --------------------------------------- ORAL ANTIHYPERTENSIVES --------------------------------------------- - self.item_codes_preg_consumables['oral_antihypertensives'] = get_list_of_items( - self, ['Methyldopa 250mg_1000_CMST']) + # Dose changes at run time + self.item_codes_preg_consumables['oral_antihypertensives'] = {ic('Methyldopa 250mg_1000_CMST'): 1} # ------------------------------------- INTRAVENOUS ANTIHYPERTENSIVES --------------------------------------- - self.item_codes_preg_consumables['iv_antihypertensives'] = get_list_of_items( - self, ['Hydralazine, powder for injection, 20 mg ampoule']) + self.item_codes_preg_consumables['iv_antihypertensives'] = \ + {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} # ---------------------------------------- MAGNESIUM SULPHATE ------------------------------------------------ - self.item_codes_preg_consumables['magnesium_sulfate'] = get_list_of_items( - self, ['Magnesium sulfate, injection, 500 mg/ml in 10-ml ampoule']) + self.item_codes_preg_consumables['magnesium_sulfate'] = \ + {ic('Magnesium sulfate, injection, 500 mg/ml in 10-ml ampoule'): 2} # ---------------------------------------- MANAGEMENT OF ECLAMPSIA -------------------------------------------- - self.item_codes_preg_consumables['eclampsia_management_optional'] = get_list_of_items( - self, ['Misoprostol, tablet, 200 mcg', - 'Oxytocin, injection, 10 IU in 1 ml ampoule', - 'Sodium chloride, injectable solution, 0,9 %, 500 ml', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box', - 'Oxygen, 1000 liters, primarily with oxygen cylinders', - 'Complete blood count', - 'Blood collecting tube, 5 ml', - 'Foley catheter', - 'Bag, urine, collecting, 2000 ml']) + self.item_codes_preg_consumables['eclampsia_management_optional'] = \ + {ic('Misoprostol, tablet, 200 mcg'): 1, # todo: dose + ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1, # todo: dose + ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + ic('Complete blood count'): 1, + ic('Blood collecting tube, 5 ml'): 1, + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + } # -------------------------------------- ANTIBIOTICS FOR PROM ------------------------------------------------ - self.item_codes_preg_consumables['abx_for_prom'] = get_list_of_items( - self, ['Benzathine benzylpenicillin, powder for injection, 2.4 million IU']) + self.item_codes_preg_consumables['abx_for_prom'] = \ + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 1} # todo: dose # ----------------------------------- ORAL DIABETIC MANAGEMENT ----------------------------------------------- - self.item_codes_preg_consumables['oral_diabetic_treatment'] = get_list_of_items( - self, ['Glibenclamide 5mg_1000_CMST']) + # Dose changes at run time + self.item_codes_preg_consumables['oral_diabetic_treatment'] = \ + {ic('Glibenclamide 5mg_1000_CMST'): 1} # ---------------------------------------- INSULIN ---------------------------------------------------------- - self.item_codes_preg_consumables['insulin_treatment'] = get_list_of_items( - self, ['Insulin soluble 100 IU/ml, 10ml_each_CMST']) + # Dose changes at run time + self.item_codes_preg_consumables['insulin_treatment'] = \ + {ic('Insulin soluble 100 IU/ml, 10ml_each_CMST'): 1} def initialise_simulation(self, sim): @@ -730,7 +736,7 @@ def screening_interventions_delivered_at_every_contact(self, hsi_event): # check consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='urine_dipstick') + self, hsi_event, cons=self.item_codes_preg_consumables['urine_dipstick'], opt_cons=None) # If the intervention will be delivered the dx_manager runs, returning True if the consumables are # available and the test detects protein in the urine @@ -788,8 +794,10 @@ def iron_and_folic_acid_supplementation(self, hsi_event): # check consumable availability - dose is total days of pregnancy x 2 tablets days = self.get_approx_days_of_pregnancy(person_id) + updated_cons = {k: v*(days*2) for (k, v) in self.item_codes_preg_consumables['iron_folic_acid'].items()} + avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='iron_folic_acid', number=days*3) + self, hsi_event, cons=updated_cons, opt_cons=None) if avail: logger.info(key='anc_interventions', data={'mother': person_id, 'intervention': 'iron_folic_acid'}) @@ -822,8 +830,11 @@ def balance_energy_and_protein_supplementation(self, hsi_event): # If the consumables are available... days = self.get_approx_days_of_pregnancy(person_id) + updated_cons = {k: v*days for (k, v) in + self.item_codes_preg_consumables['balanced_energy_protein'].items()} + avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='balanced_energy_protein', number=days) + self, hsi_event, cons=updated_cons, opt_cons=None) # And she is deemed to be at risk (i.e. BMI < 18) she is started on supplements if avail and (df.at[person_id, 'li_bmi'] == 1): @@ -885,8 +896,11 @@ def calcium_supplementation(self, hsi_event): or (df.at[person_id, 'la_parity'] > 4)): days = self.get_approx_days_of_pregnancy(person_id) * 3 + updated_cons = {k: v * days for (k, v) in + self.item_codes_preg_consumables['calcium'].items()} + avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='calcium', number=days) + self, hsi_event, cons=updated_cons, opt_cons=None) if avail: df.at[person_id, 'ac_receiving_calcium_supplements'] = True @@ -909,7 +923,9 @@ def point_of_care_hb_testing(self, hsi_event): # Run check against probability of testing being delivered avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='hb_test', optional='blood_test_equipment') + self, hsi_event, + cons=self.item_codes_preg_consumables['hb_test'], + opt_cons=self.item_codes_preg_consumables['blood_test_equipment']) # We run the test through the dx_manager and if a woman has anaemia and its detected she will be admitted # for further care @@ -983,8 +999,9 @@ def syphilis_screening_and_treatment(self, hsi_event): logger.info(key='anc_interventions', data={'mother': person_id, 'intervention': 'syphilis_test'}) avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='syphilis_test', - optional='blood_test_equipment') + self, hsi_event, + cons=self.item_codes_preg_consumables['syphilis_test'], + opt_cons=self.item_codes_preg_consumables['blood_test_equipment']) test = self.sim.modules['HealthSystem'].dx_manager.run_dx_test( dx_tests_to_run='blood_test_syphilis', hsi_event=hsi_event) @@ -993,8 +1010,9 @@ def syphilis_screening_and_treatment(self, hsi_event): if avail and test: avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='syphilis_treatment', - optional='blood_test_equipment') + self, hsi_event, + cons=self.item_codes_preg_consumables['syphilis_treatment'], + opt_cons=self.item_codes_preg_consumables['blood_test_equipment']) if avail: # We assume that treatment is 100% effective at curing infection @@ -1059,7 +1077,9 @@ def gdm_screening(self, hsi_event): if self.rng.random_sample() < params['prob_intervention_delivered_gdm_test']: avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='gdm_test', optional='blood_test_equipment') + self, hsi_event, + cons=self.item_codes_preg_consumables['gdm_test'], + opt_cons=self.item_codes_preg_consumables['blood_test_equipment']) # If the test accurately detects a woman has gestational diabetes the consumables are recorded and # she is referred for treatment @@ -1225,8 +1245,9 @@ def antenatal_blood_transfusion(self, individual_id, hsi_event): # Check for consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='blood_transfusion', number=2, - optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_preg_consumables['blood_transfusion'], + opt_cons=self.item_codes_preg_consumables['iv_drug_equipment']) sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self.sim.modules['Labour'], sf='blood_tran', @@ -1253,9 +1274,12 @@ def initiate_maintenance_anti_hypertensive_treatment(self, individual_id, hsi_ev df = self.sim.population.props # Calculate the approximate dose for the remainder of pregnancy and check availability + days = self.get_approx_days_of_pregnancy(individual_id) * 4 + updated_cons = {k: v * days for (k, v) in + self.item_codes_preg_consumables['oral_antihypertensives'].items()} + avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='oral_antihypertensives', - number=(self.get_approx_days_of_pregnancy(individual_id) * 4)) + self, hsi_event, cons=updated_cons, opt_cons=None) # If the consumables are available then the woman is started on treatment if avail: @@ -1274,8 +1298,9 @@ def initiate_treatment_for_severe_hypertension(self, individual_id, hsi_event): # Define the consumables and check their availability avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='iv_antihypertensives', - optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_preg_consumables['iv_antihypertensives'], + opt_cons=self.item_codes_preg_consumables['iv_drug_equipment']) # If they are available then the woman is started on treatment if avail: @@ -1305,8 +1330,9 @@ def treatment_for_severe_pre_eclampsia_or_eclampsia(self, individual_id, hsi_eve df = self.sim.population.props avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='magnesium_sulfate', - optional='eclampsia_management_optional') + self, hsi_event, + cons=self.item_codes_preg_consumables['magnesium_sulfate'], + opt_cons=self.item_codes_preg_consumables['eclampsia_management_optional']) # check HCW will deliver intervention sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self.sim.modules['Labour'], @@ -1329,8 +1355,9 @@ def antibiotics_for_prom(self, individual_id, hsi_event): # check consumables and whether HCW are available to deliver the intervention avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_preg_consumables, core='abx_for_prom', - optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_preg_consumables['abx_for_prom'], + opt_cons=self.item_codes_preg_consumables['iv_drug_equipment']) sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self.sim.modules['Labour'], sf='iv_abx', @@ -2426,6 +2453,8 @@ def apply(self, person_id, squeeze_factor): if not mother.la_currently_in_labour and not mother.hs_is_inpatient and mother.ps_gest_diab != 'none' \ and (mother.ac_gest_diab_on_treatment != 'none') and (mother.ps_gestational_age_in_weeks > 21): + est_length_preg = self.module.get_approx_days_of_pregnancy(person_id) + def schedule_gdm_event_and_checkup(): # Schedule GestationalDiabetesGlycaemicControlEvent which determines if this new treatment will # effectively control blood glucose prior to next follow up @@ -2450,9 +2479,12 @@ def schedule_gdm_event_and_checkup(): # meds if mother.ac_gest_diab_on_treatment == 'diet_exercise': + days = est_length_preg * 10 + updated_cons = {k: v * days for (k, v) in + self.item_codes_preg_consumables['oral_diabetic_treatment'].items()} + avail = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='oral_diabetic_treatment', - number=(self.module.get_approx_days_of_pregnancy(person_id) * 2)) + self.module, self, cons=updated_cons, opt_cons=None) # If the meds are available women are started on that treatment if avail: @@ -2468,9 +2500,15 @@ def schedule_gdm_event_and_checkup(): # blood sugar- they are started on insulin if mother.ac_gest_diab_on_treatment == 'orals': + # Dose is (avg.) 0.8 units per KG per day. Average weight is an appoximation + required_units_per_preg = 65 * (0.8 * est_length_preg) + required_vials = np.ceil(required_units_per_preg/1000) + + updated_cons = {k: v * required_vials for (k, v) in + self.item_codes_preg_consumables['insulin_treatment'].items()} + avail = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='insulin_treatment', - number=5) + self.module, self, cons=updated_cons, opt_cons=None) if avail: df.at[person_id, 'ac_gest_diab_on_treatment'] = 'insulin' @@ -2514,8 +2552,9 @@ def apply(self, person_id, squeeze_factor): # Request baseline PAC consumables baseline_cons = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='post_abortion_care_core', - optional='post_abortion_care_optional') + self.module, self, + cons=self.module.item_codes_preg_consumables['post_abortion_care_core'], + opt_cons=self.module.item_codes_preg_consumables['post_abortion_care_optional']) # Check HCW availability to deliver surgical removal of retained products sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self.sim.modules['Labour'], @@ -2528,29 +2567,32 @@ def apply(self, person_id, squeeze_factor): if abortion_complications.has_any([person_id], 'sepsis', first=True): cons_for_sepsis_pac = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='post_abortion_care_sepsis_core', - optional='post_abortion_care_sepsis_optional') + self.module, self, + cons=self.module.item_codes_preg_consumables['post_abortion_care_sepsis_core'], + opt_cons=self.module.item_codes_preg_consumables['post_abortion_care_sepsis_optional']) if cons_for_sepsis_pac and (baseline_cons or sf_check): df.at[person_id, 'ac_received_post_abortion_care'] = True elif abortion_complications.has_any([person_id], 'haemorrhage', first=True): - cons_for_haemorrhage = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='blood_transfusion', number=2, - optional='iv_drug_equipment') + self.module, self, + cons=self.module.item_codes_preg_consumables['blood_transfusion'], + opt_cons=self.module.item_codes_preg_consumables['iv_drug_equipment']) cons_for_shock = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='post_abortion_care_shock', - optional='post_abortion_care_shock_optional') + self.module, self, + cons=self.module.item_codes_preg_consumables['post_abortion_care_shock'], + opt_cons=self.module.item_codes_preg_consumables['post_abortion_care_shock_optional']) if cons_for_haemorrhage and cons_for_shock and (baseline_cons or sf_check): df.at[person_id, 'ac_received_post_abortion_care'] = True elif abortion_complications.has_any([person_id], 'injury', first=True): cons_for_shock = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='post_abortion_care_shock', - optional='post_abortion_care_shock_optional') + self.module, self, + cons=self.module.item_codes_preg_consumables['post_abortion_care_shock'], + opt_cons=self.module.item_codes_preg_consumables['post_abortion_care_shock_optional']) if cons_for_shock and (baseline_cons or sf_check): df.at[person_id, 'ac_received_post_abortion_care'] = True @@ -2595,8 +2637,9 @@ def apply(self, person_id, squeeze_factor): # We define the required consumables and check their availability avail = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_preg_consumables, core='ectopic_pregnancy_core', - optional='ectopic_pregnancy_optional') + self.module, self, + cons=self.module.item_codes_preg_consumables['ectopic_pregnancy_core'], + opt_cons=self.module.item_codes_preg_consumables['ectopic_pregnancy_optional']) # If they are available then treatment can go ahead if avail: diff --git a/src/tlo/methods/labour.py b/src/tlo/methods/labour.py index 0f6d7d134e..2635a3b98b 100644 --- a/src/tlo/methods/labour.py +++ b/src/tlo/methods/labour.py @@ -681,174 +681,182 @@ def get_and_store_labour_item_codes(self): This function defines the required consumables for each intervention delivered during this module and stores them in a module level dictionary called within HSIs """ - get_item_code_from_pkg = self.sim.modules['HealthSystem'].get_item_codes_from_package_name - - get_list_of_items = pregnancy_helper_functions.get_list_of_items - - # ---------------------------------- IV DRUG ADMIN EQUIPMENT ------------------------------------------------- - self.item_codes_lab_consumables['iv_drug_equipment'] = \ - get_list_of_items(self, ['Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box']) + ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name # ---------------------------------- BLOOD TEST EQUIPMENT --------------------------------------------------- self.item_codes_lab_consumables['blood_test_equipment'] = \ - get_list_of_items(self, ['Blood collecting tube, 5 ml', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box']) + {ic('Blood collecting tube, 5 ml'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1 + } + # ---------------------------------- IV DRUG ADMIN EQUIPMENT ------------------------------------------------- + self.item_codes_lab_consumables['iv_drug_equipment'] = \ + {ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1 + } # ------------------------------------------ FULL BLOOD COUNT ------------------------------------------------- - self.item_codes_lab_consumables['full_blood_count'] = get_list_of_items(self, ['Complete blood count']) + self.item_codes_lab_consumables['full_blood_count'] = {ic('Complete blood count'): 1} # -------------------------------------------- DELIVERY ------------------------------------------------------ # assuming CDK has blade, soap, cord tie self.item_codes_lab_consumables['delivery_core'] = \ - get_list_of_items(self, ['Clean delivery kit', - 'Chlorhexidine 1.5% solution_5_CMST']) + {ic('Clean delivery kit'): 1, + ic('Chlorhexidine 1.5% solution_5_CMST'): 1, # todo: dose + } self.item_codes_lab_consumables['delivery_optional'] = \ - get_list_of_items(self, ['Cannula iv (winged with injection pot) 18_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box', - 'Gauze, absorbent 90cm x 40m_each_CMST', - 'Paracetamol, tablet, 500 mg']) + {ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Paracetamol, tablet, 500 mg'): 8000 + } # -------------------------------------------- CAESAREAN DELIVERY ------------------------------------------ self.item_codes_lab_consumables['caesarean_delivery_core'] = \ - get_list_of_items(self, ['Halothane (fluothane)_250ml_CMST', - 'Ceftriaxone 1g, PFR_each_CMST', - 'Metronidazole 200mg_1000_CMST']) + {ic('Halothane (fluothane)_250ml_CMST'): 1, # todo: dose + ic('Ceftriaxone 1g, PFR_each_CMST'): 1, # todo: dose + ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose + } self.item_codes_lab_consumables['caesarean_delivery_optional'] = \ - get_list_of_items(self, ['Scalpel blade size 22 (individually wrapped)_100_CMST', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Paracetamol, tablet, 500 mg', - 'Declofenac injection_each_CMST', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Foley catheter', - 'Bag, urine, collecting, 2000 ml', - "ringer's lactate (Hartmann's solution), 1000 ml_12_IDA", - 'Sodium chloride, injectable solution, 0,9 %, 500 ml', - "Giving set iv administration + needle 15 drops/ml_each_CMST", - "Chlorhexidine 1.5% solution_5_CMST"]) + {ic('Scalpel blade size 22 (individually wrapped)_100_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + ic('Paracetamol, tablet, 500 mg'): 8000, + ic('Declofenac injection_each_CMST'): 1, # todo: dose + ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, + } # -------------------------------------------- OBSTETRIC SURGERY ---------------------------------------------- self.item_codes_lab_consumables['obstetric_surgery_core'] = \ - get_list_of_items(self, ['Halothane (fluothane)_250ml_CMST', - 'Ceftriaxone 1g, PFR_each_CMST', - 'Metronidazole 200mg_1000_CMST']) + {ic('Halothane (fluothane)_250ml_CMST'): 1, # todo: dose + ic('Ceftriaxone 1g, PFR_each_CMST'): 1, # todo: dose + ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose + } self.item_codes_lab_consumables['obstetric_surgery_optional'] = \ - get_list_of_items(self, ['Scalpel blade size 22 (individually wrapped)_100_CMST', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Paracetamol, tablet, 500 mg', - 'Declofenac injection_each_CMST', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Foley catheter', - 'Bag, urine, collecting, 2000 ml', - "ringer's lactate (Hartmann's solution), 1000 ml_12_IDA", - 'Sodium chloride, injectable solution, 0,9 %, 500 ml', - "Giving set iv administration + needle 15 drops/ml_each_CMST"]) + {ic('Scalpel blade size 22 (individually wrapped)_100_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + ic('Paracetamol, tablet, 500 mg'): 8000, + ic('Declofenac injection_each_CMST'): 1, # todo: dose + ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, + } # -------------------------------------------- ABX FOR PROM ------------------------------------------------- self.item_codes_lab_consumables['abx_for_prom'] = \ - get_list_of_items(self, ['Benzathine benzylpenicillin, powder for injection, 2.4 million IU']) + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 1} # todo: dose # -------------------------------------------- ANTENATAL STEROIDS --------------------------------------------- + self.item_codes_lab_consumables['antenatal_steroids'] = \ - get_list_of_items(self, ['Dexamethasone 5mg/ml, 5ml_each_CMST']) + {ic('Dexamethasone 5mg/ml, 5ml_each_CMST'): 1} # todo: dose # ------------------------------------- INTRAVENOUS ANTIHYPERTENSIVES --------------------------------------- self.item_codes_lab_consumables['iv_antihypertensives'] = \ - get_list_of_items(self, ['Hydralazine, powder for injection, 20 mg ampoule']) + {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} # todo: dose # --------------------------------------- ORAL ANTIHYPERTENSIVES --------------------------------------------- self.item_codes_lab_consumables['oral_antihypertensives'] = \ - get_list_of_items(self, ['Methyldopa 250mg_1000_CMST']) + {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} # todo: dose # ---------------------------------- SEVERE PRE-ECLAMPSIA/ECLAMPSIA ----------------------------------------- self.item_codes_lab_consumables['magnesium_sulfate'] = \ - get_list_of_items(self, ['Magnesium sulfate, injection, 500 mg/ml in 10-ml ampoule']) + {ic('Magnesium sulfate, injection, 500 mg/ml in 10-ml ampoule'): 2} self.item_codes_lab_consumables['eclampsia_management_optional'] = \ - get_list_of_items(self, ['Misoprostol, tablet, 200 mcg', - 'Oxytocin, injection, 10 IU in 1 ml ampoule', - 'Sodium chloride, injectable solution, 0,9 %, 500 ml', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box', - 'Oxygen, 1000 liters, primarily with oxygen cylinders', - 'Complete blood count', - 'Foley catheter', - 'Bag, urine, collecting, 2000 ml']) - + {ic('Misoprostol, tablet, 200 mcg'): 1, # todo: dose + ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1, # todo: dose + ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + ic('Complete blood count'): 1, + ic('Blood collecting tube, 5 ml'): 1, + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + } # ------------------------------------- OBSTRUCTED LABOUR --------------------------------------------------- self.item_codes_lab_consumables['obstructed_labour'] = \ - get_list_of_items(self, ['Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml', - 'Benzylpenicillin 3g (5MU), PFR_each_CMST', - 'Gentamycin, injection, 40 mg/ml in 2 ml vial', - 'Sodium chloride, injectable solution, 0,9 %, 500 ml', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box', - 'Complete blood count', - 'Foley catheter', - 'Bag, urine, collecting, 2000 ml', - 'Paracetamol, tablet, 500 mg', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Gauze, absorbent 90cm x 40m_each_CMST', - 'Suture pack']) - + {ic('Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml'): 1, # todo: dose + ic('Benzylpenicillin 3g (5MU), PFR_each_CMST'): 1, # todo: dose + ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 1, # todo: dose + ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Complete blood count'): 1, + ic('Blood collecting tube, 5 ml'): 1, + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + ic('Paracetamol, tablet, 500 mg'): 8000, + ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, # todo: dose + ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + ic('Suture pack'): 1, + } # ------------------------------------- OBSTETRIC VACUUM --------------------------------------------------- - self.item_codes_lab_consumables['vacuum'] = get_list_of_items(self, ['Vacuum, obstetric']) + self.item_codes_lab_consumables['vacuum'] = {ic('Vacuum, obstetric'): 1} # ------------------------------------- MATERNAL SEPSIS ----------------------------------------------------- self.item_codes_lab_consumables['maternal_sepsis_core'] = \ - get_list_of_items(self, ['Benzylpenicillin 3g (5MU), PFR_each_CMST', - 'Gentamycin, injection, 40 mg/ml in 2 ml vial']) - # 'Metronidazole, injection, 500 mg in 100 ml vial']) + {ic('Benzylpenicillin 3g (5MU), PFR_each_CMST'): 1, # todo: dose + ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 1, # todo: dose + } self.item_codes_lab_consumables['maternal_sepsis_optional'] = \ - get_list_of_items(self, ['Cannula iv (winged with injection pot) 18_each_CMST', - 'Oxygen, 1000 liters, primarily with oxygen cylinders', - 'Paracetamol, tablet, 500 mg', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Foley catheter', - 'Bag, urine, collecting, 2000 ml', - 'Disposables gloves, powder free, 100 pieces per box', - 'Complete blood count']) - + {ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + ic('Paracetamol, tablet, 500 mg'): 8000, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Complete blood count'): 1, + } # ------------------------------------- ACTIVE MANAGEMENT THIRD STAGE --------------------------------------- - self.item_codes_lab_consumables['amtsl'] = \ - get_list_of_items(self, ['Oxytocin, injection, 10 IU in 1 ml ampoule']) + self.item_codes_lab_consumables['amtsl'] = {ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1} # todo: dose # ------------------------------------- POSTPARTUM HAEMORRHAGE --------------------------------------- self.item_codes_lab_consumables['pph_core'] = \ - get_list_of_items(self, ['Oxytocin, injection, 10 IU in 1 ml ampoule']) + {ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1} # todo: dose self.item_codes_lab_consumables['pph_optional'] = \ - get_list_of_items(self, ['Misoprostol, tablet, 200 mcg', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Oxygen, 1000 liters, primarily with oxygen cylinders', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Bag, urine, collecting, 2000 ml', - 'Foley catheter', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box', - 'Complete blood count']) + {ic('Misoprostol, tablet, 200 mcg'): 1, # todo: dose + ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, # todo: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1, + ic('Complete blood count'): 1, + } # ------------------------------------- BLOOD TRANSFUSION --------------------------------------- - self.item_codes_lab_consumables['blood_transfusion'] = get_list_of_items(self, ['Blood, one unit']) + self.item_codes_lab_consumables['blood_transfusion'] = {ic('Blood, one unit'): 2} # ------------------------------------------ FULL BLOOD COUNT ------------------------------------------------- - self.item_codes_lab_consumables['hb_test'] = get_list_of_items(self, ['Haemoglobin test (HB)']) + self.item_codes_lab_consumables['hb_test'] = {ic('Haemoglobin test (HB)'): 1} # ---------------------------------- IRON AND FOLIC ACID ------------------------------------------------------ + # Dose changes at run time self.item_codes_lab_consumables['iron_folic_acid'] = \ - get_item_code_from_pkg('Ferrous Salt + Folic Acid, tablet, 200 + 0.25 mg') + {ic('Ferrous Salt + Folic Acid, tablet, 200 + 0.25 mg'): 1} # -------------------------------------------- RESUSCITATION ------------------------------------------ - self.item_codes_lab_consumables['resuscitation'] = \ - get_list_of_items(self, ['Infant resuscitator, clear plastic + mask + bag_each_CMST']) + self.item_codes_lab_consumables['resuscitation'] =\ + {ic('Infant resuscitator, clear plastic + mask + bag_each_CMST'): 1} def initialise_simulation(self, sim): # Update self.current_parameters @@ -1658,7 +1666,9 @@ def prophylactic_labour_interventions(self, hsi_event): # If she has not already receive antibiotics, we check for consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='abx_for_prom', optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_lab_consumables['abx_for_prom'], + opt_cons=self.item_codes_lab_consumables['iv_drug_equipment']) # Then query if these consumables are available during this HSI And provide if available. # Antibiotics for from reduce risk of newborn sepsis within the first @@ -1672,8 +1682,9 @@ def prophylactic_labour_interventions(self, hsi_event): mni[person_id]['labour_state'] == 'late_preterm_labour': avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='antenatal_steroids', - optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_lab_consumables['antenatal_steroids'], + opt_cons=self.item_codes_lab_consumables['iv_drug_equipment']) # If available they are given. Antenatal steroids reduce a preterm newborns chance of developing # respiratory distress syndrome and of death associated with prematurity @@ -1735,8 +1746,9 @@ def assessment_and_treatment_of_severe_pre_eclampsia_mgso4(self, hsi_event, labo # Define and check for the required consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='magnesium_sulfate', - optional='eclampsia_management_optional') + self, hsi_event, + cons=self.item_codes_lab_consumables['magnesium_sulfate'], + opt_cons=self.item_codes_lab_consumables['eclampsia_management_optional']) # If the consumables are available - the intervention is delivered. IV magnesium reduces the # probability that a woman with severe pre-eclampsia will experience eclampsia in labour @@ -1764,8 +1776,9 @@ def assessment_and_treatment_of_hypertension(self, hsi_event, labour_stage): # Then query if these consumables are available during this HSI avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='iv_antihypertensives', - optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_lab_consumables['iv_antihypertensives'], + opt_cons=self.item_codes_lab_consumables['iv_drug_equipment']) # If they are available then the woman is started on treatment. Intravenous antihypertensive reduce a # womans risk of progression from mild to severe gestational hypertension ANd reduce risk of death for @@ -1811,8 +1824,9 @@ def assessment_and_treatment_of_eclampsia(self, hsi_event, labour_stage): # define and check required consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='magnesium_sulfate', - optional='eclampsia_management_optional') + self, hsi_event, + cons=self.item_codes_lab_consumables['magnesium_sulfate'], + opt_cons=self.item_codes_lab_consumables['eclampsia_management_optional']) if (labour_stage == 'ip') and (df.at[person_id, 'ac_admitted_for_immediate_delivery'] == 'none'): self.determine_delivery_mode_in_spe_or_ec(person_id, hsi_event, 'ec') @@ -1858,8 +1872,9 @@ def refer_for_cs(): # If the general package is available AND the facility has the correct tools to carry out the # delivery then it can occur avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='vacuum', - optional='obstructed_labour') + self, hsi_event, + cons=self.item_codes_lab_consumables['vacuum'], + opt_cons=self.item_codes_lab_consumables['obstructed_labour']) # run HCW check sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self, sf='avd', @@ -1911,8 +1926,9 @@ def assessment_and_treatment_of_maternal_sepsis(self, hsi_event, labour_stage): # Define and check available consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='maternal_sepsis_core', - optional='maternal_sepsis_optional') + self, hsi_event, + cons=self.item_codes_lab_consumables['maternal_sepsis_core'], + opt_cons=self.item_codes_lab_consumables['maternal_sepsis_optional']) # If delivered this intervention reduces a womans risk of dying from sepsis if avail and sf_check: @@ -1990,7 +2006,9 @@ def active_management_of_the_third_stage_of_labour(self, hsi_event): # Define and check available consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='amtsl', optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_lab_consumables['amtsl'], + opt_cons=self.item_codes_lab_consumables['iv_drug_equipment']) # run HCW check sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self, sf='uterotonic', @@ -2021,7 +2039,9 @@ def assessment_and_treatment_of_pph_uterine_atony(self, hsi_event): # Define and check available consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='pph_core', optional='pph_optional') + self, hsi_event, + cons=self.item_codes_lab_consumables['pph_core'], + opt_cons=self.item_codes_lab_consumables['pph_optional']) # run HCW check sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self, sf='uterotonic', @@ -2104,8 +2124,9 @@ def surgical_management_of_pph(self, hsi_event): # We log the required consumables and condition the surgery happening on the availability of the # first consumable in this package, the anaesthetic required for the surgery avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='obstetric_surgery_core', - optional='obstetric_surgery_optional') + self, hsi_event, + cons=self.item_codes_lab_consumables['obstetric_surgery_core'], + opt_cons=self.item_codes_lab_consumables['obstetric_surgery_optional']) # run HCW check sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self, sf='surg', @@ -2140,8 +2161,9 @@ def blood_transfusion(self, hsi_event): # Check consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_lab_consumables, core='blood_transfusion', number=2, - optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_lab_consumables['blood_transfusion'], + opt_cons=self.item_codes_lab_consumables['iv_drug_equipment']) # check HCW sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self, sf='blood_tran', @@ -2865,8 +2887,9 @@ def apply(self, person_id, squeeze_factor): # LOG CONSUMABLES FOR DELIVERY... # We assume all deliveries require this basic package of consumables avail = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_lab_consumables, core='delivery_core', - optional='delivery_optional') + self.module, self, + cons=self.module.item_codes_lab_consumables['delivery_core'], + opt_cons=self.module.item_codes_lab_consumables['delivery_optional']) # If the clean delivery kit consumable is available, we assume women benefit from clean delivery if avail: @@ -2942,7 +2965,7 @@ def apply(self, person_id, squeeze_factor): # TODO: potential issue is that this consumable is being logged now for every birth as opposed to # for each birth where resuscitation of the newborn is required avail = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_lab_consumables, core='resuscitation') + self.module, self, cons=self.module.item_codes_lab_consumables['resuscitation'], opt_cons=None) # Run HCW check sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self.module, @@ -3161,8 +3184,9 @@ def apply(self, person_id, squeeze_factor): # We log the required consumables and condition the caesarean happening on the availability of the # first consumable in this package, the anaesthetic required for the surgery avail = pregnancy_helper_functions.return_cons_avail( - self.module, self, self.module.item_codes_lab_consumables, core='caesarean_delivery_core', - optional='caesarean_delivery_optional') + self.module, self, + cons=self.module.item_codes_lab_consumables['caesarean_delivery_core'], + opt_cons=self.module.item_codes_lab_consumables['caesarean_delivery_optional']) # We check that the HCW will deliver the intervention sf_check = pregnancy_helper_functions.check_emonc_signal_function_will_run(self.module, sf='surg', diff --git a/src/tlo/methods/newborn_outcomes.py b/src/tlo/methods/newborn_outcomes.py index 513b644746..f6fb49650e 100644 --- a/src/tlo/methods/newborn_outcomes.py +++ b/src/tlo/methods/newborn_outcomes.py @@ -377,43 +377,51 @@ def get_and_store_newborn_item_codes(self): This function defines the required consumables for each intervention delivered during this module and stores them in a module level dictionary called within HSIs """ - get_list_of_items = pregnancy_helper_functions.get_list_of_items - - # ---------------------------------- IV DRUG ADMIN EQUIPMENT ------------------------------------------------- - self.item_codes_nb_consumables['iv_drug_equipment'] = \ - get_list_of_items(self, ['Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box']) + ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name + # First we store the item codes for the consumables for which their quantity varies for individuals based on + # length of pregnancy # ---------------------------------- BLOOD TEST EQUIPMENT --------------------------------------------------- self.item_codes_nb_consumables['blood_test_equipment'] = \ - get_list_of_items(self, ['Disposables gloves, powder free, 100 pieces per box']) + {ic('Blood collecting tube, 5 ml'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1 + } + # ---------------------------------- IV DRUG ADMIN EQUIPMENT ------------------------------------------------- + self.item_codes_nb_consumables['iv_drug_equipment'] = \ + {ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1 + } # -------------------------------------------- VITAMIN K ------------------------------------------ self.item_codes_nb_consumables['vitamin_k'] = \ - get_list_of_items(self, ['vitamin K1 (phytomenadione) 1 mg/ml, 1 ml, inj._100_IDA']) + {ic('vitamin K1 (phytomenadione) 1 mg/ml, 1 ml, inj._100_IDA'): 1} # todo: dose # -------------------------------------------- EYE CARE ------------------------------------------ - self.item_codes_nb_consumables['eye_care'] = get_list_of_items( - self, ['Tetracycline eye ointment, 1 %, tube 5 mg']) + self.item_codes_nb_consumables['eye_care'] = \ + {ic('Tetracycline eye ointment, 1 %, tube 5 mg'): 1} # todo: dose # ------------------------------------- SEPSIS - FULL SUPPORTIVE CARE --------------------------------------- self.item_codes_nb_consumables['sepsis_supportive_care_core'] = \ - get_list_of_items(self, ['Benzylpenicillin 1g (1MU), PFR_Each_CMST', - 'Gentamicin 40mg/ml, 2ml_each_CMST', - 'Oxygen, 1000 liters, primarily with oxygen cylinders']) + {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, # todo: dose + ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, # todo: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1 # todo: dose + } self.item_codes_nb_consumables['sepsis_supportive_care_optional'] = \ - get_list_of_items(self, ['Dextrose (glucose) 5%, 1000ml_each_CMST', - 'Tube, feeding CH 8_each_CMST', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box']) + {ic('Dextrose (glucose) 5%, 1000ml_each_CMST'): 500, + ic('Tube, feeding CH 8_each_CMST'): 1, + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Disposables gloves, powder free, 100 pieces per box'): 1 + } # ---------------------------------------- SEPSIS - ANTIBIOTICS --------------------------------------------- - self.item_codes_nb_consumables['sepsis_abx'] =\ - get_list_of_items(self, ['Benzylpenicillin 1g (1MU), PFR_Each_CMST', - 'Gentamicin 40mg/ml, 2ml_each_CMST']) + self.item_codes_nb_consumables['sepsis_abx'] = \ + {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, # todo: dose + ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, # todo: dose + } def initialise_simulation(self, sim): # For the first period (2010-2015) we use the first value in each list as a parameter @@ -969,8 +977,9 @@ def assessment_and_treatment_newborn_sepsis(self, hsi_event, facility_type): # check consumables avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_nb_consumables, core='sepsis_supportive_care_core', - optional='sepsis_supportive_care_optional') + self, hsi_event, + cons=self.item_codes_nb_consumables['sepsis_supportive_care_core'], + opt_cons=self.item_codes_nb_consumables['sepsis_supportive_care_optional']) # Then, if the consumables are available, treatment for sepsis is delivered if avail and sf_check: @@ -980,8 +989,9 @@ def assessment_and_treatment_newborn_sepsis(self, hsi_event, facility_type): # The same pattern is then followed for health centre care else: avail = pregnancy_helper_functions.return_cons_avail( - self, hsi_event, self.item_codes_nb_consumables, core='sepsis_abx', - optional='iv_drug_equipment') + self, hsi_event, + cons=self.item_codes_nb_consumables['sepsis_abx'], + opt_cons=self.item_codes_nb_consumables['iv_drug_equipment']) if avail and sf_check: df.at[person_id, 'nb_inj_abx_neonatal_sepsis'] = True diff --git a/src/tlo/methods/postnatal_supervisor.py b/src/tlo/methods/postnatal_supervisor.py index 0d16a2d7ac..6303763b3d 100644 --- a/src/tlo/methods/postnatal_supervisor.py +++ b/src/tlo/methods/postnatal_supervisor.py @@ -1274,21 +1274,23 @@ def apply(self, person_id, squeeze_factor): return # Define the consumables - of_repair_cons = pregnancy_helper_functions.get_list_of_items( - self, ['Scalpel blade size 22 (individually wrapped)_100_CMST', - 'Halothane (fluothane)_250ml_CMST', - 'Ceftriaxone 1g, PFR_each_CMST', - 'Metronidazole 200mg_1000_CMST', - 'Cannula iv (winged with injection pot) 18_each_CMST', - 'Paracetamol, tablet, 500 mg', - 'Declofenac injection_each_CMST', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Foley catheter', - 'Bag, urine, collecting, 2000 ml', - "ringer's lactate (Hartmann's solution), 1000 ml_12_IDA", - 'Sodium chloride, injectable solution, 0,9 %, 500 ml', - "Giving set iv administration + needle 15 drops/ml_each_CMST", - "Chlorhexidine 1.5% solution_5_CMST"]) + ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name + + of_repair_cons = \ + {ic('Scalpel blade size 22 (individually wrapped)_100_CMS'): 1, + ic('Halothane (fluothane)_250ml_CMST'): 1, # todo: dose + ic('Ceftriaxone 1g, PFR_each_CMST'): 1, # todo: dose + ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose + ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, + ic('Paracetamol, tablet, 500 mg'): 8000, + ic('Declofenac injection_each_CMST'): 1, # todo: dose + ic('Foley catheter'): 1, + ic('Bag, urine, collecting, 2000 ml'): 1, + ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, + ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic('Chlorhexidine 1.5% solution_5_CMST'): 1, # todo: dose + } self.get_consumables(item_codes=of_repair_cons) diff --git a/src/tlo/methods/pregnancy_helper_functions.py b/src/tlo/methods/pregnancy_helper_functions.py index 20a712f134..8f7faa0503 100644 --- a/src/tlo/methods/pregnancy_helper_functions.py +++ b/src/tlo/methods/pregnancy_helper_functions.py @@ -21,7 +21,7 @@ def get_list_of_items(self, item_list): return codes -def return_cons_avail(self, hsi_event, cons_dict, **info): +def return_cons_avail(self, hsi_event, cons, opt_cons): """ This function is called by majority of interventions across maternal and neonatal modules to return whether a consumable or package of consumables are available. If analysis is not being conducted (as indicated by a series of @@ -38,21 +38,12 @@ def return_cons_avail(self, hsi_event, cons_dict, **info): ps_params = self.sim.modules['PregnancySupervisor'].current_parameters la_params = self.sim.modules['Labour'].current_parameters - # If 'number' is passed as an optional argument then a predetermined number of consumables will be requested - if 'number' in info.keys(): - core_cons = {cons_dict[info['core']][0]: info['number']} - else: - core_cons = cons_dict[info['core']] - - # If 'optional' is passed then the optional set of consumables is selected from the consumables dict - if 'optional' in info.keys(): - opt_cons = cons_dict[info['optional']] - else: + if opt_cons is None: opt_cons = [] # Check if analysis is currently running, if not then availability is determined normally if not ps_params['ps_analysis_in_progress'] and not la_params['la_analysis_in_progress']: - available = hsi_event.get_consumables(item_codes=core_cons, + available = hsi_event.get_consumables(item_codes=cons, optional_item_codes=opt_cons) if not available and (hsi_event.target in mni) and (hsi_event != 'AntenatalCare_Outpatient'): @@ -61,7 +52,7 @@ def return_cons_avail(self, hsi_event, cons_dict, **info): return available else: - available = hsi_event.get_consumables(item_codes=core_cons, optional_item_codes=opt_cons) + available = hsi_event.get_consumables(item_codes=cons, optional_item_codes=opt_cons) # Depending on HSI calling this function a different parameter set is used to determine if analysis is being # conducted From 0126a6bd1cf634bfc7627aeb1f9043170c70f308 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Fri, 5 Apr 2024 15:23:26 +0100 Subject: [PATCH 13/59] fixes to failing tests --- src/tlo/methods/care_of_women_during_pregnancy.py | 4 ++-- .../test_maternal_health_helper_and_analysis_functions.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tlo/methods/care_of_women_during_pregnancy.py b/src/tlo/methods/care_of_women_during_pregnancy.py index b30b191066..124e8e6d2a 100644 --- a/src/tlo/methods/care_of_women_during_pregnancy.py +++ b/src/tlo/methods/care_of_women_during_pregnancy.py @@ -2481,7 +2481,7 @@ def schedule_gdm_event_and_checkup(): days = est_length_preg * 10 updated_cons = {k: v * days for (k, v) in - self.item_codes_preg_consumables['oral_diabetic_treatment'].items()} + self.module.item_codes_preg_consumables['oral_diabetic_treatment'].items()} avail = pregnancy_helper_functions.return_cons_avail( self.module, self, cons=updated_cons, opt_cons=None) @@ -2505,7 +2505,7 @@ def schedule_gdm_event_and_checkup(): required_vials = np.ceil(required_units_per_preg/1000) updated_cons = {k: v * required_vials for (k, v) in - self.item_codes_preg_consumables['insulin_treatment'].items()} + self.module.item_codes_preg_consumables['insulin_treatment'].items()} avail = pregnancy_helper_functions.return_cons_avail( self.module, self, cons=updated_cons, opt_cons=None) diff --git a/tests/test_maternal_health_helper_and_analysis_functions.py b/tests/test_maternal_health_helper_and_analysis_functions.py index 4c55c3a366..eb45d69775 100644 --- a/tests/test_maternal_health_helper_and_analysis_functions.py +++ b/tests/test_maternal_health_helper_and_analysis_functions.py @@ -252,15 +252,16 @@ def test_analysis_events_force_availability_of_consumables_when_scheduled_in_anc # Override the availability of the consumables within the health system- set to 0. If analysis was not running no # interventions requiring these consumable would run module = sim.modules['CareOfWomenDuringPregnancy'] + iron = module.item_codes_preg_consumables['iron_folic_acid'] protein = module.item_codes_preg_consumables['balanced_energy_protein'] calcium = module.item_codes_preg_consumables['calcium'] syph_test = module.item_codes_preg_consumables['syphilis_test'] syph_treat = module.item_codes_preg_consumables['syphilis_treatment'] - for cons in iron, protein, calcium, syph_test, syph_treat: - sim.modules['HealthSystem'].override_availability_of_consumables( - {cons[0]: 0.0}) + for cons in 'iron_folic_acid', 'balanced_energy_protein', 'calcium', 'syphilis_test', 'syphilis_treatment': + updated_cons = {k: v * 0 for (k, v) in module.item_codes_preg_consumables[cons].items()} + sim.modules['HealthSystem'].override_availability_of_consumables(updated_cons) # refresh the consumables sim.modules['HealthSystem'].consumables._refresh_availability_of_consumables(date=sim.date) From ebd94959ec2a00e46c42ce6300f83053fe5c00aa Mon Sep 17 00:00:00 2001 From: joehcollins Date: Fri, 5 Apr 2024 15:49:53 +0100 Subject: [PATCH 14/59] linting --- src/tlo/methods/care_of_women_during_pregnancy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tlo/methods/care_of_women_during_pregnancy.py b/src/tlo/methods/care_of_women_during_pregnancy.py index 124e8e6d2a..94ab6d7e49 100644 --- a/src/tlo/methods/care_of_women_during_pregnancy.py +++ b/src/tlo/methods/care_of_women_during_pregnancy.py @@ -1,7 +1,8 @@ from pathlib import Path -import pandas as pd import numpy as np +import pandas as pd + from tlo import DateOffset, Module, Parameter, Property, Types, logging from tlo.events import IndividualScopeEventMixin, PopulationScopeEventMixin, RegularEvent From ccdab822e68b11937eb75db721280380a120023a Mon Sep 17 00:00:00 2001 From: joehcollins Date: Fri, 5 Apr 2024 15:52:31 +0100 Subject: [PATCH 15/59] linting --- src/tlo/methods/care_of_women_during_pregnancy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tlo/methods/care_of_women_during_pregnancy.py b/src/tlo/methods/care_of_women_during_pregnancy.py index 94ab6d7e49..d4eaee9bd1 100644 --- a/src/tlo/methods/care_of_women_during_pregnancy.py +++ b/src/tlo/methods/care_of_women_during_pregnancy.py @@ -3,7 +3,6 @@ import numpy as np import pandas as pd - from tlo import DateOffset, Module, Parameter, Property, Types, logging from tlo.events import IndividualScopeEventMixin, PopulationScopeEventMixin, RegularEvent from tlo.methods import Metadata, pregnancy_helper_functions From ef2d344afe503027808906acdd38f40e230b477c Mon Sep 17 00:00:00 2001 From: tdm32 Date: Wed, 10 Apr 2024 09:17:48 +0100 Subject: [PATCH 16/59] change cotrimoxazole units to mg --- resources/costing/~$ResourceFile_Costing.xlsx | 3 +++ src/tlo/methods/hiv.py | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 resources/costing/~$ResourceFile_Costing.xlsx diff --git a/resources/costing/~$ResourceFile_Costing.xlsx b/resources/costing/~$ResourceFile_Costing.xlsx new file mode 100644 index 0000000000..d5d6d83ccc --- /dev/null +++ b/resources/costing/~$ResourceFile_Costing.xlsx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:019349b15c524cfef4b39db4dd792de3376f4bc3da9b6b298a1fee07c4eb219e +size 165 diff --git a/src/tlo/methods/hiv.py b/src/tlo/methods/hiv.py index 7377b93f51..e734892d2c 100644 --- a/src/tlo/methods/hiv.py +++ b/src/tlo/methods/hiv.py @@ -968,7 +968,7 @@ def initialise_simulation(self, sim): # First - line ART for adults(age > "ART_age_cutoff_older_child") # TDF/3TC/DTG 120/60/50mg, 1 tablet per day - # cotrim adult tablet, 1 tablet per day + # cotrim adult tablet, 1 tablet per day, units specified in mg * dispensation days self.item_codes_for_consumables_required['First-line ART regimen: adult'] = \ hs.get_item_code_from_item_name("First-line ART regimen: adult") self.item_codes_for_consumables_required['First-line ART regimen: adult: cotrimoxazole'] = \ @@ -976,7 +976,7 @@ def initialise_simulation(self, sim): # ART for older children aged ("ART_age_cutoff_younger_child" < age <= "ART_age_cutoff_older_child"): # ABC/3TC/DTG 120/60/50mg, 3 tablets per day - # cotrim paediatric tablet, 4 tablets per day + # cotrim paediatric tablet, 4 tablets per day, units specified in mg * dispensation days self.item_codes_for_consumables_required['First line ART regimen: older child'] = \ hs.get_item_code_from_item_name("First line ART regimen: older child") self.item_codes_for_consumables_required['First line ART regimen: older child: cotrimoxazole'] = \ @@ -984,7 +984,7 @@ def initialise_simulation(self, sim): # ART for younger children aged (age < "ART_age_cutoff_younger_child"): # ABC/3TC/DTG 120/60/10mg, 2 tablets per day - # cotrim paediatric tablet, 2 tablets per day + # cotrim paediatric tablet, 2 tablets per day, units specified in mg * dispensation days self.item_codes_for_consumables_required['First line ART regimen: young child'] = \ hs.get_item_code_from_item_name("First line ART regimen: young child") self.item_codes_for_consumables_required['First line ART regimen: young child: cotrimoxazole'] = \ @@ -2643,7 +2643,7 @@ def get_drugs(self, age_of_person): item_codes={self.module.item_codes_for_consumables_required[ 'First line ART regimen: young child']: dispensation_days * 2}, optional_item_codes={self.module.item_codes_for_consumables_required[ - 'First line ART regimen: young child: cotrimoxazole']: dispensation_days * 2}, + 'First line ART regimen: young child: cotrimoxazole']: dispensation_days * 240}, return_individual_results=True) elif age_of_person <= p["ART_age_cutoff_older_child"]: @@ -2652,7 +2652,7 @@ def get_drugs(self, age_of_person): item_codes={self.module.item_codes_for_consumables_required[ 'First line ART regimen: older child']: dispensation_days * 3}, optional_item_codes={self.module.item_codes_for_consumables_required[ - 'First line ART regimen: older child: cotrimoxazole']: dispensation_days * 4}, + 'First line ART regimen: older child: cotrimoxazole']: dispensation_days * 480}, return_individual_results=True) else: @@ -2661,7 +2661,7 @@ def get_drugs(self, age_of_person): item_codes={self.module.item_codes_for_consumables_required[ 'First-line ART regimen: adult']: dispensation_days}, optional_item_codes={self.module.item_codes_for_consumables_required[ - 'First-line ART regimen: adult: cotrimoxazole']: dispensation_days}, + 'First-line ART regimen: adult: cotrimoxazole']: dispensation_days * 960}, return_individual_results=True) # add drug names to dict From 2f11f243558b3cd8450fbf7796f6ad79cedc550e Mon Sep 17 00:00:00 2001 From: tdm32 Date: Wed, 10 Apr 2024 09:23:59 +0100 Subject: [PATCH 17/59] merge in updated unit costs 3hp added and linked to consumables dataset --- src/tlo/methods/tb.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tlo/methods/tb.py b/src/tlo/methods/tb.py index 59f360780f..9bf68d6a5e 100644 --- a/src/tlo/methods/tb.py +++ b/src/tlo/methods/tb.py @@ -769,7 +769,7 @@ def get_consumables_for_dx_and_tx(self): self.item_codes_for_consumables_required['tb_isoniazid'] = \ hs.get_item_code_from_item_name("Isoniazid/Pyridoxine, tablet 300 mg") - # todo not yet on consumables database + # 3hp self.item_codes_for_consumables_required['tb_3HP'] = { hs.get_item_code_from_item_name("Isoniazid/Rifapentine"): 1} @@ -2489,7 +2489,6 @@ def apply(self, person_id, squeeze_factor): item_codes={self.module.item_codes_for_consumables_required["tb_ipt"]: 180}) # for all others - # todo check 3HP listed in database else: # 12 weeks dispensation, once weekly drugs_available = self.get_consumables( From 48104b0e889bd7a122eadecec734f026b7a78c4b Mon Sep 17 00:00:00 2001 From: joehcollins Date: Thu, 11 Apr 2024 11:14:18 +0100 Subject: [PATCH 18/59] added dosage for amitriptyline antidepressant treatment --- src/tlo/methods/depression.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tlo/methods/depression.py b/src/tlo/methods/depression.py index 8f5fd9661c..7feb49921c 100644 --- a/src/tlo/methods/depression.py +++ b/src/tlo/methods/depression.py @@ -830,9 +830,10 @@ def apply(self, person_id, squeeze_factor): "receiving an HSI. " # Check availability of antidepressant medication - item_code = self.module.parameters['anti_depressant_medication_item_code'] + # Dose is 25mg daily, patient provided with month supply - 25mg x 30.437 (days) = 761mg per month + item_code_with_dose = {self.module.parameters['anti_depressant_medication_item_code']: 761} - if self.get_consumables(item_codes=item_code): + if self.get_consumables(item_codes=item_code_with_dose): # If medication is available, flag as being on antidepressants df.at[person_id, 'de_on_antidepr'] = True @@ -873,7 +874,10 @@ def apply(self, person_id, squeeze_factor): return self.sim.modules['HealthSystem'].get_blank_appt_footprint() # Check availability of antidepressant medication - if self.get_consumables(self.module.parameters['anti_depressant_medication_item_code']): + # Dose is 25mg daily, patient provided with month supply - 25mg x 30.437 (days) = 761mg per month + item_code_with_dose = {self.module.parameters['anti_depressant_medication_item_code']: 761} + + if self.get_consumables(item_codes=item_code_with_dose): # Schedule their next HSI for a refill of medication, one month from now self.sim.modules['HealthSystem'].schedule_hsi_event( hsi_event=HSI_Depression_Refill_Antidepressant(person_id=person_id, module=self.module), From c11b707a00f297a33504725a175e51497ca385fd Mon Sep 17 00:00:00 2001 From: joehcollins Date: Thu, 11 Apr 2024 12:01:21 +0100 Subject: [PATCH 19/59] added dosage for epilepsy treatment --- src/tlo/methods/epilepsy.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/tlo/methods/epilepsy.py b/src/tlo/methods/epilepsy.py index f06c62d098..aa11d313ed 100644 --- a/src/tlo/methods/epilepsy.py +++ b/src/tlo/methods/epilepsy.py @@ -600,7 +600,14 @@ def apply(self, person_id, squeeze_factor): if best_available_medicine is not None: # Request the medicine from the health system - self.get_consumables(self.module.item_codes[best_available_medicine]) + + dose = {'phenobarbitone': 9131, # 100mg per day - 3 months + 'carbamazepine': 91_311, # 1000mg per day - 3 months + 'phenytoin': 27_393} # 300mg per day - 3 months + + self.get_consumables({self.module.item_codes[best_available_medicine]: + dose[best_available_medicine]}) + # Update this person's properties to show that they are currently on medication df.at[person_id, 'ep_antiep'] = True @@ -651,18 +658,30 @@ def apply(self, person_id, squeeze_factor): # Request the medicine best_available_medicine = self.module.get_best_available_medicine(self) if best_available_medicine is not None: + + # Schedule a reoccurrence of this follow-up in 3 months if ep_seiz_stat == '3', + # else, schedule this reoccurrence of it in 1 year (i.e., if ep_seiz_stat == '2' + if df.at[person_id, 'ep_seiz_stat'] == '3': + fu_mnths = 3 + else: + fu_mnths = 12 + # The medicine is available, so request it - self.get_consumables(self.module.item_codes[best_available_medicine]) + dose = {'phenobarbitone_3_mnths': 9131, 'phenobarbitone_12_mnths': 36_525, # 100mg per day - 3/12 months + 'carbamazepine_3_mnths': 91_311, 'carbamazepine_12_mnths': 365_250, # 1000mg per day - 3/12 months + 'phenytoin_3_mnths': 27_393, 'phenytoin_12_mnths': 109_575} # 300mg per day - 3/12 months + + self.get_consumables({self.module.item_codes[best_available_medicine]: + dose[f'{best_available_medicine}_{fu_mnths}_mnths']}) # Reset counter of "failed attempts" and put the appointment for the next occurrence to the usual self._counter_of_failed_attempts_due_to_unavailable_medicines = 0 self.EXPECTED_APPT_FOOTPRINT = self._DEFAULT_APPT_FOOTPRINT - # Schedule a reoccurrence of this follow-up in 3 months if ep_seiz_stat == '3', - # else, schedule this reoccurrence of it in 1 year (i.e., if ep_seiz_stat == '2') + # Schedule follow-up hs.schedule_hsi_event( hsi_event=self, - topen=self.sim.date + DateOffset(months=3 if df.at[person_id, 'ep_seiz_stat'] == '3' else 12), + topen=self.sim.date + DateOffset(months=fu_mnths), tclose=None, priority=0 ) From 0ac40bb5c8ac82457d8fa31d2074498e76581530 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Thu, 11 Apr 2024 12:37:37 +0100 Subject: [PATCH 20/59] fix error in postnatal_supervisor.py leading to failing test --- src/tlo/methods/postnatal_supervisor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tlo/methods/postnatal_supervisor.py b/src/tlo/methods/postnatal_supervisor.py index 6303763b3d..df372c0054 100644 --- a/src/tlo/methods/postnatal_supervisor.py +++ b/src/tlo/methods/postnatal_supervisor.py @@ -1277,7 +1277,7 @@ def apply(self, person_id, squeeze_factor): ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name of_repair_cons = \ - {ic('Scalpel blade size 22 (individually wrapped)_100_CMS'): 1, + {ic('Scalpel blade size 22 (individually wrapped)_100_CMST'): 1, ic('Halothane (fluothane)_250ml_CMST'): 1, # todo: dose ic('Ceftriaxone 1g, PFR_each_CMST'): 1, # todo: dose ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose From 3535a583042c32af34e919fcd5e31f024e192d9b Mon Sep 17 00:00:00 2001 From: joehcollins Date: Thu, 11 Apr 2024 13:53:07 +0100 Subject: [PATCH 21/59] units added for care_of_women_during_pregnancy.py --- .../methods/care_of_women_during_pregnancy.py | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/tlo/methods/care_of_women_during_pregnancy.py b/src/tlo/methods/care_of_women_during_pregnancy.py index d4eaee9bd1..a39a1d7027 100644 --- a/src/tlo/methods/care_of_women_during_pregnancy.py +++ b/src/tlo/methods/care_of_women_during_pregnancy.py @@ -222,15 +222,15 @@ def get_and_store_pregnancy_item_codes(self): # -------------------------------------------- ECTOPIC PREGNANCY --------------------------------------------- self.item_codes_preg_consumables['ectopic_pregnancy_core'] = \ - {ic('Halothane (fluothane)_250ml_CMST'): 1} # TODO: dose + {ic('Halothane (fluothane)_250ml_CMST'): 100} self.item_codes_preg_consumables['ectopic_pregnancy_optional'] = \ {ic('Scalpel blade size 22 (individually wrapped)_100_CMST'): 1, ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, ic('Paracetamol, tablet, 500 mg'): 8000, - ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, # todo: dose + ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 6, ic('Suture pack'): 1, - ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + ic('Gauze, absorbent 90cm x 40m_each_CMST'): 30, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, ic('Disposables gloves, powder free, 100 pieces per box'): 1, @@ -238,13 +238,13 @@ def get_and_store_pregnancy_item_codes(self): # ------------------------------------------- POST ABORTION CARE - GENERAL ----------------------------------- self.item_codes_preg_consumables['post_abortion_care_core'] = \ - {ic('Misoprostol, tablet, 200 mcg'): 1} # TODO: dose + {ic('Misoprostol, tablet, 200 mcg'): 600} self.item_codes_preg_consumables['post_abortion_care_optional'] = \ {ic('Complete blood count'): 1, ic('Blood collecting tube, 5 ml'): 1, ic('Paracetamol, tablet, 500 mg'): 8000, - ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + ic('Gauze, absorbent 90cm x 40m_each_CMST'): 30, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, ic('Disposables gloves, powder free, 100 pieces per box'): 1, @@ -252,8 +252,8 @@ def get_and_store_pregnancy_item_codes(self): # ------------------------------------------- POST ABORTION CARE - SEPSIS ------------------------------------- self.item_codes_preg_consumables['post_abortion_care_sepsis_core'] = \ - {ic('Benzylpenicillin 3g (5MU), PFR_each_CMST'): 1, # TODO: dose - ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 1, # TODO: dose + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 8, + ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 6, } self.item_codes_preg_consumables['post_abortion_care_sepsis_optional'] = \ @@ -261,13 +261,13 @@ def get_and_store_pregnancy_item_codes(self): ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, ic('Disposables gloves, powder free, 100 pieces per box'): 1, - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # TODO: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 23_040, } # ------------------------------------------- POST ABORTION CARE - SHOCK ------------------------------------ self.item_codes_preg_consumables['post_abortion_care_shock'] = \ {ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # TODO: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 23_040, } self.item_codes_preg_consumables['post_abortion_care_shock_optional'] = \ @@ -308,7 +308,7 @@ def get_and_store_pregnancy_item_codes(self): # ------------------------------------------- SYPHILIS TREATMENT ---------------------------------------------- self.item_codes_preg_consumables['syphilis_treatment'] =\ - {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 1} + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 8} # ----------------------------------------------- GDM TEST ---------------------------------------------------- self.item_codes_preg_consumables['gdm_test'] = {ic('Blood glucose level test'): 1} @@ -333,13 +333,11 @@ def get_and_store_pregnancy_item_codes(self): # ---------------------------------------- MANAGEMENT OF ECLAMPSIA -------------------------------------------- self.item_codes_preg_consumables['eclampsia_management_optional'] = \ - {ic('Misoprostol, tablet, 200 mcg'): 1, # todo: dose - ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1, # todo: dose - ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + {ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, ic('Disposables gloves, powder free, 100 pieces per box'): 1, - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 23_040, ic('Complete blood count'): 1, ic('Blood collecting tube, 5 ml'): 1, ic('Foley catheter'): 1, @@ -348,7 +346,7 @@ def get_and_store_pregnancy_item_codes(self): # -------------------------------------- ANTIBIOTICS FOR PROM ------------------------------------------------ self.item_codes_preg_consumables['abx_for_prom'] = \ - {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 1} # todo: dose + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 8} # ----------------------------------- ORAL DIABETIC MANAGEMENT ----------------------------------------------- # Dose changes at run time From ff4e29a74f5187c722be6e9dc2d1cf8456a18876 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Thu, 11 Apr 2024 13:53:55 +0100 Subject: [PATCH 22/59] units added for care_of_women_during_pregnancy.py --- src/tlo/methods/care_of_women_during_pregnancy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tlo/methods/care_of_women_during_pregnancy.py b/src/tlo/methods/care_of_women_during_pregnancy.py index a39a1d7027..74b14e766a 100644 --- a/src/tlo/methods/care_of_women_during_pregnancy.py +++ b/src/tlo/methods/care_of_women_during_pregnancy.py @@ -308,7 +308,7 @@ def get_and_store_pregnancy_item_codes(self): # ------------------------------------------- SYPHILIS TREATMENT ---------------------------------------------- self.item_codes_preg_consumables['syphilis_treatment'] =\ - {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 8} + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 1} # ----------------------------------------------- GDM TEST ---------------------------------------------------- self.item_codes_preg_consumables['gdm_test'] = {ic('Blood glucose level test'): 1} From 26a7025668df8a68546f83ba7a33f4a590bbfb5d Mon Sep 17 00:00:00 2001 From: joehcollins Date: Thu, 11 Apr 2024 14:19:19 +0100 Subject: [PATCH 23/59] units added for labour.py --- src/tlo/methods/labour.py | 60 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/tlo/methods/labour.py b/src/tlo/methods/labour.py index 2635a3b98b..80ea2a6ebe 100644 --- a/src/tlo/methods/labour.py +++ b/src/tlo/methods/labour.py @@ -703,11 +703,11 @@ def get_and_store_labour_item_codes(self): # assuming CDK has blade, soap, cord tie self.item_codes_lab_consumables['delivery_core'] = \ {ic('Clean delivery kit'): 1, - ic('Chlorhexidine 1.5% solution_5_CMST'): 1, # todo: dose + ic('Chlorhexidine 1.5% solution_5_CMST'): 20, } self.item_codes_lab_consumables['delivery_optional'] = \ - {ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + {ic('Gauze, absorbent 90cm x 40m_each_CMST'): 30, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Disposables gloves, powder free, 100 pieces per box'): 1, ic('Paracetamol, tablet, 500 mg'): 8000 @@ -715,9 +715,9 @@ def get_and_store_labour_item_codes(self): # -------------------------------------------- CAESAREAN DELIVERY ------------------------------------------ self.item_codes_lab_consumables['caesarean_delivery_core'] = \ - {ic('Halothane (fluothane)_250ml_CMST'): 1, # todo: dose - ic('Ceftriaxone 1g, PFR_each_CMST'): 1, # todo: dose - ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose + {ic('Halothane (fluothane)_250ml_CMST'): 100, + ic('Ceftriaxone 1g, PFR_each_CMST'): 2, + ic('Metronidazole 200mg_1000_CMST'): 1, # todo: replace } self.item_codes_lab_consumables['caesarean_delivery_optional'] = \ @@ -729,15 +729,15 @@ def get_and_store_labour_item_codes(self): ic('Foley catheter'): 1, ic('Bag, urine, collecting, 2000 ml'): 1, ic('Paracetamol, tablet, 500 mg'): 8000, - ic('Declofenac injection_each_CMST'): 1, # todo: dose + ic('Declofenac injection_1_CMST'): 2, ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, } # -------------------------------------------- OBSTETRIC SURGERY ---------------------------------------------- self.item_codes_lab_consumables['obstetric_surgery_core'] = \ - {ic('Halothane (fluothane)_250ml_CMST'): 1, # todo: dose - ic('Ceftriaxone 1g, PFR_each_CMST'): 1, # todo: dose - ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose + {ic('Halothane (fluothane)_250ml_CMST'): 100, + ic('Ceftriaxone 1g, PFR_each_CMST'): 2, + ic('Metronidazole 200mg_1000_CMST'): 1, # todo: replace } self.item_codes_lab_consumables['obstetric_surgery_optional'] = \ @@ -749,39 +749,37 @@ def get_and_store_labour_item_codes(self): ic('Foley catheter'): 1, ic('Bag, urine, collecting, 2000 ml'): 1, ic('Paracetamol, tablet, 500 mg'): 8000, - ic('Declofenac injection_each_CMST'): 1, # todo: dose + ic('Declofenac injection_each_CMST'): 2, ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, } # -------------------------------------------- ABX FOR PROM ------------------------------------------------- self.item_codes_lab_consumables['abx_for_prom'] = \ - {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 1} # todo: dose + {ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 8} # -------------------------------------------- ANTENATAL STEROIDS --------------------------------------------- self.item_codes_lab_consumables['antenatal_steroids'] = \ - {ic('Dexamethasone 5mg/ml, 5ml_each_CMST'): 1} # todo: dose + {ic('Dexamethasone 5mg/ml, 5ml_each_CMST'): 12} # ------------------------------------- INTRAVENOUS ANTIHYPERTENSIVES --------------------------------------- self.item_codes_lab_consumables['iv_antihypertensives'] = \ - {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} # todo: dose + {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} # --------------------------------------- ORAL ANTIHYPERTENSIVES --------------------------------------------- self.item_codes_lab_consumables['oral_antihypertensives'] = \ - {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} # todo: dose + {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} # ---------------------------------- SEVERE PRE-ECLAMPSIA/ECLAMPSIA ----------------------------------------- self.item_codes_lab_consumables['magnesium_sulfate'] = \ {ic('Magnesium sulfate, injection, 500 mg/ml in 10-ml ampoule'): 2} self.item_codes_lab_consumables['eclampsia_management_optional'] = \ - {ic('Misoprostol, tablet, 200 mcg'): 1, # todo: dose - ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1, # todo: dose - ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, + {ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, ic('Disposables gloves, powder free, 100 pieces per box'): 1, - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 23_040, ic('Complete blood count'): 1, ic('Blood collecting tube, 5 ml'): 1, ic('Foley catheter'): 1, @@ -789,9 +787,9 @@ def get_and_store_labour_item_codes(self): } # ------------------------------------- OBSTRUCTED LABOUR --------------------------------------------------- self.item_codes_lab_consumables['obstructed_labour'] = \ - {ic('Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml'): 1, # todo: dose - ic('Benzylpenicillin 3g (5MU), PFR_each_CMST'): 1, # todo: dose - ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 1, # todo: dose + {ic('Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml'): 1, + ic('Benzathine benzylpenicillin, powder for injection, 2.4 million IU'): 8, + ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 6, ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, @@ -801,8 +799,8 @@ def get_and_store_labour_item_codes(self): ic('Foley catheter'): 1, ic('Bag, urine, collecting, 2000 ml'): 1, ic('Paracetamol, tablet, 500 mg'): 8000, - ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, # todo: dose - ic('Gauze, absorbent 90cm x 40m_each_CMST'): 1, + ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 6, + ic('Gauze, absorbent 90cm x 40m_each_CMST'): 30, ic('Suture pack'): 1, } # ------------------------------------- OBSTETRIC VACUUM --------------------------------------------------- @@ -810,13 +808,13 @@ def get_and_store_labour_item_codes(self): # ------------------------------------- MATERNAL SEPSIS ----------------------------------------------------- self.item_codes_lab_consumables['maternal_sepsis_core'] = \ - {ic('Benzylpenicillin 3g (5MU), PFR_each_CMST'): 1, # todo: dose - ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 1, # todo: dose + {ic('Benzylpenicillin 3g (5MU), PFR_each_CMST'): 8, + ic('Gentamycin, injection, 40 mg/ml in 2 ml vial'): 6, } self.item_codes_lab_consumables['maternal_sepsis_optional'] = \ {ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 23_040, ic('Paracetamol, tablet, 500 mg'): 8000, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, ic('Foley catheter'): 1, @@ -825,16 +823,16 @@ def get_and_store_labour_item_codes(self): ic('Complete blood count'): 1, } # ------------------------------------- ACTIVE MANAGEMENT THIRD STAGE --------------------------------------- - self.item_codes_lab_consumables['amtsl'] = {ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1} # todo: dose + self.item_codes_lab_consumables['amtsl'] = {ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1} # ------------------------------------- POSTPARTUM HAEMORRHAGE --------------------------------------- self.item_codes_lab_consumables['pph_core'] = \ - {ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 1} # todo: dose + {ic('Oxytocin, injection, 10 IU in 1 ml ampoule'): 5} self.item_codes_lab_consumables['pph_optional'] = \ - {ic('Misoprostol, tablet, 200 mcg'): 1, # todo: dose - ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, # todo: dose - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, # todo: dose + {ic('Misoprostol, tablet, 200 mcg'): 600, + ic('Pethidine, 50 mg/ml, 2 ml ampoule'): 6, + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 23_040, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Foley catheter'): 1, From 789bf215ed41a7cfc16f694e38d80c0d6eafa511 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Thu, 11 Apr 2024 14:35:47 +0100 Subject: [PATCH 24/59] fix failing test. initial doses for newborn outcomes/postnatal supervisor --- src/tlo/methods/labour.py | 2 +- src/tlo/methods/newborn_outcomes.py | 6 +++--- src/tlo/methods/postnatal_supervisor.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tlo/methods/labour.py b/src/tlo/methods/labour.py index 80ea2a6ebe..f636fb3dbc 100644 --- a/src/tlo/methods/labour.py +++ b/src/tlo/methods/labour.py @@ -729,7 +729,7 @@ def get_and_store_labour_item_codes(self): ic('Foley catheter'): 1, ic('Bag, urine, collecting, 2000 ml'): 1, ic('Paracetamol, tablet, 500 mg'): 8000, - ic('Declofenac injection_1_CMST'): 2, + ic('Declofenac injection_each_CMST'): 2, ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, } diff --git a/src/tlo/methods/newborn_outcomes.py b/src/tlo/methods/newborn_outcomes.py index f6fb49650e..7c88fae1db 100644 --- a/src/tlo/methods/newborn_outcomes.py +++ b/src/tlo/methods/newborn_outcomes.py @@ -396,17 +396,17 @@ def get_and_store_newborn_item_codes(self): # -------------------------------------------- VITAMIN K ------------------------------------------ self.item_codes_nb_consumables['vitamin_k'] = \ - {ic('vitamin K1 (phytomenadione) 1 mg/ml, 1 ml, inj._100_IDA'): 1} # todo: dose + {ic('vitamin K1 (phytomenadione) 1 mg/ml, 1 ml, inj._100_IDA'): 1} # -------------------------------------------- EYE CARE ------------------------------------------ self.item_codes_nb_consumables['eye_care'] = \ - {ic('Tetracycline eye ointment, 1 %, tube 5 mg'): 1} # todo: dose + {ic('Tetracycline eye ointment, 1 %, tube 5 mg'): 5} # ------------------------------------- SEPSIS - FULL SUPPORTIVE CARE --------------------------------------- self.item_codes_nb_consumables['sepsis_supportive_care_core'] = \ {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, # todo: dose ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, # todo: dose - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 1 # todo: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 5760 # todo: dose } self.item_codes_nb_consumables['sepsis_supportive_care_optional'] = \ diff --git a/src/tlo/methods/postnatal_supervisor.py b/src/tlo/methods/postnatal_supervisor.py index df372c0054..d91fc2073b 100644 --- a/src/tlo/methods/postnatal_supervisor.py +++ b/src/tlo/methods/postnatal_supervisor.py @@ -1278,8 +1278,8 @@ def apply(self, person_id, squeeze_factor): of_repair_cons = \ {ic('Scalpel blade size 22 (individually wrapped)_100_CMST'): 1, - ic('Halothane (fluothane)_250ml_CMST'): 1, # todo: dose - ic('Ceftriaxone 1g, PFR_each_CMST'): 1, # todo: dose + ic('Halothane (fluothane)_250ml_CMST'): 100, # todo: dose + ic('Ceftriaxone 1g, PFR_each_CMST'): 2, # todo: dose ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Paracetamol, tablet, 500 mg'): 8000, @@ -1289,7 +1289,7 @@ def apply(self, person_id, squeeze_factor): ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, - ic('Chlorhexidine 1.5% solution_5_CMST'): 1, # todo: dose + ic('Chlorhexidine 1.5% solution_5_CMST'): 50, # todo: dose } self.get_consumables(item_codes=of_repair_cons) From 1e7756442c133912b50d7519712c55b1eeb670f4 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Wed, 17 Apr 2024 15:48:48 +0100 Subject: [PATCH 25/59] fix failing test. initial doses for newborn outcomes/postnatal supervisor --- src/tlo/methods/newborn_outcomes.py | 2 +- src/tlo/methods/postnatal_supervisor.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tlo/methods/newborn_outcomes.py b/src/tlo/methods/newborn_outcomes.py index 7c88fae1db..fe501be12f 100644 --- a/src/tlo/methods/newborn_outcomes.py +++ b/src/tlo/methods/newborn_outcomes.py @@ -406,7 +406,7 @@ def get_and_store_newborn_item_codes(self): self.item_codes_nb_consumables['sepsis_supportive_care_core'] = \ {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, # todo: dose ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, # todo: dose - ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 5760 # todo: dose + ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 5760 # } self.item_codes_nb_consumables['sepsis_supportive_care_optional'] = \ diff --git a/src/tlo/methods/postnatal_supervisor.py b/src/tlo/methods/postnatal_supervisor.py index d91fc2073b..18631dfed0 100644 --- a/src/tlo/methods/postnatal_supervisor.py +++ b/src/tlo/methods/postnatal_supervisor.py @@ -1278,18 +1278,18 @@ def apply(self, person_id, squeeze_factor): of_repair_cons = \ {ic('Scalpel blade size 22 (individually wrapped)_100_CMST'): 1, - ic('Halothane (fluothane)_250ml_CMST'): 100, # todo: dose - ic('Ceftriaxone 1g, PFR_each_CMST'): 2, # todo: dose - ic('Metronidazole 200mg_1000_CMST'): 1, # todo: dose + ic('Halothane (fluothane)_250ml_CMST'): 100, + ic('Ceftriaxone 1g, PFR_each_CMST'): 2, + ic('Metronidazole 200mg_1000_CMST'): 6000, ic('Cannula iv (winged with injection pot) 18_each_CMST'): 1, ic('Paracetamol, tablet, 500 mg'): 8000, - ic('Declofenac injection_each_CMST'): 1, # todo: dose + ic('Declofenac injection_each_CMST'): 1, ic('Foley catheter'): 1, ic('Bag, urine, collecting, 2000 ml'): 1, ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, ic('Sodium chloride, injectable solution, 0,9 %, 500 ml'): 2000, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, - ic('Chlorhexidine 1.5% solution_5_CMST'): 50, # todo: dose + ic('Chlorhexidine 1.5% solution_5_CMST'): 50, } self.get_consumables(item_codes=of_repair_cons) From 06cec427fa2be4f835f9cb256ff6092013a79e95 Mon Sep 17 00:00:00 2001 From: sm2511 Date: Thu, 18 Apr 2024 13:15:01 +0100 Subject: [PATCH 26/59] delete temporary ~ file created --- resources/costing/~$ResourceFile_Costing.xlsx | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 resources/costing/~$ResourceFile_Costing.xlsx diff --git a/resources/costing/~$ResourceFile_Costing.xlsx b/resources/costing/~$ResourceFile_Costing.xlsx deleted file mode 100644 index d5d6d83ccc..0000000000 --- a/resources/costing/~$ResourceFile_Costing.xlsx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:019349b15c524cfef4b39db4dd792de3376f4bc3da9b6b298a1fee07c4eb219e -size 165 From 9821cfc2bfa5d86597d7b74e1984c74b50b6017e Mon Sep 17 00:00:00 2001 From: sm2511 Date: Thu, 18 Apr 2024 14:14:33 +0100 Subject: [PATCH 27/59] update units of safety box to "1 disposed syringe (100 syringes per box)" --- resources/costing/ResourceFile_Costing.xlsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/costing/ResourceFile_Costing.xlsx b/resources/costing/ResourceFile_Costing.xlsx index 840fdbca8f..9f06132aaa 100644 --- a/resources/costing/ResourceFile_Costing.xlsx +++ b/resources/costing/ResourceFile_Costing.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:070cc08625170fab8e11198a350822b427c84add24444b6293bc830102c9b612 -size 1007683 +oid sha256:2afa3649672e10c9741b26dc70fa0f4496af4fccfafbf8b7b70f3b90b291a4fb +size 1007463 From 0a6392426897a2b72b4614ff456ce3ae7d365690 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Wed, 17 Apr 2024 15:59:30 +0100 Subject: [PATCH 28/59] fix failing test. initial doses for newborn outcomes/postnatal supervisor --- src/tlo/methods/newborn_outcomes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tlo/methods/newborn_outcomes.py b/src/tlo/methods/newborn_outcomes.py index fe501be12f..06986067a8 100644 --- a/src/tlo/methods/newborn_outcomes.py +++ b/src/tlo/methods/newborn_outcomes.py @@ -403,9 +403,11 @@ def get_and_store_newborn_item_codes(self): {ic('Tetracycline eye ointment, 1 %, tube 5 mg'): 5} # ------------------------------------- SEPSIS - FULL SUPPORTIVE CARE --------------------------------------- + # Whilst abx for newborns are weight based the maximum dose does not exceed the minimum unit for the costing + # model self.item_codes_nb_consumables['sepsis_supportive_care_core'] = \ - {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, # todo: dose - ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, # todo: dose + {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, + ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, ic('Oxygen, 1000 liters, primarily with oxygen cylinders'): 5760 # } @@ -419,8 +421,8 @@ def get_and_store_newborn_item_codes(self): # ---------------------------------------- SEPSIS - ANTIBIOTICS --------------------------------------------- self.item_codes_nb_consumables['sepsis_abx'] = \ - {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, # todo: dose - ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, # todo: dose + {ic('Benzylpenicillin 1g (1MU), PFR_Each_CMST'): 1, + ic('Gentamicin 40mg/ml, 2ml_each_CMST'): 1, } def initialise_simulation(self, sim): From 82ec04ef903945ac5dd02a0607985f7f605b187d Mon Sep 17 00:00:00 2001 From: joehcollins Date: Tue, 14 May 2024 14:45:37 +0100 Subject: [PATCH 29/59] fixed error in labour. COPD consumable unites --- src/tlo/methods/copd.py | 24 +++++++++++++----------- src/tlo/methods/labour.py | 7 ++++--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/tlo/methods/copd.py b/src/tlo/methods/copd.py index 2fd27e13a2..e91ed00e39 100644 --- a/src/tlo/methods/copd.py +++ b/src/tlo/methods/copd.py @@ -184,14 +184,14 @@ def define_symptoms(self): def lookup_item_codes(self): """Look-up the item-codes for the consumables needed in the HSI Events for this module.""" - # todo: Need to look-up these item-codes. + ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name + self.item_codes = { - 'bronchodilater_inhaler': 293, - 'steroid_inhaler': 294, - 'oxygen': 127, - 'aminophylline': 292, - 'amoxycillin': 125, - 'prednisolone': 291 + 'bronchodilater_inhaler': ic('Salbutamol Inhaler 100mcg/dose - 200 doses '), + 'oxygen': ic('Oxygen, 1000 liters, primarily with oxygen cylinders'), + 'aminophylline': ic('Aminophylline 100mg, tablets'), + 'amoxycillin': ic('Amoxycillin 250mg_1000_CMST'), + 'prednisolone': ic('Prednisolone 5mg_100_CMST'), } def do_logging(self): @@ -209,7 +209,7 @@ def give_inhaler(self, person_id: int, hsi_event: HSI_Event): df = self.sim.population.props has_inhaler = df.at[person_id, 'ch_has_inhaler'] if not has_inhaler: - if hsi_event.get_consumables(self.item_codes['bronchodilater_inhaler']): + if hsi_event.get_consumables({self.item_codes['bronchodilater_inhaler']:1}): df.at[person_id, 'ch_has_inhaler'] = True def do_when_present_with_breathless(self, person_id: int, hsi_event: HSI_Event): @@ -527,7 +527,8 @@ def apply(self, person_id, squeeze_factor): * Provide treatment: whatever is available at this facility at this time (no referral). """ df = self.sim.population.props - if not self.get_consumables(self.module.item_codes['oxygen']): + # Assume average 8L O2 for 2 days inpatient care + if not self.get_consumables({self.module.item_codes['oxygen']: 23_040}): # refer to the next higher facility if the current facility has no oxygen self.facility_levels_index += 1 if self.facility_levels_index >= len(self.all_facility_levels): @@ -537,10 +538,11 @@ def apply(self, person_id, squeeze_factor): else: # Give oxygen and AminoPhylline, if possible, ... and cancel death if the treatment is successful. + # Aminophylline dose = 100mg 8hrly, assuming 600mg in 48 hours prob_treatment_success = self.module.models.prob_livesaved_given_treatment( df=df.iloc[[person_id]], - oxygen=self.get_consumables(self.module.item_codes['oxygen']), - aminophylline=self.get_consumables(self.module.item_codes['aminophylline']) + oxygen=self.get_consumables({self.module.item_codes['oxygen']: 23_040}), + aminophylline=self.get_consumables({self.module.item_codes['aminophylline']: 600}) ) if prob_treatment_success: diff --git a/src/tlo/methods/labour.py b/src/tlo/methods/labour.py index f636fb3dbc..07b0b53dde 100644 --- a/src/tlo/methods/labour.py +++ b/src/tlo/methods/labour.py @@ -768,7 +768,7 @@ def get_and_store_labour_item_codes(self): # --------------------------------------- ORAL ANTIHYPERTENSIVES --------------------------------------------- self.item_codes_lab_consumables['oral_antihypertensives'] = \ - {ic('Hydralazine, powder for injection, 20 mg ampoule'): 1} + {ic('Methyldopa 250mg_1000_CMST'): 1} # ---------------------------------- SEVERE PRE-ECLAMPSIA/ECLAMPSIA ----------------------------------------- self.item_codes_lab_consumables['magnesium_sulfate'] = \ @@ -1790,8 +1790,9 @@ def assessment_and_treatment_of_hypertension(self, hsi_event, labour_stage): elif (labour_stage == 'pp') and (df.at[person_id, 'pn_htn_disorders'] == 'severe_gest_htn'): df.at[person_id, 'pn_htn_disorders'] = 'gest_htn' - avail = hsi_event.get_consumables( - item_codes=self.item_codes_lab_consumables['oral_antihypertensives']) + dose = (7 * 4) * 6 # approximating 4 tablets a day, for 6 weeks + cons = {_i: dose for _i in self.item_codes_lab_consumables['oral_antihypertensives']} + avail = hsi_event.get_consumables(item_codes=cons) if avail: df.at[person_id, 'la_gest_htn_on_treatment'] = True From ae8615d4eab628aa9814cf8b12f87cb1d66ad06a Mon Sep 17 00:00:00 2001 From: joehcollins Date: Tue, 14 May 2024 15:14:25 +0100 Subject: [PATCH 30/59] remove consumable packages from diarrhoea.py --- src/tlo/methods/diarrhoea.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/tlo/methods/diarrhoea.py b/src/tlo/methods/diarrhoea.py index 242ecb2cc1..7e9c989995 100644 --- a/src/tlo/methods/diarrhoea.py +++ b/src/tlo/methods/diarrhoea.py @@ -644,18 +644,22 @@ def report_daly_values(self): def look_up_consumables(self): """Look up and store the consumables item codes used in each of the HSI.""" - get_item_codes_from_package_name = self.sim.modules['HealthSystem'].get_item_codes_from_package_name - - self.consumables_used_in_hsi['ORS'] = get_item_codes_from_package_name( - package='ORS') - self.consumables_used_in_hsi['Treatment_Severe_Dehydration'] = get_item_codes_from_package_name( - package='Treatment of severe diarrhea') - self.consumables_used_in_hsi['Zinc_Under6mo'] = get_item_codes_from_package_name( - package='Zinc for Children 0-6 months') - self.consumables_used_in_hsi['Zinc_Over6mo'] = get_item_codes_from_package_name( - package='Zinc for Children 6-59 months') - self.consumables_used_in_hsi['Antibiotics_for_Dysentery'] = get_item_codes_from_package_name( - package='Antibiotics for treatment of dysentery') + ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name + + self.consumables_used_in_hsi['ORS'] = {ic('ORS, sachet'): 1} + + self.consumables_used_in_hsi['Treatment_Severe_Dehydration'] = \ + {ic('ORS, sachet'): 1, + ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, + ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1} + + self.consumables_used_in_hsi['Zinc_Under6mo'] = {ic('Zinc, tablet, 20 mg'): 1} + + self.consumables_used_in_hsi['Zinc_Over6mo'] = {ic('Zinc, tablet, 20 mg'): 1} + + self.consumables_used_in_hsi['Antibiotics_for_Dysentery'] = \ + {ic('Ciprofloxacin 250mg_100_CMST'): 1, + ic("Paracetamol syrup 120mg/5ml_0.0119047619047619_CMST"): 1} def do_when_presentation_with_diarrhoea(self, person_id, hsi_event): """This routine is called when Diarrhoea is a symptom for a child attending a Generic HSI Appointment. It From a96785095b72f539d588a2e8f57b4aeea2816b2b Mon Sep 17 00:00:00 2001 From: joehcollins Date: Tue, 14 May 2024 15:57:38 +0100 Subject: [PATCH 31/59] diarrhoea.py consumable units --- src/tlo/methods/diarrhoea.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/tlo/methods/diarrhoea.py b/src/tlo/methods/diarrhoea.py index 7e9c989995..fe442138fc 100644 --- a/src/tlo/methods/diarrhoea.py +++ b/src/tlo/methods/diarrhoea.py @@ -646,20 +646,21 @@ def look_up_consumables(self): """Look up and store the consumables item codes used in each of the HSI.""" ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name - self.consumables_used_in_hsi['ORS'] = {ic('ORS, sachet'): 1} + self.consumables_used_in_hsi['ORS'] = {ic('ORS, sachet'): 2} self.consumables_used_in_hsi['Treatment_Severe_Dehydration'] = \ - {ic('ORS, sachet'): 1, + {ic('ORS, sachet'): 2, ic('Giving set iv administration + needle 15 drops/ml_each_CMST'): 1, - ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1} + ic("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1000} - self.consumables_used_in_hsi['Zinc_Under6mo'] = {ic('Zinc, tablet, 20 mg'): 1} - - self.consumables_used_in_hsi['Zinc_Over6mo'] = {ic('Zinc, tablet, 20 mg'): 1} + self.consumables_used_in_hsi['Zinc'] = ic('Zinc, tablet, 20 mg') + # For weight based treatment for children under five, we've averaged the median weight for each for years + # 0-5 as 12kg. + # So for cipro/para - 10mg/kg 12 hrly for 7 days = ((10*12)*2) * 7 (same dose reccomended) self.consumables_used_in_hsi['Antibiotics_for_Dysentery'] = \ - {ic('Ciprofloxacin 250mg_100_CMST'): 1, - ic("Paracetamol syrup 120mg/5ml_0.0119047619047619_CMST"): 1} + {ic('Ciprofloxacin 250mg_100_CMST'): 1680, + ic("Paracetamol syrup 120mg/5ml_0.0119047619047619_CMST"): 1680} def do_when_presentation_with_diarrhoea(self, person_id, hsi_event): """This routine is called when Diarrhoea is a symptom for a child attending a Generic HSI Appointment. It @@ -732,9 +733,10 @@ def do_treatment(self, person_id, hsi_event): # ** Implement the procedure for treatment ** # STEP ZERO: Get the Zinc consumable (happens irrespective of whether child will die or not) + # Dose is 10mg 24hrly for 10 days <6months or 20m for >6mnths + dose = 100 if person.age_exact_years < 0.5 else 200 gets_zinc = hsi_event.get_consumables( - item_codes=self.consumables_used_in_hsi[ - 'Zinc_Under6mo' if person.age_exact_years < 0.5 else 'Zinc_Over6mo'] + item_codes={self.consumables_used_in_hsi['Zinc']: dose} ) # STEP ONE: Aim to alleviate dehydration: From a80e389022e358266618675483a49ccb93399454 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Wed, 15 May 2024 10:06:39 +0100 Subject: [PATCH 32/59] cmd.py consumable units --- src/tlo/methods/cardio_metabolic_disorders.py | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/tlo/methods/cardio_metabolic_disorders.py b/src/tlo/methods/cardio_metabolic_disorders.py index 4ef5c41c8e..5a0190afa7 100644 --- a/src/tlo/methods/cardio_metabolic_disorders.py +++ b/src/tlo/methods/cardio_metabolic_disorders.py @@ -1567,10 +1567,23 @@ def apply(self, person_id, squeeze_factor): return self.sim.modules['HealthSystem'].get_blank_appt_footprint() assert person[f'nc_{self.condition}_ever_diagnosed'], "The person is not diagnosed and so should not be " \ "receiving an HSI." + + # Monthly doses of medications as follows. Diabetes - 1000mg metformin daily (1000*30.5), + # hypertension - 25mg hydrochlorothiazide daily (25*30.5), CKD 1 dialysis bag (estimate), + # lower back pain - 2400mg aspirin daily (2400*30.5), CIHD - 75mg aspirin daily (75*30.5) + dose = {'diabetes': 30_500, + 'hypertension': 610, + 'chronic_kidney_disease': 1, + 'chronic_lower_back_pain': 73_200, + 'chronic_ischemic_hd': 2288, + 'ever_stroke': 2288, + 'ever_heart_attack': 2288} + # Check availability of medication for condition - if self.get_consumables( - item_codes=self.module.parameters[f'{self.condition}_hsi'].get('medication_item_code').astype(int) - ): + if self.get_consumables(item_codes= + {self.module.parameters[f'{self.condition}_hsi'].get( + 'medication_item_code').astype(int): dose[self.condition]}): + # If medication is available, flag as being on medication df.at[person_id, f'nc_{self.condition}_on_medication'] = True # Determine if the medication will work to prevent death @@ -1636,10 +1649,21 @@ def apply(self, person_id, squeeze_factor): # Return the blank_appt_footprint() so that this HSI does not occupy any time resources return self.sim.modules['HealthSystem'].get_blank_appt_footprint() + # Monthly doses of medications as follows. Diabetes - 1000mg metformin daily (1000*30.5), + # hypertension - 25mg hydrochlorothiazide daily (25*30.5), CKD 1 dialysis bag (estimate), + # lower back pain - 2400mg aspirin daily (2400*30.5), CIHD - 75mg aspirin daily (75*30.5) + dose = {'diabetes': 30_500, + 'hypertension': 610, + 'chronic_kidney_disease': 1, + 'chronic_lower_back_pain': 73_200, + 'chronic_ischemic_hd': 2288, + 'ever_stroke': 2288, + 'ever_heart_attack': 2288} + # Check availability of medication for condition if self.get_consumables( - item_codes=self.module.parameters[f'{self.condition}_hsi'].get('medication_item_code').astype(int) - ): + item_codes={self.module.parameters[f'{self.condition}_hsi'].get('medication_item_code').astype(int) + : dose[self.condition]}): # Schedule their next HSI for a refill of medication, one month from now self.sim.modules['HealthSystem'].schedule_hsi_event( hsi_event=self, @@ -1701,10 +1725,14 @@ def do_for_each_event_to_be_investigated(self, _ev): df.at[person_id, f'nc_{_ev}_date_diagnosis'] = self.sim.date df.at[person_id, f'nc_{_ev}_ever_diagnosed'] = True if self.module.parameters['prob_care_provided_given_seek_emergency_care'] > self.module.rng.random_sample(): + # If care is provided.... + # TODO: confirm dose for emergency treatment of MI/STROKE + dose = 20 if _ev == 'ever_stroke' else 40 + if self.get_consumables( - item_codes=self.module.parameters[f'{_ev}_hsi'].get( - 'emergency_medication_item_code').astype(int) + item_codes={self.module.parameters[f'{_ev}_hsi'].get( + 'emergency_medication_item_code').astype(int): dose} ): logger.debug(key='debug', data='Treatment will be provided.') df.at[person_id, f'nc_{_ev}_on_medication'] = True From 08cfa4240c1ec676d76056878f46f4e32586e9d8 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Wed, 15 May 2024 11:21:17 +0100 Subject: [PATCH 33/59] rti.py consumable units --- src/tlo/methods/rti.py | 64 ++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/tlo/methods/rti.py b/src/tlo/methods/rti.py index aac0129cf6..fe97c19456 100644 --- a/src/tlo/methods/rti.py +++ b/src/tlo/methods/rti.py @@ -3746,21 +3746,21 @@ def apply(self, person_id, squeeze_factor): # TODO: find a more complete list of required consumables for adults if is_child: self.module.item_codes_for_consumables_required['shock_treatment_child'] = { - get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1, - get_item_code("Dextrose (glucose) 5%, 1000ml_each_CMST"): 1, + get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 500, + get_item_code("Dextrose (glucose) 5%, 1000ml_each_CMST"): 500, get_item_code('Cannula iv (winged with injection pot) 18_each_CMST'): 1, - get_item_code('Blood, one unit'): 1, - get_item_code("Oxygen, 1000 liters, primarily with oxygen cylinders"): 1 + get_item_code('Blood, one unit'): 2, + get_item_code("Oxygen, 1000 liters, primarily with oxygen cylinders"): 23_040 } is_cons_available = self.get_consumables( self.module.item_codes_for_consumables_required['shock_treatment_child'] ) else: self.module.item_codes_for_consumables_required['shock_treatment_adult'] = { - get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1, + get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, get_item_code('Cannula iv (winged with injection pot) 18_each_CMST'): 1, - get_item_code('Blood, one unit'): 1, - get_item_code("Oxygen, 1000 liters, primarily with oxygen cylinders"): 1 + get_item_code('Blood, one unit'): 2, + get_item_code("Oxygen, 1000 liters, primarily with oxygen cylinders"): 23_040 } is_cons_available = self.get_consumables( self.module.item_codes_for_consumables_required['shock_treatment_adult'] @@ -3858,7 +3858,7 @@ def apply(self, person_id, squeeze_factor): # If they have a fracture that needs a cast, ask for plaster of paris self.module.item_codes_for_consumables_required['fracture_treatment'] = { get_item_code('Plaster of Paris (POP) 10cm x 7.5cm slab_12_CMST'): fracturecastcounts, - get_item_code('Bandage, crepe 7.5cm x 1.4m long , when stretched'): slingcounts, + get_item_code('Bandage, crepe 7.5cm x 1.4m long , when stretched'): 200, } is_cons_available = self.get_consumables( self.module.item_codes_for_consumables_required['fracture_treatment'] @@ -3979,11 +3979,12 @@ def apply(self, person_id, squeeze_factor): assert df.loc[person_id, 'rt_med_int'], 'person sent here has not been treated' # If they have an open fracture, ask for consumables to treat fracture + # todo: confirm single dose of prophylactic ceftriaxone if open_fracture_counts > 0: self.module.item_codes_for_consumables_required['open_fracture_treatment'] = { - get_item_code('Ceftriaxone 1g, PFR_each_CMST'): 1, - get_item_code('Cetrimide 15% + chlorhexidine 1.5% solution.for dilution _5_CMST'): 1, - get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 1, + get_item_code('Ceftriaxone 1g, PFR_each_CMST'): 2000, + get_item_code('Cetrimide 15% + chlorhexidine 1.5% solution.for dilution _5_CMST'): 500, + get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 100, get_item_code('Suture pack'): 1, } # If wound is "grossly contaminated" administer Metronidazole @@ -3991,9 +3992,10 @@ def apply(self, person_id, squeeze_factor): p = self.module.parameters prob_open_fracture_contaminated = p['prob_open_fracture_contaminated'] rand_for_contamination = self.module.rng.random_sample(size=1) + # todo: confirm correct dose (below from BNF for surgical prophylaxsis) if rand_for_contamination < prob_open_fracture_contaminated: self.module.item_codes_for_consumables_required['open_fracture_treatment'].update( - {get_item_code('Metronidazole, injection, 500 mg in 100 ml vial'): 1} + {get_item_code('Metronidazole, injection, 500 mg in 100 ml vial'): 1500} ) # Check that there are enough consumables to treat this person's fractures is_cons_available = self.get_consumables( @@ -4092,7 +4094,7 @@ def apply(self, person_id, squeeze_factor): if lacerationcounts > 0: self.module.item_codes_for_consumables_required['laceration_treatment'] = { get_item_code('Suture pack'): lacerationcounts, - get_item_code('Cetrimide 15% + chlorhexidine 1.5% solution.for dilution _5_CMST'): lacerationcounts, + get_item_code('Cetrimide 15% + chlorhexidine 1.5% solution.for dilution _5_CMST'): 500, } # check the number of suture kits required and request them @@ -4200,7 +4202,7 @@ def apply(self, person_id, squeeze_factor): # check if they have multiple burns, which implies a higher burned total body surface area (TBSA) which # will alter the treatment plan self.module.item_codes_for_consumables_required['burn_treatment'].update( - {get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1} + {get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 4000} ) is_cons_available = self.get_consumables( @@ -4386,20 +4388,20 @@ def apply(self, person_id, squeeze_factor): description='Summary of the pain medicine requested by each person') if df.loc[person_id, 'age_years'] < 16: self.module.item_codes_for_consumables_required['pain_management'] = { - get_item_code("Paracetamol 500mg_1000_CMST"): 1 + get_item_code("Paracetamol 500mg_1000_CMST"): 8000 } cond = self.get_consumables( self.module.item_codes_for_consumables_required['pain_management'] ) else: self.module.item_codes_for_consumables_required['pain_management'] = { - get_item_code("diclofenac sodium 25 mg, enteric coated_1000_IDA"): 1 + get_item_code("diclofenac sodium 25 mg, enteric coated_1000_IDA"): 300 } cond1 = self.get_consumables( self.module.item_codes_for_consumables_required['pain_management'] ) self.module.item_codes_for_consumables_required['pain_management'] = { - get_item_code("Paracetamol 500mg_1000_CMST"): 1 + get_item_code("Paracetamol 500mg_1000_CMST"): 8000 } cond2 = self.get_consumables( self.module.item_codes_for_consumables_required['pain_management'] @@ -4456,7 +4458,7 @@ def apply(self, person_id, squeeze_factor): data=dict_to_output, description='Summary of the pain medicine requested by each person') self.module.item_codes_for_consumables_required['pain_management'] = { - get_item_code("tramadol HCl 100 mg/2 ml, for injection_100_IDA"): 1 + get_item_code("tramadol HCl 100 mg/2 ml, for injection_100_IDA"): 300 } is_cons_available = self.get_consumables( self.module.item_codes_for_consumables_required['pain_management'] @@ -4488,7 +4490,7 @@ def apply(self, person_id, squeeze_factor): description='Summary of the pain medicine requested by each person') # give morphine self.module.item_codes_for_consumables_required['pain_management'] = { - get_item_code("morphine sulphate 10 mg/ml, 1 ml, injection (nt)_10_IDA"): 1 + get_item_code("morphine sulphate 10 mg/ml, 1 ml, injection (nt)_10_IDA"): 120 } is_cons_available = self.get_consumables( self.module.item_codes_for_consumables_required['pain_management'] @@ -4648,22 +4650,22 @@ def apply(self, person_id, squeeze_factor): # Request first draft of consumables used in major surgery self.module.item_codes_for_consumables_required['major_surgery'] = { # request a general anaesthetic - get_item_code("Halothane (fluothane)_250ml_CMST"): 1, + get_item_code("Halothane (fluothane)_250ml_CMST"): 100, # clean the site of the surgery - get_item_code("Chlorhexidine 1.5% solution_5_CMST"): 1, + get_item_code("Chlorhexidine 1.5% solution_5_CMST"): 500, # tools to begin surgery get_item_code("Scalpel blade size 22 (individually wrapped)_100_CMST"): 1, # administer an IV get_item_code('Cannula iv (winged with injection pot) 18_each_CMST'): 1, get_item_code("Giving set iv administration + needle 15 drops/ml_each_CMST"): 1, - get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1, + get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, # repair incision made get_item_code("Suture pack"): 1, - get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 1, + get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 100, # administer pain killer - get_item_code('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, + get_item_code('Pethidine, 50 mg/ml, 2 ml ampoule'): 6, # administer antibiotic - get_item_code("Ampicillin injection 500mg, PFR_each_CMST"): 1, + get_item_code("Ampicillin injection 500mg, PFR_each_CMST"): 1000, # equipment used by surgeon, gloves and facemask get_item_code('Disposables gloves, powder free, 100 pieces per box'): 1, get_item_code('surgical face mask, disp., with metal nose piece_50_IDA'): 1, @@ -4984,22 +4986,22 @@ def apply(self, person_id, squeeze_factor): # Request first draft of consumables used in major surgery self.module.item_codes_for_consumables_required['minor_surgery'] = { # request a local anaesthetic - get_item_code("Halothane (fluothane)_250ml_CMST"): 1, + get_item_code("Halothane (fluothane)_250ml_CMST"): 100, # clean the site of the surgery - get_item_code("Chlorhexidine 1.5% solution_5_CMST"): 1, + get_item_code("Chlorhexidine 1.5% solution_5_CMST"): 500, # tools to begin surgery get_item_code("Scalpel blade size 22 (individually wrapped)_100_CMST"): 1, # administer an IV get_item_code('Cannula iv (winged with injection pot) 18_each_CMST'): 1, get_item_code("Giving set iv administration + needle 15 drops/ml_each_CMST"): 1, - get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 1, + get_item_code("ringer's lactate (Hartmann's solution), 1000 ml_12_IDA"): 2000, # repair incision made get_item_code("Suture pack"): 1, - get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 1, + get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 100, # administer pain killer - get_item_code('Pethidine, 50 mg/ml, 2 ml ampoule'): 1, + get_item_code('Pethidine, 50 mg/ml, 2 ml ampoule'): 6, # administer antibiotic - get_item_code("Ampicillin injection 500mg, PFR_each_CMST"): 1, + get_item_code("Ampicillin injection 500mg, PFR_each_CMST"): 1000, # equipment used by surgeon, gloves and facemask get_item_code('Disposables gloves, powder free, 100 pieces per box'): 1, get_item_code('surgical face mask, disp., with metal nose piece_50_IDA'): 1, From 6bdf8c6e221aa8bbe43885f3abccf693a94fc157 Mon Sep 17 00:00:00 2001 From: joehcollins Date: Fri, 17 May 2024 10:00:25 +0100 Subject: [PATCH 34/59] alri.py consumable units plus fixed error in diarrhoea.py --- src/tlo/methods/alri.py | 132 ++++++++++------------------------- src/tlo/methods/diarrhoea.py | 6 +- 2 files changed, 38 insertions(+), 100 deletions(-) diff --git a/src/tlo/methods/alri.py b/src/tlo/methods/alri.py index 277726e0ff..9f5b5e015c 100644 --- a/src/tlo/methods/alri.py +++ b/src/tlo/methods/alri.py @@ -1014,139 +1014,85 @@ def look_up_consumables(self): get_item_code = self.sim.modules['HealthSystem'].get_item_code_from_item_name - def get_dosage_for_age_in_months(age_in_whole_months: float, doses_by_age_in_months: Dict[int, float]): - """Returns the dose corresponding to age, using the lookup provided in `doses`. The format of `doses` is: - {: }.""" - - for upper_age_bound_in_months, _dose in sorted(doses_by_age_in_months.items()): - if age_in_whole_months < upper_age_bound_in_months: - return _dose - return _dose - - # # # # # # Dosages by age # # # # # # + # # # # # # Dosages by weight # # # # # # + # Assuming average weight of 0-5 is 12kg (abstraction). Doses sourced for WHO Pocket book of hospital care for + # children: Second edition 2014 # Antibiotic therapy ------------------- - # Antibiotics for non-severe pneumonia - oral amoxicillin for 5 days + # Antibiotics for non-severe pneumonia - oral amoxicillin for 5 days (40mg/kg BD - ((12*40)*2)*5 =4800mg) self.consumables_used_in_hsi['Amoxicillin_tablet_or_suspension_5days'] = { - get_item_code(item='Amoxycillin 250mg_1000_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {2: 0, 12: 0.006, 36: 0.012, np.inf: 0.018} - ), - get_item_code(item='Amoxycillin 125mg/5ml suspension, PFR_0.025_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {2: 0, 12: 1, 36: 2, np.inf: 3} - ), - } + get_item_code(item='Amoxycillin 250mg_1000_CMST'): 4800, + get_item_code(item='Amoxycillin 125mg/5ml suspension, PFR_0.025_CMST'): 192} # 25mg/ml - 4800/25 - # Antibiotics for non-severe pneumonia - oral amoxicillin for 3 days + # Antibiotics for non-severe pneumonia - oral amoxicillin for 3 days (40mg/kg BD - ((12*40)*2)*3 =2880mg) self.consumables_used_in_hsi['Amoxicillin_tablet_or_suspension_3days'] = { - get_item_code(item='Amoxycillin 250mg_1000_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {2: 0, 12: 0.01, 36: 0.02, np.inf: 0.03} - ), - get_item_code(item='Amoxycillin 125mg/5ml suspension, PFR_0.025_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {2: 0, 12: 1, 36: 2, np.inf: 3} - ), - } + get_item_code(item='Amoxycillin 250mg_1000_CMST'): 2880, + get_item_code(item='Amoxycillin 125mg/5ml suspension, PFR_0.025_CMST'): 115} # 25mg/ml - 2880/25 - # Antibiotics for non-severe pneumonia - oral amoxicillin for 7 days for young infants only + # Antibiotics for non-severe pneumonia - oral amoxicillin for 7 days for young infants only (40mg/kg BD - + # ((12*40)*2)*7 =6720mg) self.consumables_used_in_hsi['Amoxicillin_tablet_or_suspension_7days'] = { - get_item_code(item='Amoxycillin 250mg_1000_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {1: 0.004, 2: 0.006, np.inf: 0.01} - ), - get_item_code(item='Amoxycillin 125mg/5ml suspension, PFR_0.025_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {1: 0.4, 2: 0.5, np.inf: 1} - ), - } + get_item_code(item='Amoxycillin 250mg_1000_CMST'): 6720, + get_item_code(item='Amoxycillin 125mg/5ml suspension, PFR_0.025_CMST'): 269} # 25mg/ml - 6720/25 # Antibiotic therapy for severe pneumonia - ampicillin package + # Amp. dose - 50mg/KG QDS 5 days = (50*12)*4)*5 = 12_000mg + # Gent. dose -7.5mg/kg per day 5 days = (7.5*12)*5 = 450mg self.consumables_used_in_hsi['1st_line_IV_antibiotics'] = { - get_item_code(item='Ampicillin injection 500mg, PFR_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {1: 3.73, 2: 5.6, 4: 8, 12: 16, 36: 24, np.inf: 40} - ), - get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {1: 0.7, 2: 1.4, 4: 2.81, 12: 4.69, 36: 7.03, np.inf: 9.37} - ), + get_item_code(item='Ampicillin injection 500mg, PFR_each_CMST'): 24, # 500mg vial -12_000/500 + get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): 6, # 80mg/2ml = 450/8 get_item_code(item='Cannula iv (winged with injection pot) 16_each_CMST'): 1, get_item_code(item='Syringe, Autodisable SoloShot IX '): 1 } # # Antibiotic therapy for severe pneumonia - benzylpenicillin package when ampicillin is not available + # Benpen dose - 50_000IU/KG QDS 5 days = (50_000*12)*4)*5 = 12_000_000IU = 8g (approx) + # Gent. dose -7.5mg/kg per day 5 days = (7.5*12)*5 = 450mg self.consumables_used_in_hsi['Benzylpenicillin_gentamicin_therapy_for_severe_pneumonia'] = { - get_item_code(item='Benzylpenicillin 3g (5MU), PFR_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {1: 2, 2: 5, 4: 8, 12: 15, 36: 24, np.inf: 34} - ), - get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {1: 0.7, 2: 1.4, 4: 2.81, 12: 4.69, 36: 7.03, np.inf: 9.37} - ), + get_item_code(item='Benzylpenicillin 3g (5MU), PFR_each_CMST'): 8, + get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): 6, # 80mg/2ml = 450/8 get_item_code(item='Cannula iv (winged with injection pot) 16_each_CMST'): 1, get_item_code(item='Syringe, Autodisable SoloShot IX '): 1 } # Second line of antibiotics for severe pneumonia, if Staph not suspected + # Ceft. dose = 80mg/kg per day 5 days = (80*12)*5 = 4800mg self.consumables_used_in_hsi['Ceftriaxone_therapy_for_severe_pneumonia'] = { - get_item_code(item='Ceftriaxone 1g, PFR_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {4: 1.5, 12: 3, 36: 5, np.inf: 7} - ), + get_item_code(item='Ceftriaxone 1g, PFR_each_CMST'): 1, # smallest unit is 1g get_item_code(item='Cannula iv (winged with injection pot) 16_each_CMST'): 1, get_item_code(item='Syringe, Autodisable SoloShot IX '): 1 } # Second line of antibiotics for severe pneumonia, if Staph is suspected + # Flucox. dose = 50mg/kg QDS 7 days = ((50*12)*4)*7 = 16_800mg + # Oral flucox dose. = same self.consumables_used_in_hsi['2nd_line_Antibiotic_therapy_for_severe_staph_pneumonia'] = { - get_item_code(item='Flucloxacillin 250mg, vial, PFR_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {2: 21, 4: 22.4, 12: 37.3, 36: 67.2, 60: 93.3, np.inf: 140} - ), - get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {4: 2.81, 12: 4.69, 36: 7.03, 60: 9.37, np.inf: 13.6} - ), + get_item_code(item='Flucloxacillin 250mg, vial, PFR_each_CMST'): 16_800, + get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): 6, # 80mg/2ml = 450/8 get_item_code(item='Cannula iv (winged with injection pot) 16_each_CMST'): 1, get_item_code(item='Syringe, Autodisable SoloShot IX '): 1, - get_item_code(item='Flucloxacillin 250mg_100_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {4: 0.42, 36: 0.84, 60: 1.68, np.inf: 1.68} - ), - } + get_item_code(item='Flucloxacillin 250mg_100_CMST'): 16_800} # First dose of antibiotic before referral ------------------- - + # single dose of 7.5mg gent and 50mg/g amp. given # Referral process in iCCM for severe pneumonia, and at health centres for HIV exposed/infected self.consumables_used_in_hsi['First_dose_oral_amoxicillin_for_referral'] = { - get_item_code(item='Amoxycillin 250mg_1000_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {12: 0.001, 36: 0.002, np.inf: 0.003} - ), + get_item_code(item='Amoxycillin 250mg_1000_CMST'): 250, } # Referral process at health centres for severe cases self.consumables_used_in_hsi['First_dose_IM_antibiotics_for_referral'] = { - get_item_code(item='Ampicillin injection 500mg, PFR_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {4: 0.4, 12: 0.8, 36: 1.4, np.inf: 2} - ), - get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {4: 0.56, 12: 0.94, 36: 1.41, np.inf: 1.87} - ), + get_item_code(item='Ampicillin injection 500mg, PFR_each_CMST'): 2, # 2 x 500mg vial + get_item_code(item='Gentamicin Sulphate 40mg/ml, 2ml_each_CMST'): 2, # assuming single dose at referral get_item_code(item='Cannula iv (winged with injection pot) 16_each_CMST'): 1, get_item_code(item='Syringe, Autodisable SoloShot IX '): 1 } # Oxygen, pulse oximetry and x-ray ------------------- - # Oxygen for hypoxaemia + # Oxygen for hypoxaemia - 5/l per min (Approx) for 3 days ((24*60)*5)*3 self.consumables_used_in_hsi['Oxygen_Therapy'] = { - get_item_code(item='Oxygen, 1000 liters, primarily with oxygen cylinders'): 1, + get_item_code(item='Oxygen, 1000 liters, primarily with oxygen cylinders'): 21_600, } # Pulse oximetry @@ -1162,10 +1108,7 @@ def get_dosage_for_age_in_months(age_in_whole_months: float, doses_by_age_in_mon # Optional consumables ------------------- # Paracetamol self.consumables_used_in_hsi['Paracetamol_tablet'] = { - get_item_code(item='Paracetamol, tablet, 100 mg'): - lambda _age: get_dosage_for_age_in_months(int(_age * 12.0), - {36: 12, np.inf: 18} - ), + get_item_code(item='Paracetamol, tablet, 100 mg'): 240, # 20mg/kg } # Maintenance of fluids via nasograstric tube @@ -1178,11 +1121,6 @@ def get_dosage_for_age_in_months(age_in_whole_months: float, doses_by_age_in_mon get_item_code(item='Salbutamol sulphate 1mg/ml, 5ml_each_CMST'): 2 } - # Bronchodilator - oral - self.consumables_used_in_hsi['Oral_Brochodilator'] = { - get_item_code(item='Salbutamol, syrup, 2 mg/5 ml'): 1, - get_item_code(item='Salbutamol, tablet, 4 mg'): 1 - } def end_episode(self, person_id): """End the episode infection for a person (i.e. reset all properties to show no current infection or diff --git a/src/tlo/methods/diarrhoea.py b/src/tlo/methods/diarrhoea.py index e3998c9ba0..1877e0727e 100644 --- a/src/tlo/methods/diarrhoea.py +++ b/src/tlo/methods/diarrhoea.py @@ -664,10 +664,10 @@ def look_up_consumables(self): # For weight based treatment for children under five, we've averaged the median weight for each for years # 0-5 as 12kg. - # So for cipro/para - 10mg/kg 12 hrly for 7 days = ((10*12)*2) * 7 (same dose reccomended) + # So for cipro/para - 10mg/kg 12 hrly for 7 days = ((10*12)*2) * 7 (same dose in mg reccomended) self.consumables_used_in_hsi['Antibiotics_for_Dysentery'] = \ {ic('Ciprofloxacin 250mg_100_CMST'): 1680, - ic("Paracetamol syrup 120mg/5ml_0.0119047619047619_CMST"): 1680} + ic("Paracetamol syrup 120mg/5ml_0.0119047619047619_CMST"): 70} # 24mg/ml so 1680/24 = 70ml per dose def do_treatment(self, person_id, hsi_event): """Method called by the HSI that enacts decisions about a treatment and its effect for diarrhoea caused by a @@ -970,7 +970,7 @@ def do_at_generic_first_appt( self.rng.rand() < self.parameters["prob_hospitalization_on_danger_signs"] ) hsi_event_class = ( - HSI_Diarrhoea_Treatment_Inpatient if is_inpatient else + HSI_Diarrhoea_Treatment_Inpatient if is_inpatient else HSI_Diarrhoea_Treatment_Outpatient ) event = hsi_event_class(person_id=patient_id, module=self) From 7625c77b49a41eda461b87345b01a0d71d34a599 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Mon, 20 May 2024 19:00:23 +0100 Subject: [PATCH 35/59] co: get item codes of consumables from item names and define number of units per case in the module (using new chosen units) --- src/tlo/methods/contraception.py | 89 +++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 12 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index 9ddbc6aac9..4f51c80293 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -645,24 +645,89 @@ def select_contraceptive_following_birth(self, mother_id, mother_age): self.schedule_batch_of_contraceptive_changes(ids=[mother_id], old=['not_using'], new=[new_contraceptive]) def get_item_code_for_each_contraceptive(self): - """Get the item_code for each contraceptive and for contraceptive initiation.""" + """Get the item_code and numbers of units per case for each contraceptive and for contraceptive initiation.""" # TODO: update with optional items (currently all considered essential) - get_items_from_pkg = self.sim.modules['HealthSystem'].get_item_codes_from_package_name + # ### Get item codes and number of units per case from package name + # get_items_from_pkg = self.sim.modules['HealthSystem'].get_item_codes_from_package_name + + # _cons_codes = dict() + # # items for each method that requires an HSI to switch to + # _cons_codes['pill'] = get_items_from_pkg('Pill') + # _cons_codes['male_condom'] = get_items_from_pkg('Male condom') + # _cons_codes['other_modern'] = get_items_from_pkg('Female Condom') + # # NB. The consumable female condom is used for the contraceptive state of "other_modern method" + # _cons_codes['IUD'] = get_items_from_pkg('IUD') + # _cons_codes['injections'] = get_items_from_pkg('Injectable') + # _cons_codes['implant'] = get_items_from_pkg('Implant') + # _cons_codes['female_sterilization'] = get_items_from_pkg('Female sterilization') + # assert set(_cons_codes.keys()) == set(self.states_that_may_require_HSI_to_switch_to) + # # items used when initiating a modern reliable method after not using or switching from non-reliable method + # _cons_codes['co_initiation'] = get_items_from_pkg('Contraception initiation') + + # ### Get item codes from item names and define number of units per case here + get_item_code = self.sim.modules['HealthSystem'].get_item_code_from_item_name _cons_codes = dict() - # items for each method that requires an HSI to switch to - _cons_codes['pill'] = get_items_from_pkg('Pill') - _cons_codes['male_condom'] = get_items_from_pkg('Male condom') - _cons_codes['other_modern'] = get_items_from_pkg('Female Condom') - # NB. The consumable female condom is used for the contraceptive state of "other_modern method" - _cons_codes['IUD'] = get_items_from_pkg('IUD') - _cons_codes['injections'] = get_items_from_pkg('Injectable') - _cons_codes['implant'] = get_items_from_pkg('Implant') - _cons_codes['female_sterilization'] = get_items_from_pkg('Female sterilization') + # # items for each method that requires an HSI to switch to + # TODO: @TimH Pills are alternatives, we weight their use by the probabilities (as approximation of use in 80:20 + # cases, for each case 0.8 and 0.2 proportion of units is used). Is that okay, or do we want to choose for each + # case only one type of pills? Total usage should be approximately same. + # TODO: @Sakshi what are the numbers of pills in monthly packets for both following items? + _cons_codes['pill'] =\ + {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 28*3.75*0.2, # progesterone-only pills used in 20% cases + get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 21*3.75*0.8 + # combined pills used in other 80% cases + } + _cons_codes['male_condom'] =\ + {get_item_code("Condom, male"): 30} + _cons_codes['other_modern'] =\ + {get_item_code("Female Condom_Each_CMST"): 30} + _cons_codes['IUD'] =\ + {get_item_code("Glove disposable powdered latex medium_100_CMST"): 2, + get_item_code("IUD, Copper T-380A"): 1} + # TODO: originally used "Medroxyprogesterone acetate injection 150mg/mL, 1mL vial with 2ml syringe with 22g 0.7 + # X 25mm needle_each_CMST", which is not within the RF_Costing anymore, does it mean we need to add a syringe + # and a needle? + _cons_codes['injections'] = \ + {get_item_code("Depot-Medroxyprogesterone Acetate 150 mg - 3 monthly"): 1, + get_item_code("Glove disposable powdered latex medium_100_CMST"): 1, + get_item_code("Water for injection, 10ml_Each_CMST"): 1, + get_item_code("Povidone iodine, solution, 10 %, 5 ml per injection"): 5, + get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} + # TODO: trocar may be reusable (we used 0.1 units, indicating 10 uses on average) - need to find out for what + # kind of trocar (reusable or not) we have the cost + # Jadelle & Implanon are alternatives, we weight their use by the probabilities (as approximation of use in + # 50:50 cases, for each case 0.5 and 0.5 proportion of units is used) + # TODO: @TimH Is that okay, or do we want to choose for each case only one type of implant? Total usage should + # be approximately same. + # TODO: The chosen unit for Jadelle is '1 implant', does it cover both rods? + _cons_codes['implant'] =\ + {get_item_code("Glove disposable powdered latex medium_100_CMST"): 3, + get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 2, + get_item_code("Povidone iodine, solution, 10 %, 5 ml per injection"): 1*5, # unit: 1 ml + get_item_code("Syringe, needle + swab"): 2, + get_item_code("Trocar"): 1, + get_item_code("Needle suture intestinal round bodied ½ circle trocar_6_CMST"): 1, + get_item_code("Jadelle (implant), box of 2_CMST"): 1*0.5, # implant used in 50% cases + get_item_code("Implanon (Etonogestrel 68 mg)"): 1*0.5, # implant used in other 50% cases + get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} + _cons_codes['female_sterilization'] =\ + {get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 1, + get_item_code("Atropine sulphate 600 micrograms/ml, 1ml_each_CMST"): 0.5, # used only in 50% cases + get_item_code("Diazepam, injection, 5 mg/ml, in 2 ml ampoule"): 1, + get_item_code("Syringe, autodestruct, 5ml, disposable, hypoluer with 21g needle_each_CMST"): 3, + get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 2, + get_item_code("Needle, suture, assorted sizes, round body"): 3, + get_item_code("Suture, catgut, chromic, 0, 150 cm"): 3, + get_item_code("Tape, adhesive, 2.5 cm wide, zinc oxide, 5 m roll"): 125, # unit: 1 cm long (2.5 cm wide) + get_item_code("Glove surgeon's size 7 sterile_2_CMST"): 2, + get_item_code("Paracetamol, tablet, 500 mg"): 8*500, # unit: 1 mg + get_item_code("Povidone iodine, solution, 10 %, 5 ml per injection"): 2*5, # unit: 1 ml + get_item_code("Cotton wool, 500g_1_CMST"): 100} # unit: 1 g assert set(_cons_codes.keys()) == set(self.states_that_may_require_HSI_to_switch_to) # items used when initiating a modern reliable method after not using or switching from non-reliable method - _cons_codes['co_initiation'] = get_items_from_pkg('Contraception initiation') + _cons_codes['co_initiation'] = {get_item_code('Pregnancy slide test kit_100_CMST'): 1} return _cons_codes From dc0b8ac8fca9f86a850fc9d2a264da21a481f94a Mon Sep 17 00:00:00 2001 From: sm2511 Date: Tue, 21 May 2024 17:35:51 +0100 Subject: [PATCH 36/59] Add cystoscope, endoscope and prostate specific antigen test - add three consumables to `ResourceFile_Consumables_Items_and_Packages.csv` using the `generate_consumables_item_codes_and_packages.py` script - This is a replication of commit ff4d072 from PR #1341 --- ...rceFile_Consumables_Items_and_Packages.csv | 4 +-- ...ate_consumables_item_codes_and_packages.py | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv index e5e17d740c..0ee403abb0 100644 --- a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv +++ b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a188114a407bb28dc663a41a2854cb9d75c207dbb0809ff3ce8c1f88eca378aa -size 249189 +oid sha256:4106c2e3ae068d40b115857885b673bec3e1114be5183c0a4ae0366560e2a5c9 +size 249391 diff --git a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py index 3e5b742a3e..7ca04f763f 100644 --- a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py +++ b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py @@ -342,6 +342,41 @@ def add_record(df: pd.DataFrame, record: Dict): }, ) +cons = add_record( + cons, + { + 'Intervention_Cat': "Added by SM (Recommended by EJ)", + 'Intervention_Pkg': "Misc", + 'Intervention_Pkg_Code': -99, + 'Items': "Cystoscope", + 'Item_Code': 285, + 'Expected_Units_Per_Case': 1.0, + 'Unit_Cost': np.nan}, +) + +cons = add_record( + cons,{ + 'Intervention_Cat': "Added by SM (Recommended by EJ)", + 'Intervention_Pkg': "Misc", + 'Intervention_Pkg_Code': -99, + 'Items': "Endoscope", + 'Item_Code': 280, + 'Expected_Units_Per_Case': 1.0, + 'Unit_Cost': np.nan}, +) + +cons = add_record( + cons,{ + 'Intervention_Cat': "Added by SM (Recommended by EJ)", + 'Intervention_Pkg': "Misc", + 'Intervention_Pkg_Code': -99, + 'Items': "Prostate specific antigen test", + 'Item_Code': 281, + 'Expected_Units_Per_Case': 1.0, + 'Unit_Cost': np.nan}, +) + + # -------------- # -------------- # -------------- From 4600b19c592c500941c6d4e6fe93c9829aafd9bb Mon Sep 17 00:00:00 2001 From: sm2511 Date: Tue, 5 Mar 2024 15:38:36 +0000 Subject: [PATCH 37/59] co: alternative consumables chosen by probs --- src/tlo/methods/contraception.py | 79 +++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index 4f51c80293..5e3f681b72 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -155,6 +155,7 @@ def __init__(self, name=None, resourcefilepath=None, use_healthsystem=True, run_ self.processed_params = dict() # (Will store the processed data for rates/probabilities of outcomes). self.cons_codes = dict() # (Will store the consumables codes for use in the HSI) + self.cons_alternatives_probs = dict() # (Will store the probabilities of use for consumable alternatives) self.rng2 = None # (Will be a second random number generator, used for things to do with scheduling HSI) self._women_ids_sterilized_below30 = set() # The ids of women who had female sterilization initiated when they @@ -257,9 +258,10 @@ def initialise_simulation(self, sim): # Schedule first occurrences of Contraception Poll to occur at the beginning of the simulation sim.schedule_event(ContraceptionPoll(self, run_update_contraceptive=self.run_update_contraceptive), sim.date) - # Retrieve the consumables codes for the consumables used + # Retrieve the consumables codes for the consumables used and probabilities for alternatives if self.use_healthsystem: - self.cons_codes = self.get_item_code_for_each_contraceptive() + self.cons_codes, self.cons_alternatives_probs =\ + self.get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives() # Create second random number generator self.rng2 = np.random.RandomState(self.rng.randint(2 ** 31 - 1)) @@ -644,11 +646,13 @@ def select_contraceptive_following_birth(self, mother_id, mother_age): # Do the change in contraceptive self.schedule_batch_of_contraceptive_changes(ids=[mother_id], old=['not_using'], new=[new_contraceptive]) - def get_item_code_for_each_contraceptive(self): - """Get the item_code and numbers of units per case for each contraceptive and for contraceptive initiation.""" + def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): + """Get the item_code and numbers of units per case for each contraceptive and for contraceptive initiation. + Save the probs for consumable alternatives.""" # TODO: update with optional items (currently all considered essential) # ### Get item codes and number of units per case from package name + # (note: this version does not deal with consumable alternatives) # get_items_from_pkg = self.sim.modules['HealthSystem'].get_item_codes_from_package_name # _cons_codes = dict() @@ -669,16 +673,19 @@ def get_item_code_for_each_contraceptive(self): get_item_code = self.sim.modules['HealthSystem'].get_item_code_from_item_name _cons_codes = dict() + _cons_alternatives_probs = dict() # # items for each method that requires an HSI to switch to - # TODO: @TimH Pills are alternatives, we weight their use by the probabilities (as approximation of use in 80:20 - # cases, for each case 0.8 and 0.2 proportion of units is used). Is that okay, or do we want to choose for each - # case only one type of pills? Total usage should be approximately same. - # TODO: @Sakshi what are the numbers of pills in monthly packets for both following items? + # TODO: to find from Emi - What are the numbers of pills in monthly packets for both following items? _cons_codes['pill'] =\ - {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 28*3.75*0.2, # progesterone-only pills used in 20% cases - get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 21*3.75*0.8 - # combined pills used in other 80% cases + {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 28*3.75, + # (alternative) progesterone-only pills used in other 20% cases (see _cons_alternatives_probs) + get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 21*3.75 + # combined pills used in 80% cases (see _cons_alternatives_probs) } + # Pills are alternatives, type chosen according to probabilities when administrated. + _cons_alternatives_probs['pill'] =\ + {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 0.2, + get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 0.8} _cons_codes['male_condom'] =\ {get_item_code("Condom, male"): 30} _cons_codes['other_modern'] =\ @@ -697,11 +704,7 @@ def get_item_code_for_each_contraceptive(self): get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} # TODO: trocar may be reusable (we used 0.1 units, indicating 10 uses on average) - need to find out for what # kind of trocar (reusable or not) we have the cost - # Jadelle & Implanon are alternatives, we weight their use by the probabilities (as approximation of use in - # 50:50 cases, for each case 0.5 and 0.5 proportion of units is used) - # TODO: @TimH Is that okay, or do we want to choose for each case only one type of implant? Total usage should - # be approximately same. - # TODO: The chosen unit for Jadelle is '1 implant', does it cover both rods? + # TODO: @Sakshi The chosen unit for Jadelle is '1 implant', does it cover both rods? _cons_codes['implant'] =\ {get_item_code("Glove disposable powdered latex medium_100_CMST"): 3, get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 2, @@ -709,12 +712,18 @@ def get_item_code_for_each_contraceptive(self): get_item_code("Syringe, needle + swab"): 2, get_item_code("Trocar"): 1, get_item_code("Needle suture intestinal round bodied ½ circle trocar_6_CMST"): 1, - get_item_code("Jadelle (implant), box of 2_CMST"): 1*0.5, # implant used in 50% cases - get_item_code("Implanon (Etonogestrel 68 mg)"): 1*0.5, # implant used in other 50% cases + get_item_code("Jadelle (implant), box of 2_CMST"): 1, # implant used in 50% cases + get_item_code("Implanon (Etonogestrel 68 mg)"): 1, # alternative implant used in other 50% cases + # (see _cons_alternatives_probs) get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} + # Implants are alternatives, type chosen according to probabilities when administrated. + _cons_alternatives_probs['implant'] = \ + {get_item_code("Jadelle (implant), box of 2_CMST"): 0.5, + get_item_code("Implanon (Etonogestrel 68 mg)"): 0.5} _cons_codes['female_sterilization'] =\ {get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 1, - get_item_code("Atropine sulphate 600 micrograms/ml, 1ml_each_CMST"): 0.5, # used only in 50% cases + get_item_code("Atropine sulphate 600 micrograms/ml, 1ml_each_CMST"): 1, # used only in 50% cases + # (see _cons_alternatives_probs) get_item_code("Diazepam, injection, 5 mg/ml, in 2 ml ampoule"): 1, get_item_code("Syringe, autodestruct, 5ml, disposable, hypoluer with 21g needle_each_CMST"): 3, get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 2, @@ -725,11 +734,23 @@ def get_item_code_for_each_contraceptive(self): get_item_code("Paracetamol, tablet, 500 mg"): 8*500, # unit: 1 mg get_item_code("Povidone iodine, solution, 10 %, 5 ml per injection"): 2*5, # unit: 1 ml get_item_code("Cotton wool, 500g_1_CMST"): 100} # unit: 1 g + # Atropine is used only in some cases + _cons_alternatives_probs['female_sterilization'] = \ + {-99: 0.5, # no alternative used + get_item_code("Atropine sulphate 600 micrograms/ml, 1ml_each_CMST"): 0.5, + } + + # Order the item codes for each method + for method in _cons_codes: + _cons_codes[method] = dict(sorted(_cons_codes[method].items())) + if method in _cons_alternatives_probs: + _cons_alternatives_probs[method] = dict(sorted(_cons_alternatives_probs[method].items())) + assert set(_cons_codes.keys()) == set(self.states_that_may_require_HSI_to_switch_to) # items used when initiating a modern reliable method after not using or switching from non-reliable method _cons_codes['co_initiation'] = {get_item_code('Pregnancy slide test kit_100_CMST'): 1} - return _cons_codes + return _cons_codes, _cons_alternatives_probs def schedule_batch_of_contraceptive_changes(self, ids, old, new): """Enact the change in contraception, either through editing properties instantaneously or by scheduling HSI. @@ -1211,7 +1232,23 @@ def apply(self, person_id, squeeze_factor): # Determine essential and optional items # TODO: we don't distinguish essential X optional for contraception methods yet, will need to update once we do - items_essential = self.module.cons_codes[self.new_contraceptive] + if self.new_contraceptive in self.module.cons_alternatives_probs: + # administrate one of the alternative consumables (item code -99 means, no alternative used) + alternatives = list(self.module.cons_alternatives_probs[self.new_contraceptive].keys()) + probs = list(self.module.cons_alternatives_probs[self.new_contraceptive].values()) + alternative_administrated = self.module.rng.choice(alternatives, p=probs) + items_essential = {key: self.module.cons_codes[self.new_contraceptive][key] + for key in [alternative_administrated] if key != -99} + + if self.module.cons_codes[self.new_contraceptive].keys() - alternatives: + # administrate all other consumables + items_essential.update({key: value + for key, value in self.module.cons_codes[self.new_contraceptive].items() + if key not in alternatives}) + + else: + items_essential = self.module.cons_codes[self.new_contraceptive] + items_optional = {} # Record use of consumables and default the person to "not_using" if the consumable is not available. # If initiating use of a modern contraceptive method except condoms (after not using any or using non-modern From 48401d82dc056bf3f4b5aa9016f6e7bbaa7ea0cc Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Wed, 29 May 2024 14:46:26 +0100 Subject: [PATCH 38/59] co: 21 tablets per packet for both types of pills (informed by Emi) --- src/tlo/methods/contraception.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index 5e3f681b72..a86f395496 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -675,9 +675,8 @@ def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): _cons_codes = dict() _cons_alternatives_probs = dict() # # items for each method that requires an HSI to switch to - # TODO: to find from Emi - What are the numbers of pills in monthly packets for both following items? _cons_codes['pill'] =\ - {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 28*3.75, + {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 21*3.75, # (alternative) progesterone-only pills used in other 20% cases (see _cons_alternatives_probs) get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 21*3.75 # combined pills used in 80% cases (see _cons_alternatives_probs) From 534b9d8206b2fb40606c62f5cff8a8652bef7b25 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Wed, 29 May 2024 14:58:58 +0100 Subject: [PATCH 39/59] co: update TODOs --- src/tlo/methods/contraception.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index a86f395496..bc12d03fd6 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -701,9 +701,7 @@ def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): get_item_code("Water for injection, 10ml_Each_CMST"): 1, get_item_code("Povidone iodine, solution, 10 %, 5 ml per injection"): 5, get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} - # TODO: trocar may be reusable (we used 0.1 units, indicating 10 uses on average) - need to find out for what - # kind of trocar (reusable or not) we have the cost - # TODO: @Sakshi The chosen unit for Jadelle is '1 implant', does it cover both rods? + # TODO: @Sakshi - update the unit to 1 use _cons_codes['implant'] =\ {get_item_code("Glove disposable powdered latex medium_100_CMST"): 3, get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 2, From 275dc454e786f3e89300bf2341193d0e032366fd Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 00:03:02 +0100 Subject: [PATCH 40/59] cancer_cons: consumables updated and required units per case defined (as nmbs of chosen units) --- src/tlo/methods/cancer_consumables.py | 108 +++++++++++++------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/tlo/methods/cancer_consumables.py b/src/tlo/methods/cancer_consumables.py index 16a6f94f65..b72f86b7b9 100644 --- a/src/tlo/methods/cancer_consumables.py +++ b/src/tlo/methods/cancer_consumables.py @@ -6,91 +6,91 @@ from tlo import Module -def get_consumable_item_codes_cancers(cancer_module: Module) -> Dict[str, int]: +def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, int]: """ Returns dict the relevant item_codes for the consumables across the five cancer modules. This is intended to prevent repetition within module code. """ - def get_list_of_items(item_list): - item_lookup_fn = cancer_module.sim.modules['HealthSystem'].get_item_code_from_item_name - return list(map(item_lookup_fn, item_list)) + get_item_code = self.sim.modules['HealthSystem'].get_item_code_from_item_name cons_dict = dict() # Add items that are needed for all cancer modules - # todo: @Eva - add syringes, dressing - cons_dict['screening_biopsy_core'] = get_list_of_items(['Biopsy needle']) + cons_dict['screening_biopsy_core'] = \ + {get_item_code("Biopsy needle"): 1} cons_dict['screening_biopsy_optional'] = \ - get_list_of_items(['Specimen container', - 'Lidocaine, injection, 1 % in 20 ml vial', - 'Gauze, absorbent 90cm x 40m_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box']) + {get_item_code("Specimen container"): 1, + get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 1, + get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 30, + get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, + get_item_code("Syringe, needle + swab"): 1} cons_dict['treatment_surgery_core'] = \ - get_list_of_items(['Halothane (fluothane)_250ml_CMST', - 'Scalpel blade size 22 (individually wrapped)_100_CMST']) + {get_item_code("Halothane (fluothane)_250ml_CMST"): 100, + get_item_code("Scalpel blade size 22 (individually wrapped)_100_CMST"): 1} cons_dict['treatment_surgery_optional'] = \ - get_list_of_items(['Sodium chloride, injectable solution, 0,9 %, 500 ml', - 'Paracetamol, tablet, 500 mg', - 'Pethidine, 50 mg/ml, 2 ml ampoule', - 'Suture pack', - 'Gauze, absorbent 90cm x 40m_each_CMST', - 'Cannula iv (winged with injection pot) 18_each_CMST']) + {get_item_code("Sodium chloride, injectable solution, 0,9 %, 500 ml"): 2000, + get_item_code("Paracetamol, tablet, 500 mg"): 8000, + get_item_code("Pethidine, 50 mg/ml, 2 ml ampoule"): 6, + get_item_code("Suture pack"): 1, + get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 30, + get_item_code("Cannula iv (winged with injection pot) 18_each_CMST"): 1} cons_dict['palliation'] = \ - get_list_of_items(['morphine sulphate 10 mg/ml, 1 ml, injection (nt)_10_IDA', - 'Diazepam, injection, 5 mg/ml, in 2 ml ampoule', - # N.B. This is not an exhaustive list of drugs required for palliation - ]) + {get_item_code("morphine sulphate 10 mg/ml, 1 ml, injection (nt)_10_IDA"): 1, + get_item_code("Diazepam, injection, 5 mg/ml, in 2 ml ampoule"): 3, + get_item_code("Syringe, needle + swab"): 4} + # N.B. This is not an exhaustive list of drugs required for palliation - cons_dict['iv_drug_cons'] = \ - get_list_of_items(['Cannula iv (winged with injection pot) 18_each_CMST', - 'Giving set iv administration + needle 15 drops/ml_each_CMST', - 'Disposables gloves, powder free, 100 pieces per box' - ]) - - # Add items that are specific to each cancer module - if 'BreastCancer' == cancer_module.name: - - # TODO: chemotharpy protocols??: TAC(Taxotere, Adriamycin, and Cyclophosphamide), AC (anthracycline and - # cyclophosphamide) +/-Taxane, TC (Taxotere and cyclophosphamide), CMF (cyclophosphamide, methotrexate, - # and fluorouracil), FEC-75 (5-Fluorouracil, Epirubicin, Cyclophosphamide). HER 2 +: Add Trastuzumab + cons_dict['treatment_chemotherapy_core'] = \ + {get_item_code("Cyclophosphamide, 1 g"): 16800} - # only chemotherapy i consumable list which is also in suggested protocol is cyclo - cons_dict['treatment_chemotherapy'] = get_list_of_items(['Cyclophosphamide, 1 g']) + cons_dict['iv_drug_cons'] = \ + {get_item_code("Cannula iv (winged with injection pot) 18_each_CMST"): 1, + get_item_code("Giving set iv administration + needle 15 drops/ml_each_CMST"): 1, + get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, + get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_FF010800_CMST"): 84} - elif 'ProstateCancer' == cancer_module.name: + # Add items that are specific to a particular cancer module + if 'ProstateCancer' == cancer_module.name: - # TODO: Prostate specific antigen test is listed in ResourceFile_Consumables_availability_and_usage but not - # ResourceFile_Consumables_Items_and_Package - # cons_dict['screening_psa_test_core'] = get_list_of_items(['Prostate specific antigen test']) + # TODO: @Sakshi the script to create RF_Consumables_Items_and_Pkgs needs to be re-run + cons_dict['screening_psa_test_core'] = \ + {get_item_code("Prostate specific antigen test"): 1} cons_dict['screening_psa_test_optional'] = \ - get_list_of_items(['Blood collecting tube, 5 ml', - 'Disposables gloves, powder free, 100 pieces per box']) + {get_item_code("Blood collecting tube, 5 ml"): 1, + get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, + get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_FF010800_CMST"): 1} elif 'BladderCancer' == cancer_module.name: # Note: bladder cancer is not in the malawi STG 2023 therefore no details on chemotherapy - # TODO: cytoscope is listed in ResourceFile_Consumables_availability_and_usage but not - # ResourceFile_Consumables_Items_and_Packages - # cons_dict['screening_cystoscopy_core'] = get_list_of_items(['Cytoscope']) + # TODO: @Sakshi the script to create RF_Consumables_Items_and_Pkgs needs to be re-run + cons_dict['screening_cystoscopy_core'] = \ + {get_item_code("Cystoscope"): 1} - cons_dict['screening_cystoscope_optional'] = get_list_of_items(['Specimen container']) + cons_dict['screening_cystoscope_optional'] = \ + {get_item_code("Specimen container"): 1, + get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 1, + get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 30, + get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, + get_item_code("Syringe, needle + swab"): 1} elif 'OesophagealCancer' == cancer_module.name: - # TODO: endoscope is listed in ResourceFile_Consumables_availability_and_usage but not - # ResourceFile_Consumables_Items_and_Packages - # cons_dict['screening_endoscope_core'] = get_list_of_items(['Endoscope']) - - cons_dict['screening_endoscope_optional'] =\ - get_list_of_items(['Specimen container', - 'Gauze, absorbent 90cm x 40m_each_CMST']) + # TODO: @Sakshi the script to create RF_Consumables_Items_and_Pkgs needs to be re-run + cons_dict['screening_endoscope_core'] = \ + {get_item_code("Endoscope"): 1} - cons_dict['treatment_chemotherapy'] = get_list_of_items(['Cisplatin 50mg Injection']) + cons_dict['screening_endoscope_optional'] = \ + {get_item_code("Specimen container"): 1, + get_item_code("Gauze, absorbent 90cm x 40m_each_CMST"): 30, + get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 1, + get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, + get_item_code("Syringe, needle + swab"): 1} return cons_dict From 4b721a7cc20d0f4862f5f73d868962b71abe5e51 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 16:47:54 +0100 Subject: [PATCH 41/59] [no ci] cancer_cons: rm outdated TODOs --- src/tlo/methods/cancer_consumables.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tlo/methods/cancer_consumables.py b/src/tlo/methods/cancer_consumables.py index b72f86b7b9..6c5c9df65b 100644 --- a/src/tlo/methods/cancer_consumables.py +++ b/src/tlo/methods/cancer_consumables.py @@ -57,7 +57,6 @@ def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, # Add items that are specific to a particular cancer module if 'ProstateCancer' == cancer_module.name: - # TODO: @Sakshi the script to create RF_Consumables_Items_and_Pkgs needs to be re-run cons_dict['screening_psa_test_core'] = \ {get_item_code("Prostate specific antigen test"): 1} @@ -69,7 +68,6 @@ def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, elif 'BladderCancer' == cancer_module.name: # Note: bladder cancer is not in the malawi STG 2023 therefore no details on chemotherapy - # TODO: @Sakshi the script to create RF_Consumables_Items_and_Pkgs needs to be re-run cons_dict['screening_cystoscopy_core'] = \ {get_item_code("Cystoscope"): 1} @@ -82,7 +80,6 @@ def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, elif 'OesophagealCancer' == cancer_module.name: - # TODO: @Sakshi the script to create RF_Consumables_Items_and_Pkgs needs to be re-run cons_dict['screening_endoscope_core'] = \ {get_item_code("Endoscope"): 1} From e20b79475a8f3e1566dc6af15543c60ba93822a9 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 17:01:22 +0100 Subject: [PATCH 42/59] [no ci] co: rm resolved TODOs --- src/tlo/methods/contraception.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index bc12d03fd6..68b01071d2 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -692,16 +692,12 @@ def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): _cons_codes['IUD'] =\ {get_item_code("Glove disposable powdered latex medium_100_CMST"): 2, get_item_code("IUD, Copper T-380A"): 1} - # TODO: originally used "Medroxyprogesterone acetate injection 150mg/mL, 1mL vial with 2ml syringe with 22g 0.7 - # X 25mm needle_each_CMST", which is not within the RF_Costing anymore, does it mean we need to add a syringe - # and a needle? _cons_codes['injections'] = \ {get_item_code("Depot-Medroxyprogesterone Acetate 150 mg - 3 monthly"): 1, get_item_code("Glove disposable powdered latex medium_100_CMST"): 1, get_item_code("Water for injection, 10ml_Each_CMST"): 1, get_item_code("Povidone iodine, solution, 10 %, 5 ml per injection"): 5, get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} - # TODO: @Sakshi - update the unit to 1 use _cons_codes['implant'] =\ {get_item_code("Glove disposable powdered latex medium_100_CMST"): 3, get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 2, From b7f61b80024ca631d5d8236bdeca27ae80959c03 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 17:11:19 +0100 Subject: [PATCH 43/59] co: rm TODOs as opened an issue to resolve them (#1384) --- src/tlo/methods/contraception.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index 1d6154f801..95e8a5e84c 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -649,7 +649,6 @@ def select_contraceptive_following_birth(self, mother_id, mother_age): def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): """Get the item_code and numbers of units per case for each contraceptive and for contraceptive initiation. Save the probs for consumable alternatives.""" - # TODO: update with optional items (currently all considered essential) # ### Get item codes and number of units per case from package name # (note: this version does not deal with consumable alternatives) @@ -1224,7 +1223,6 @@ def apply(self, person_id, squeeze_factor): self.sim.population.props.at[person_id, "co_date_of_last_fp_appt"] = self.sim.date # Determine essential and optional items - # TODO: we don't distinguish essential X optional for contraception methods yet, will need to update once we do if self.new_contraceptive in self.module.cons_alternatives_probs: # administrate one of the alternative consumables (item code -99 means, no alternative used) alternatives = list(self.module.cons_alternatives_probs[self.new_contraceptive].keys()) From 5e3d5c045e8451b56dfee833b31e4a041d3e06f9 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 18:05:34 +0100 Subject: [PATCH 44/59] cancers: missing arguments added --- src/tlo/methods/bladder_cancer.py | 2 +- src/tlo/methods/breast_cancer.py | 2 +- src/tlo/methods/oesophagealcancer.py | 2 +- src/tlo/methods/other_adult_cancers.py | 2 +- src/tlo/methods/prostate_cancer.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tlo/methods/bladder_cancer.py b/src/tlo/methods/bladder_cancer.py index 4d81432d04..ba4d2764f3 100644 --- a/src/tlo/methods/bladder_cancer.py +++ b/src/tlo/methods/bladder_cancer.py @@ -378,7 +378,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_bladder_can = get_consumable_item_codes_cancers(self) + self.item_codes_bladder_can = get_consumable_item_codes_cancers(self, self.__module__) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/breast_cancer.py b/src/tlo/methods/breast_cancer.py index 21347c1f98..b1568b077e 100644 --- a/src/tlo/methods/breast_cancer.py +++ b/src/tlo/methods/breast_cancer.py @@ -350,7 +350,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_breast_can = get_consumable_item_codes_cancers(self) + self.item_codes_breast_can = get_consumable_item_codes_cancers(self, self.__module__) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/oesophagealcancer.py b/src/tlo/methods/oesophagealcancer.py index b3a302bcd9..bb57f0ee28 100644 --- a/src/tlo/methods/oesophagealcancer.py +++ b/src/tlo/methods/oesophagealcancer.py @@ -365,7 +365,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_oesophageal_can = get_consumable_item_codes_cancers(self) + self.item_codes_oesophageal_can = get_consumable_item_codes_cancers(self, self.__module__) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/other_adult_cancers.py b/src/tlo/methods/other_adult_cancers.py index 1e8d5c1e22..0d9fe90094 100644 --- a/src/tlo/methods/other_adult_cancers.py +++ b/src/tlo/methods/other_adult_cancers.py @@ -373,7 +373,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_other_can = get_consumable_item_codes_cancers(self) + self.item_codes_other_can = get_consumable_item_codes_cancers(self, self.__module__) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/prostate_cancer.py b/src/tlo/methods/prostate_cancer.py index f9520052b1..fc7eef102f 100644 --- a/src/tlo/methods/prostate_cancer.py +++ b/src/tlo/methods/prostate_cancer.py @@ -378,7 +378,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_prostate_can = get_consumable_item_codes_cancers(self) + self.item_codes_prostate_can = get_consumable_item_codes_cancers(self, self.__module__) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately From 108dd72c63a8ed429869e60e43b12a2eba789586 Mon Sep 17 00:00:00 2001 From: sm2511 Date: Thu, 30 May 2024 18:46:22 +0100 Subject: [PATCH 45/59] add availability data cancer consumables - Biopsy needle and Specimen container (This is based on assumptions made in `"05 - Resources/Module-healthsystem/consumables raw files/ResourceFile_hhfa_consumables.xlsx` --- .../ResourceFile_Consumables_availability_small.csv | 4 ++-- .../consumables/ResourceFile_consumables_matched.csv | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv b/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv index 7db58ae153..25249531b2 100644 --- a/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv +++ b/resources/healthsystem/consumables/ResourceFile_Consumables_availability_small.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2261b945069955c025e106116ae167cd8dc167a962d7387b9e808b9683f5fa69 -size 6122712 +oid sha256:c358a643e4def0e574b75f89f83d77f9c3366f668422e005150f4d69ebe8d7a7 +size 6169152 diff --git a/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv b/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv index 73fd80d045..7ab675ecba 100644 --- a/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv +++ b/resources/healthsystem/consumables/ResourceFile_consumables_matched.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8649f9521dfd5bdbf2bc525c7dd0922a32d657fd8f69394bd997d7a595b9576 -size 90430 +oid sha256:b5b0f417681cbdd2489e2f9c6634b2825c32beb9637dc045b56e308c910a102c +size 90569 From 2a6dac49c38586e827d02444f80979359eecaba1 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 18:13:47 +0100 Subject: [PATCH 46/59] Revert "cancers: missing arguments added" This reverts commit 5e3d5c045e8451b56dfee833b31e4a041d3e06f9. --- src/tlo/methods/bladder_cancer.py | 2 +- src/tlo/methods/breast_cancer.py | 2 +- src/tlo/methods/oesophagealcancer.py | 2 +- src/tlo/methods/other_adult_cancers.py | 2 +- src/tlo/methods/prostate_cancer.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tlo/methods/bladder_cancer.py b/src/tlo/methods/bladder_cancer.py index ba4d2764f3..4d81432d04 100644 --- a/src/tlo/methods/bladder_cancer.py +++ b/src/tlo/methods/bladder_cancer.py @@ -378,7 +378,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_bladder_can = get_consumable_item_codes_cancers(self, self.__module__) + self.item_codes_bladder_can = get_consumable_item_codes_cancers(self) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/breast_cancer.py b/src/tlo/methods/breast_cancer.py index b1568b077e..21347c1f98 100644 --- a/src/tlo/methods/breast_cancer.py +++ b/src/tlo/methods/breast_cancer.py @@ -350,7 +350,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_breast_can = get_consumable_item_codes_cancers(self, self.__module__) + self.item_codes_breast_can = get_consumable_item_codes_cancers(self) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/oesophagealcancer.py b/src/tlo/methods/oesophagealcancer.py index bb57f0ee28..b3a302bcd9 100644 --- a/src/tlo/methods/oesophagealcancer.py +++ b/src/tlo/methods/oesophagealcancer.py @@ -365,7 +365,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_oesophageal_can = get_consumable_item_codes_cancers(self, self.__module__) + self.item_codes_oesophageal_can = get_consumable_item_codes_cancers(self) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/other_adult_cancers.py b/src/tlo/methods/other_adult_cancers.py index 0d9fe90094..1e8d5c1e22 100644 --- a/src/tlo/methods/other_adult_cancers.py +++ b/src/tlo/methods/other_adult_cancers.py @@ -373,7 +373,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_other_can = get_consumable_item_codes_cancers(self, self.__module__) + self.item_codes_other_can = get_consumable_item_codes_cancers(self) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately diff --git a/src/tlo/methods/prostate_cancer.py b/src/tlo/methods/prostate_cancer.py index fc7eef102f..f9520052b1 100644 --- a/src/tlo/methods/prostate_cancer.py +++ b/src/tlo/methods/prostate_cancer.py @@ -378,7 +378,7 @@ def initialise_simulation(self, sim): """ # We call the following function to store the required consumables for the simulation run within the appropriate # dictionary - self.item_codes_prostate_can = get_consumable_item_codes_cancers(self, self.__module__) + self.item_codes_prostate_can = get_consumable_item_codes_cancers(self) # ----- SCHEDULE LOGGING EVENTS ----- # Schedule logging event to happen immediately From 4a1a4c2297ac3f1c21fe2377818f61d5e3bae402 Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 19:06:26 +0100 Subject: [PATCH 47/59] cancer_cons: rm get_consumable_item_codes_cancers() argument --- src/tlo/methods/cancer_consumables.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/tlo/methods/cancer_consumables.py b/src/tlo/methods/cancer_consumables.py index 6c5c9df65b..b72274cbb9 100644 --- a/src/tlo/methods/cancer_consumables.py +++ b/src/tlo/methods/cancer_consumables.py @@ -3,10 +3,8 @@ """ from typing import Dict -from tlo import Module - -def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, int]: +def get_consumable_item_codes_cancers(self) -> Dict[str, int]: """ Returns dict the relevant item_codes for the consumables across the five cancer modules. This is intended to prevent repetition within module code. @@ -55,7 +53,7 @@ def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_FF010800_CMST"): 84} # Add items that are specific to a particular cancer module - if 'ProstateCancer' == cancer_module.name: + if 'ProstateCancer' == self.name: cons_dict['screening_psa_test_core'] = \ {get_item_code("Prostate specific antigen test"): 1} @@ -65,7 +63,7 @@ def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_FF010800_CMST"): 1} - elif 'BladderCancer' == cancer_module.name: + elif 'BladderCancer' == self.name: # Note: bladder cancer is not in the malawi STG 2023 therefore no details on chemotherapy cons_dict['screening_cystoscopy_core'] = \ @@ -78,7 +76,7 @@ def get_consumable_item_codes_cancers(self, cancer_module: Module) -> Dict[str, get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, get_item_code("Syringe, needle + swab"): 1} - elif 'OesophagealCancer' == cancer_module.name: + elif 'OesophagealCancer' == self.name: cons_dict['screening_endoscope_core'] = \ {get_item_code("Endoscope"): 1} From 46ab68db1ed468b2c380e1a2bd0b8d6a32891c3f Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Thu, 30 May 2024 19:06:47 +0100 Subject: [PATCH 48/59] cancer_cons: names corrections -- item & consumables set --- src/tlo/methods/cancer_consumables.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tlo/methods/cancer_consumables.py b/src/tlo/methods/cancer_consumables.py index b72274cbb9..2649626b2f 100644 --- a/src/tlo/methods/cancer_consumables.py +++ b/src/tlo/methods/cancer_consumables.py @@ -43,14 +43,14 @@ def get_consumable_item_codes_cancers(self) -> Dict[str, int]: get_item_code("Syringe, needle + swab"): 4} # N.B. This is not an exhaustive list of drugs required for palliation - cons_dict['treatment_chemotherapy_core'] = \ + cons_dict['treatment_chemotherapy'] = \ {get_item_code("Cyclophosphamide, 1 g"): 16800} cons_dict['iv_drug_cons'] = \ {get_item_code("Cannula iv (winged with injection pot) 18_each_CMST"): 1, get_item_code("Giving set iv administration + needle 15 drops/ml_each_CMST"): 1, get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, - get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_FF010800_CMST"): 84} + get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 84} # Add items that are specific to a particular cancer module if 'ProstateCancer' == self.name: @@ -61,7 +61,7 @@ def get_consumable_item_codes_cancers(self) -> Dict[str, int]: cons_dict['screening_psa_test_optional'] = \ {get_item_code("Blood collecting tube, 5 ml"): 1, get_item_code("Disposables gloves, powder free, 100 pieces per box"): 1, - get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_FF010800_CMST"): 1} + get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} elif 'BladderCancer' == self.name: # Note: bladder cancer is not in the malawi STG 2023 therefore no details on chemotherapy From b6a9c945e54194db35610e7be94df4f673d9fb37 Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Fri, 31 May 2024 14:42:42 +0100 Subject: [PATCH 49/59] add depn to health system to copd --- src/tlo/methods/copd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tlo/methods/copd.py b/src/tlo/methods/copd.py index 394f825e7b..a39e263280 100644 --- a/src/tlo/methods/copd.py +++ b/src/tlo/methods/copd.py @@ -33,7 +33,7 @@ class Copd(Module): """The module responsible for determining Chronic Obstructive Pulmonary Diseases (COPD) status and outcomes. and initialises parameters and properties associated with COPD plus functions and events related to COPD.""" - INIT_DEPENDENCIES = {'SymptomManager', 'Lifestyle'} + INIT_DEPENDENCIES = {'SymptomManager', 'Lifestyle', 'HealthSystem'} ADDITIONAL_DEPENDENCIES = set() METADATA = { From db6ef66c86e7421af84d5185b1dfc09b117f98c7 Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Fri, 31 May 2024 14:54:20 +0100 Subject: [PATCH 50/59] remove packing with dict --- src/tlo/methods/tb.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tlo/methods/tb.py b/src/tlo/methods/tb.py index 61bd87e4b7..70d3f3e5ab 100644 --- a/src/tlo/methods/tb.py +++ b/src/tlo/methods/tb.py @@ -769,8 +769,8 @@ def get_consumables_for_dx_and_tx(self): hs.get_item_code_from_item_name("Isoniazid/Pyridoxine, tablet 300 mg") # 3hp - self.item_codes_for_consumables_required['tb_3HP'] = { - hs.get_item_code_from_item_name("Isoniazid/Rifapentine"): 1} + self.item_codes_for_consumables_required['tb_3HP'] = \ + hs.get_item_code_from_item_name("Isoniazid/Rifapentine") def initialise_population(self, population): @@ -2400,7 +2400,8 @@ def apply(self, person_id, squeeze_factor): else: # 12 weeks dispensation, once weekly drugs_available = self.get_consumables( - item_codes={self.module.item_codes_for_consumables_required["tb_3HP"]: 12}) + item_codes={self.module.item_codes_for_consumables_required["tb_3HP"]: 12} + ) # if available, schedule IPT decision if drugs_available: From 9aeff859cae52ecafe88b7e650029959cdfdbd18 Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Fri, 31 May 2024 15:30:38 +0100 Subject: [PATCH 51/59] refactoring and adding todo --- tests/test_contraception.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_contraception.py b/tests/test_contraception.py index 388b834393..93cf79289f 100644 --- a/tests/test_contraception.py +++ b/tests/test_contraception.py @@ -824,7 +824,9 @@ def test_contraception_coverage_with_use_healthsystem(tmpdir, seed): def report_availability_of_consumables(): """Helper function to find the availability of consumables used in the Contraception module.""" sim = run_sim(tmpdir, seed, run=False, consumables_available='default') - item_codes = sim.modules['Contraception'].get_item_code_for_each_contraceptive() + item_codes, _ = sim.modules['Contraception'].get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives() + # todo does this test to be rewritten to respect logic of alternative items?????? + # do not check the `co_initiation` items, only contraception methods items del item_codes['co_initiation'] cons = sim.modules['HealthSystem'].consumables._prob_item_codes_available From 4228adfade650a13766763b924bbddd3b1f516c5 Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Fri, 31 May 2024 16:20:36 +0100 Subject: [PATCH 52/59] fix misnamed tb consumable --- src/tlo/methods/tb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tlo/methods/tb.py b/src/tlo/methods/tb.py index 70d3f3e5ab..053469a253 100644 --- a/src/tlo/methods/tb.py +++ b/src/tlo/methods/tb.py @@ -765,7 +765,7 @@ def get_consumables_for_dx_and_tx(self): hs.get_item_code_from_item_name("Treatment: second-line drugs") # ipt - self.item_codes_for_consumables_required['tb_isoniazid'] = \ + self.item_codes_for_consumables_required['tb_ipt'] = \ hs.get_item_code_from_item_name("Isoniazid/Pyridoxine, tablet 300 mg") # 3hp From a63e7312eb2ee80aa068df0af0cde6beaddc760a Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Fri, 31 May 2024 16:29:36 +0100 Subject: [PATCH 53/59] roll back file added by accident --- .../analysis_scenarios_draws.json | 245 ------------------ 1 file changed, 245 deletions(-) delete mode 100644 src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json diff --git a/src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json b/src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json deleted file mode 100644 index f456b70bd1..0000000000 --- a/src/scripts/malaria/impact_analysis/analysis_scenarios_draws.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "scenario_script_path": "src/scripts/malaria/impact_analysis/analysis_scenarios.py", - "scenario_seed": 0, - "runs_per_draw": 5, - "draws": [ - { - "draw_number": 0, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "*" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 0 - } - } - }, - { - "draw_number": 1, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "*" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 1 - } - } - }, - { - "draw_number": 2, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "*" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 2 - } - } - }, - { - "draw_number": 3, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "*" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 3 - } - } - }, - { - "draw_number": 4, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "*" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 5 - } - } - }, - { - "draw_number": 5, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "Alri_*", - "AntenatalCare_*", - "BladderCancer_*", - "BreastCancer_*", - "CardioMetabolicDisorders_*", - "Contraception_*", - "Copd_*", - "DeliveryCare_*", - "Depression_*", - "Diarrhoea_*", - "Epi_*", - "Epilepsy_*", - "FirstAttendance_*", - "Malaria_*", - "Measles_*", - "OesophagealCancer_*", - "OtherAdultCancer_*", - "PostnatalCare_*", - "ProstateCancer_*", - "Rti_*", - "Schisto_*", - "Tb_*", - "Undernutrition_*", - "Hiv_PalliativeCare" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 0 - } - } - }, - { - "draw_number": 6, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "Alri_*", - "AntenatalCare_*", - "BladderCancer_*", - "BreastCancer_*", - "CardioMetabolicDisorders_*", - "Contraception_*", - "Copd_*", - "DeliveryCare_*", - "Depression_*", - "Diarrhoea_*", - "Epi_*", - "Epilepsy_*", - "FirstAttendance_*", - "Hiv_*", - "Malaria_*", - "Measles_*", - "OesophagealCancer_*", - "OtherAdultCancer_*", - "PostnatalCare_*", - "ProstateCancer_*", - "Rti_*", - "Schisto_*", - "Undernutrition_*", - "Tb_PalliativeCare" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 0 - } - } - }, - { - "draw_number": 7, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "Alri_*", - "AntenatalCare_*", - "BladderCancer_*", - "BreastCancer_*", - "CardioMetabolicDisorders_*", - "Contraception_*", - "Copd_*", - "DeliveryCare_*", - "Depression_*", - "Diarrhoea_*", - "Epi_*", - "Epilepsy_*", - "FirstAttendance_*", - "Hiv_*", - "Measles_*", - "OesophagealCancer_*", - "OtherAdultCancer_*", - "PostnatalCare_*", - "ProstateCancer_*", - "Rti_*", - "Schisto_*", - "Tb_*", - "Undernutrition_*", - "Malaria_Treatment_Complicated" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 3 - } - } - }, - { - "draw_number": 8, - "parameters": { - "HealthSystem": { - "Service_Availability": [ - "Alri_*", - "AntenatalCare_*", - "BladderCancer_*", - "BreastCancer_*", - "CardioMetabolicDisorders_*", - "Contraception_*", - "Copd_*", - "DeliveryCare_*", - "Depression_*", - "Diarrhoea_*", - "Epi_*", - "Epilepsy_*", - "FirstAttendance_*", - "Measles_*", - "OesophagealCancer_*", - "OtherAdultCancer_*", - "PostnatalCare_*", - "ProstateCancer_*", - "Rti_*", - "Schisto_*", - "Undernutrition_*", - "Hiv_PalliativeCare", - "Tb_PalliativeCare", - "Malaria_Treatment_Complicated" - ], - "use_funded_or_actual_staffing": "funded", - "mode_appt_constraints": 1, - "policy_name": "Naive" - }, - "Hiv": { - "scenario": 3 - } - } - } - ], - "commit": "bc91bdca536aace9c51a36b72628d532ef172019", - "github": "https://github.com/UCL/TLOmodel/tree/bc91bdca536aace9c51a36b72628d532ef172019" -} \ No newline at end of file From 55b5e7d47fe2066e301aa8f07c23385344c64e9b Mon Sep 17 00:00:00 2001 From: Eva Janouskova Date: Fri, 31 May 2024 16:38:43 +0100 Subject: [PATCH 54/59] test_co & co: alternatives rolled back --- src/tlo/methods/contraception.py | 90 ++++++-------------------------- tests/test_contraception.py | 3 +- 2 files changed, 18 insertions(+), 75 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index 95e8a5e84c..9e7c60bc1f 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -155,7 +155,6 @@ def __init__(self, name=None, resourcefilepath=None, use_healthsystem=True, run_ self.processed_params = dict() # (Will store the processed data for rates/probabilities of outcomes). self.cons_codes = dict() # (Will store the consumables codes for use in the HSI) - self.cons_alternatives_probs = dict() # (Will store the probabilities of use for consumable alternatives) self.rng2 = None # (Will be a second random number generator, used for things to do with scheduling HSI) self._women_ids_sterilized_below30 = set() # The ids of women who had female sterilization initiated when they @@ -258,10 +257,9 @@ def initialise_simulation(self, sim): # Schedule first occurrences of Contraception Poll to occur at the beginning of the simulation sim.schedule_event(ContraceptionPoll(self, run_update_contraceptive=self.run_update_contraceptive), sim.date) - # Retrieve the consumables codes for the consumables used and probabilities for alternatives + # Retrieve the consumables codes for the consumables used if self.use_healthsystem: - self.cons_codes, self.cons_alternatives_probs =\ - self.get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives() + self.cons_codes = self.get_item_code_for_each_contraceptive() # Create second random number generator self.rng2 = np.random.RandomState(self.rng.randint(2 ** 31 - 1)) @@ -646,44 +644,19 @@ def select_contraceptive_following_birth(self, mother_id, mother_age): # Do the change in contraceptive self.schedule_batch_of_contraceptive_changes(ids=[mother_id], old=['not_using'], new=[new_contraceptive]) - def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): - """Get the item_code and numbers of units per case for each contraceptive and for contraceptive initiation. - Save the probs for consumable alternatives.""" - - # ### Get item codes and number of units per case from package name - # (note: this version does not deal with consumable alternatives) - # get_items_from_pkg = self.sim.modules['HealthSystem'].get_item_codes_from_package_name - - # _cons_codes = dict() - # # items for each method that requires an HSI to switch to - # _cons_codes['pill'] = get_items_from_pkg('Pill') - # _cons_codes['male_condom'] = get_items_from_pkg('Male condom') - # _cons_codes['other_modern'] = get_items_from_pkg('Female Condom') - # # NB. The consumable female condom is used for the contraceptive state of "other_modern method" - # _cons_codes['IUD'] = get_items_from_pkg('IUD') - # _cons_codes['injections'] = get_items_from_pkg('Injectable') - # _cons_codes['implant'] = get_items_from_pkg('Implant') - # _cons_codes['female_sterilization'] = get_items_from_pkg('Female sterilization') - # assert set(_cons_codes.keys()) == set(self.states_that_may_require_HSI_to_switch_to) - # # items used when initiating a modern reliable method after not using or switching from non-reliable method - # _cons_codes['co_initiation'] = get_items_from_pkg('Contraception initiation') + def get_item_code_for_each_contraceptive(self): + """Get the item_code for each contraceptive and for contraceptive initiation.""" # ### Get item codes from item names and define number of units per case here get_item_code = self.sim.modules['HealthSystem'].get_item_code_from_item_name _cons_codes = dict() - _cons_alternatives_probs = dict() # # items for each method that requires an HSI to switch to - _cons_codes['pill'] =\ - {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 21*3.75, - # (alternative) progesterone-only pills used in other 20% cases (see _cons_alternatives_probs) - get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 21*3.75 - # combined pills used in 80% cases (see _cons_alternatives_probs) - } - # Pills are alternatives, type chosen according to probabilities when administrated. - _cons_alternatives_probs['pill'] =\ - {get_item_code("Levonorgestrel 0.0375 mg, cycle"): 0.2, - get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 0.8} + # in 80% cases combined pills administrated + # in other 20% cases same amount of progesterone-only pills ("Levonorgestrel 0.0375 mg, cycle") administrated + # (omitted in here) + _cons_codes['pill'] = \ + {get_item_code("Levonorgestrel 0.15 mg + Ethinyl estradiol 30 mcg (Microgynon), cycle"): 21 * 3.75} _cons_codes['male_condom'] =\ {get_item_code("Condom, male"): 30} _cons_codes['other_modern'] =\ @@ -704,18 +677,15 @@ def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): get_item_code("Syringe, needle + swab"): 2, get_item_code("Trocar"): 1, get_item_code("Needle suture intestinal round bodied ½ circle trocar_6_CMST"): 1, - get_item_code("Jadelle (implant), box of 2_CMST"): 1, # implant used in 50% cases - get_item_code("Implanon (Etonogestrel 68 mg)"): 1, # alternative implant used in other 50% cases - # (see _cons_alternatives_probs) + # in 50% cases Jadelle administrated + # in other 50% cases other type of implant ("Implanon (Etonogestrel 68 mg)") administrated + # (omitted in here) + get_item_code("Jadelle (implant), box of 2_CMST"): 1, get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 1} - # Implants are alternatives, type chosen according to probabilities when administrated. - _cons_alternatives_probs['implant'] = \ - {get_item_code("Jadelle (implant), box of 2_CMST"): 0.5, - get_item_code("Implanon (Etonogestrel 68 mg)"): 0.5} _cons_codes['female_sterilization'] =\ {get_item_code("Lidocaine HCl (in dextrose 7.5%), ampoule 2 ml"): 1, - get_item_code("Atropine sulphate 600 micrograms/ml, 1ml_each_CMST"): 1, # used only in 50% cases - # (see _cons_alternatives_probs) + get_item_code("Atropine sulphate 600 micrograms/ml, 1ml_each_CMST"): 0.5, # 1 unit used only in 50% cases + # approximated by 0.5 unit each time get_item_code("Diazepam, injection, 5 mg/ml, in 2 ml ampoule"): 1, get_item_code("Syringe, autodestruct, 5ml, disposable, hypoluer with 21g needle_each_CMST"): 3, get_item_code("Gauze, swabs 8-ply 10cm x 10cm_100_CMST"): 2, @@ -726,23 +696,12 @@ def get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives(self): get_item_code("Paracetamol, tablet, 500 mg"): 8*500, # unit: 1 mg get_item_code("Povidone iodine, solution, 10 %, 5 ml per injection"): 2*5, # unit: 1 ml get_item_code("Cotton wool, 500g_1_CMST"): 100} # unit: 1 g - # Atropine is used only in some cases - _cons_alternatives_probs['female_sterilization'] = \ - {-99: 0.5, # no alternative used - get_item_code("Atropine sulphate 600 micrograms/ml, 1ml_each_CMST"): 0.5, - } - - # Order the item codes for each method - for method in _cons_codes: - _cons_codes[method] = dict(sorted(_cons_codes[method].items())) - if method in _cons_alternatives_probs: - _cons_alternatives_probs[method] = dict(sorted(_cons_alternatives_probs[method].items())) assert set(_cons_codes.keys()) == set(self.states_that_may_require_HSI_to_switch_to) # items used when initiating a modern reliable method after not using or switching from non-reliable method _cons_codes['co_initiation'] = {get_item_code('Pregnancy slide test kit_100_CMST'): 1} - return _cons_codes, _cons_alternatives_probs + return _cons_codes def schedule_batch_of_contraceptive_changes(self, ids, old, new): """Enact the change in contraception, either through editing properties instantaneously or by scheduling HSI. @@ -1223,22 +1182,7 @@ def apply(self, person_id, squeeze_factor): self.sim.population.props.at[person_id, "co_date_of_last_fp_appt"] = self.sim.date # Determine essential and optional items - if self.new_contraceptive in self.module.cons_alternatives_probs: - # administrate one of the alternative consumables (item code -99 means, no alternative used) - alternatives = list(self.module.cons_alternatives_probs[self.new_contraceptive].keys()) - probs = list(self.module.cons_alternatives_probs[self.new_contraceptive].values()) - alternative_administrated = self.module.rng.choice(alternatives, p=probs) - items_essential = {key: self.module.cons_codes[self.new_contraceptive][key] - for key in [alternative_administrated] if key != -99} - - if self.module.cons_codes[self.new_contraceptive].keys() - alternatives: - # administrate all other consumables - items_essential.update({key: value - for key, value in self.module.cons_codes[self.new_contraceptive].items() - if key not in alternatives}) - - else: - items_essential = self.module.cons_codes[self.new_contraceptive] + items_essential = self.module.cons_codes[self.new_contraceptive] items_optional = {} # Record use of consumables and default the person to "not_using" if the consumable is not available. diff --git a/tests/test_contraception.py b/tests/test_contraception.py index 93cf79289f..7eab9e8330 100644 --- a/tests/test_contraception.py +++ b/tests/test_contraception.py @@ -824,8 +824,7 @@ def test_contraception_coverage_with_use_healthsystem(tmpdir, seed): def report_availability_of_consumables(): """Helper function to find the availability of consumables used in the Contraception module.""" sim = run_sim(tmpdir, seed, run=False, consumables_available='default') - item_codes, _ = sim.modules['Contraception'].get_item_codes_for_each_contraceptive_and_probs_for_cons_alternatives() - # todo does this test to be rewritten to respect logic of alternative items?????? + item_codes, _ = sim.modules['Contraception'].get_item_code_for_each_contraceptive() # do not check the `co_initiation` items, only contraception methods items del item_codes['co_initiation'] From e7e768626a1e139750e9e398756ee97bcc7cfb46 Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Fri, 31 May 2024 16:43:34 +0100 Subject: [PATCH 55/59] roll back second output --- tests/test_contraception.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_contraception.py b/tests/test_contraception.py index 7eab9e8330..8aa8ea7e48 100644 --- a/tests/test_contraception.py +++ b/tests/test_contraception.py @@ -824,7 +824,7 @@ def test_contraception_coverage_with_use_healthsystem(tmpdir, seed): def report_availability_of_consumables(): """Helper function to find the availability of consumables used in the Contraception module.""" sim = run_sim(tmpdir, seed, run=False, consumables_available='default') - item_codes, _ = sim.modules['Contraception'].get_item_code_for_each_contraceptive() + item_codes = sim.modules['Contraception'].get_item_code_for_each_contraceptive() # do not check the `co_initiation` items, only contraception methods items del item_codes['co_initiation'] From cf015e97e4d424824b912f9bd64b9eeac40a493c Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:29:58 +0100 Subject: [PATCH 56/59] simplify _get_cons_group as no longer changing dose by age --- src/tlo/methods/alri.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/tlo/methods/alri.py b/src/tlo/methods/alri.py index 9f5b5e015c..165f53ab4a 100644 --- a/src/tlo/methods/alri.py +++ b/src/tlo/methods/alri.py @@ -2358,11 +2358,7 @@ def _get_cons(self, _arg: Union[str, Tuple[str]]) -> bool: def _get_cons_group(self, item_group_str: str) -> bool: """True if _all_ of a group of consumables (identified by a string) is available.""" if item_group_str is not None: - return self.get_consumables( - item_codes={ - k: v(self._age_exact_years) if isinstance(v, types.LambdaType) else v - for k, v in self.module.consumables_used_in_hsi[item_group_str].items() - }) + return self.get_consumables(self.module.consumables_used_in_hsi[item_group_str]) else: raise ValueError('String for the group of consumables not provided') From e729e84ccabf533a69d6b4268dec0ad763ed45cf Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:32:13 +0100 Subject: [PATCH 57/59] remove todo, now resolved --- src/tlo/methods/cardio_metabolic_disorders.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tlo/methods/cardio_metabolic_disorders.py b/src/tlo/methods/cardio_metabolic_disorders.py index 55bd03a12a..1d5f47ecb9 100644 --- a/src/tlo/methods/cardio_metabolic_disorders.py +++ b/src/tlo/methods/cardio_metabolic_disorders.py @@ -1760,7 +1760,6 @@ def do_for_each_event_to_be_investigated(self, _ev): if self.module.parameters['prob_care_provided_given_seek_emergency_care'] > self.module.rng.random_sample(): # If care is provided.... - # TODO: confirm dose for emergency treatment of MI/STROKE dose = 20 if _ev == 'ever_stroke' else 40 if self.get_consumables( From c31c1182839af0666f41b726f2f00b20b047cefc Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:42:33 +0100 Subject: [PATCH 58/59] linting and removed completed todo --- src/tlo/methods/contraception.py | 1 - src/tlo/methods/rti.py | 3 +-- tests/test_contraception.py | 1 - tests/test_maternal_health_helper_and_analysis_functions.py | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/tlo/methods/contraception.py b/src/tlo/methods/contraception.py index 9e7c60bc1f..580125f7ba 100644 --- a/src/tlo/methods/contraception.py +++ b/src/tlo/methods/contraception.py @@ -1183,7 +1183,6 @@ def apply(self, person_id, squeeze_factor): # Determine essential and optional items items_essential = self.module.cons_codes[self.new_contraceptive] - items_optional = {} # Record use of consumables and default the person to "not_using" if the consumable is not available. # If initiating use of a modern contraceptive method except condoms (after not using any or using non-modern diff --git a/src/tlo/methods/rti.py b/src/tlo/methods/rti.py index a8bd652c76..f591f5aa7b 100644 --- a/src/tlo/methods/rti.py +++ b/src/tlo/methods/rti.py @@ -4056,7 +4056,6 @@ def apply(self, person_id, squeeze_factor): assert df.loc[person_id, 'rt_med_int'], 'person sent here has not been treated' # If they have an open fracture, ask for consumables to treat fracture - # todo: confirm single dose of prophylactic ceftriaxone if open_fracture_counts > 0: self.module.item_codes_for_consumables_required['open_fracture_treatment'] = { get_item_code('Ceftriaxone 1g, PFR_each_CMST'): 2000, @@ -4069,7 +4068,7 @@ def apply(self, person_id, squeeze_factor): p = self.module.parameters prob_open_fracture_contaminated = p['prob_open_fracture_contaminated'] rand_for_contamination = self.module.rng.random_sample(size=1) - # todo: confirm correct dose (below from BNF for surgical prophylaxsis) + # NB: Dose used below from BNF is for surgical prophylaxsis if rand_for_contamination < prob_open_fracture_contaminated: self.module.item_codes_for_consumables_required['open_fracture_treatment'].update( {get_item_code('Metronidazole, injection, 500 mg in 100 ml vial'): 1500} diff --git a/tests/test_contraception.py b/tests/test_contraception.py index 8aa8ea7e48..388b834393 100644 --- a/tests/test_contraception.py +++ b/tests/test_contraception.py @@ -825,7 +825,6 @@ def report_availability_of_consumables(): """Helper function to find the availability of consumables used in the Contraception module.""" sim = run_sim(tmpdir, seed, run=False, consumables_available='default') item_codes = sim.modules['Contraception'].get_item_code_for_each_contraceptive() - # do not check the `co_initiation` items, only contraception methods items del item_codes['co_initiation'] cons = sim.modules['HealthSystem'].consumables._prob_item_codes_available diff --git a/tests/test_maternal_health_helper_and_analysis_functions.py b/tests/test_maternal_health_helper_and_analysis_functions.py index 6d166f8a75..daea95a5e6 100644 --- a/tests/test_maternal_health_helper_and_analysis_functions.py +++ b/tests/test_maternal_health_helper_and_analysis_functions.py @@ -252,7 +252,6 @@ def test_analysis_events_force_availability_of_consumables_when_scheduled_in_anc # Override the availability of the consumables within the health system- set to 0. If analysis was not running no # interventions requiring these consumable would run module = sim.modules['CareOfWomenDuringPregnancy'] - iron = module.item_codes_preg_consumables['iron_folic_acid'] protein = module.item_codes_preg_consumables['balanced_energy_protein'] calcium = module.item_codes_preg_consumables['calcium'] From 98bcc01657c153dedc13f79977e9aeb77f3abb68 Mon Sep 17 00:00:00 2001 From: Tim Hallett <39991060+tbhallett@users.noreply.github.com> Date: Mon, 3 Jun 2024 12:55:01 +0100 Subject: [PATCH 59/59] linting --- src/tlo/methods/alri.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tlo/methods/alri.py b/src/tlo/methods/alri.py index 165f53ab4a..61e9ae848b 100644 --- a/src/tlo/methods/alri.py +++ b/src/tlo/methods/alri.py @@ -21,7 +21,6 @@ """ from __future__ import annotations -import types from collections import defaultdict from itertools import chain from pathlib import Path