Skip to content

Conversation

@marghe-molaro
Copy link
Collaborator

This PR updates previous PR draft #1468

Now includes changes in the mother_and_newborn_info dataframe.

…th, label what is only used for ddebugging and will be later removed
…ible to all modules. For now add person_ID to the dict of info printed as the outer dictionary key logging seems to have a problem.
…lysis file now collects all relevant info and prints them
…rected analysis file such as for small number of cases where the DALYs are not explicitly resolved the average DALYs are still computed correctly [skip ci]
@marghe-molaro
Copy link
Collaborator Author

Hi @tamuri,

  • Logging fixed as suggested
  • EventName error fixed
  • Utils fncs updated

For now "final package" offered by util fnc includes , for each draw, person ID (combined across runs for that draw), date, event, and attribute changes incurred by individual as part of that event. I think this is how most users will think about processing this info, but we can maybe discuss at Q4.

Note that I am still getting a Run Checks error but this is not linked to ruff:

ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device

@marghe-molaro
Copy link
Collaborator Author

marghe-molaro commented Nov 28, 2025

Still to finalise:

  • Are the copies of pop dataframe/rows "deep" enough? Do columns containing series and lists need to be copied iteratively?
  • Are nans and NaTs handled appropriately? Attributes that are 'nan' before/after event seem to be incorrectly detected as having changed
  • Currently saving values as strings to deal with different types, but will save different types to different V columns as previously suggested by Asif (V_bool, V_int, V_float, etc)

@marghe-molaro
Copy link
Collaborator Author

To add following discussion at Q4:

  • Add option for users to specify characteristics of individuals for which histories are tracked;
  • Ensure events after death are not logged (a few of these may slip through via pop-wide events)

@tamuri
Copy link
Collaborator

tamuri commented Dec 3, 2025

Are the copies of pop dataframe/rows "deep" enough? Do columns containing series and lists need to be copied iteratively?

The following population dataframe columns have object type i.e. the ones to check are copied/checked properly:

>>> [col for col in df.columns if df[col].dtype == 'object']
['rt_injuries_to_cast', 'rt_injuries_for_minor_surgery', 'rt_injuries_for_major_surgery', 'rt_injuries_to_heal_with_time', 'rt_injuries_for_open_fracture_treatment', 'rt_injuries_left_untreated']

@marghe-molaro
Copy link
Collaborator Author

Hi @tamuri,
This is now ready for review. Notable changes:

  • Fixed issue with nan values being incorrectly logged as having changed;
  • Unified approach to copying pop df + mni dictionary, and ensured object types are copied by value;
  • In postprocessing, ensured events which may have been logged after the individual's death are not kept in the final histories (there won't be many)

@marghe-molaro
Copy link
Collaborator Author

Added features:

  • Individuals now have an additional property called track_history. Events are only logged for individuals for whom track_history = True either before or after the event has ran. Developers are free to specify how this variable is updated by events in the simulation.

Note:

  • Inpatient_Care is currently not an event associated with a specific individual, therefore (by definition) it is not logged by the individual history tracker

@marghe-molaro
Copy link
Collaborator Author

Now additionally tracking consumable, equipment, and bed days access for each individual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants