-
Notifications
You must be signed in to change notification settings - Fork 15
More tests and consumables for CMD #1625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -376,6 +376,17 @@ def add_record(df: pd.DataFrame, record: Dict): | |||
'Unit_Cost': np.nan}, | |||
) | |||
|
|||
cons = add_record( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this chnage to the script generating the consumables... but I don't see a new version of the resulting ResourceFile (ResourceFile_Consumables_Items_and_Packages.csv)... please commit that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALso - do you want to declare an availability for it? By not doing so (as currently) it will follow the average for other consumables, which may be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do it in line 1675 but I commented it out because the 40% of the availability isn't accurate (just a placeholder). I am working on finding more accurate data.
# 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 | ||
df.at[person_id, f'nc_{self.condition}_medication_prevents_death'] = \ | ||
self.module.rng.rand() < self.module.parameters[f'{self.condition}_hsi'].pr_treatment_works | ||
|
||
#todo review logic of diabetes second and third line drugs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is causing the test_analysis.py
to fail because medication_item_code_second_line
is not defined anywhere.
@@ -1700,12 +1778,15 @@ def apply(self, person_id, squeeze_factor): | |||
# 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_kidney_disease': 12, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you. here,. are you able to add a commment in-line to give justication for the change?
@@ -1671,8 +1747,10 @@ def __init__(self, module, person_id, condition): | |||
|
|||
self.TREATMENT_ID = 'CardioMetabolicDisorders_Treatment' | |||
self.EXPECTED_APPT_FOOTPRINT = self.make_appt_footprint({'Over5OPD': 1}) | |||
self.ACCEPTED_FACILITY_LEVEL = '1b' | |||
|
|||
if condition == 'chronic_kidney_disease': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest (just for neatness) to do this in one line:
self.ACCEPTED_FACILITY_LEVEL = '3' if conditon == 'chronic_kidney_disease' else '1b'
@@ -15,6 +15,7 @@ | |||
import math | |||
from itertools import combinations | |||
from pathlib import Path | |||
from random import random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line can be removed as this import is not used (which is correct, for all random things, use the module's rng)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was added when we were trying to check availability of consumables (which has been commented out, as stated in the earlier comment) but has been removed for now.
# Select all eligible individuals (men & women w/o condition and in age range) | ||
sample_eligible(men_wo_cond & (df.age_range == _age_range), p[f'm_{_age_range}'], condition) | ||
sample_eligible(women_wo_cond & (df.age_range == _age_range), p[f'f_{_age_range}'], condition) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see what is intended with this change: don't think this any effect and so change should be rolled-back
(probably this a rememant of some experiments you were doing?!)
@@ -1362,7 +1371,8 @@ def proportion_of_something_in_a_groupby_ready_for_logging(_df, something, group | |||
{'count': x['nc_n_conditions'].count()})) | |||
n_comorbidities_all.loc[:, num] = col['count'] | |||
|
|||
prop_comorbidities_all = n_comorbidities_all.div(n_comorbidities_all.sum(axis=1), axis=0) | |||
row_sums = n_comorbidities_all.sum(axis=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change to avoid some divisions by zero? Looks fine but wondering if the same effect (suppression of na's) could be accomplished by stick .fillna(0.)
on the end of the original?
@@ -1484,6 +1494,9 @@ def do_for_each_condition(self, _c) -> bool: | |||
hs = self.sim.modules['HealthSystem'] | |||
df = self.sim.population.props | |||
person_id = self.target | |||
m = self.module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no purpose for change, so roll back?
of the initial treatment. They are not second and third line drugs. | ||
""" | ||
|
||
medication_codes = self.module.parameters[f'{self.condition}_hsi'].get('medication_item_code') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from where are these being read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is found in resources\cmd\ResourceFile_cmd_condition_hsi\diabetes.csv
# Conflicts: # src/tlo/methods/cardio_metabolic_disorders.py
Reviewing and adding tests and consumables for CMD. Fixes #1607