Health-GPS

Logo

Global Health Policy Simulation model

View the Project on GitHub imperialCHEPI/healthgps

Individual ID tracking CSV (user-configured filters)

Global Health Policy Simulation model

Home Quick Start User Guide Schemas Models Architecture Data Model Developer Guide Technical docs API
Related: Same person ID plan Technical index Documentation index

Plan summary

Title: Individual ID tracking CSV

Overview: Add user-configurable individual ID tracking that writes a CSV of filtered persons (by age, gender, region, ethnicity, risk factors, years, scenario) with filename derived from the main HealthGPS result file (e.g. …_IndividualIDTracking.csv), using a new event type and writer, with MAHIMA comments throughout.

Goal

Allow users to request a second CSV output that contains per-person rows for the same run, with columns: run, time, scenario, id, age, gender, region, ethnicity, and selected risk factors. Rows are filtered by user-specified constraints (age range, gender, region, ethnicity, which years, which scenario). The file is named like the main result file but with a distinguishable suffix (e.g. HealthGPS_result_{timestamp}_IndividualIDTracking.csv). All new code will include MAHIMA in comments where appropriate.

Architecture (high level)

sequenceDiagram
    participant Analysis as AnalysisModule
    participant Bus as EventBus
    participant Monitor as EventMonitor
    participant MainWriter as ResultFileWriter
    participant TrackWriter as IndividualIDTrackingWriter

    Analysis->>Bus: ResultEventMessage (aggregated)
    Analysis->>Bus: IndividualTrackingEventMessage (filtered rows)
    Bus->>Monitor: dispatch
    Monitor->>MainWriter: write(ResultEventMessage)
    Monitor->>TrackWriter: write(IndividualTrackingEventMessage)

1. Config schema and POCO

2. Passing config into the simulation

3. New event and payload

4. Producing the event (Analysis module)

Filtering logic (MAHIMA comments):

5. Writing the CSV

6. Event aggregator subscription

7. File naming summary

8. Example config (for users)

"output": {
  "folder": "results",
  "file_name": "HealthGPS_result_{TIMESTAMP}.json",
  "comorbidities": 5,
  "individual_id_tracking": {
    "enabled": true,
    "age_min": 25,
    "age_max": 60,
    "gender": "all",
    "regions": [],
    "ethnicities": [],
    "risk_factors": ["bmi", "smoking"],
    "years": [2030, 2040],
    "scenarios": "both"
  }
}

Empty arrays / “all” mean no filter for that dimension.

9. MAHIMA comment placement

10. Testing (optional in plan)

Implementation order

  1. POCO + schema + parsing for individual_id_tracking under output.
  2. ModelInput + create_model_input: pass optional tracking config.
  3. New event type and payload; add to EventType enum and EventMessageVisitor.
  4. IndividualIDTrackingWriter class + filename helper; wire into program.cpp and EventMonitor.
  5. AnalysisModule: store optional config in build_analysis_module; in publish_result_message, add filter loop and publish IndividualTrackingEventMessage.
  6. Event aggregator subscription and EventMonitor visit(IndividualTrackingEventMessage) calling the new writer.
  7. Add MAHIMA comments in the above files.

No changes to the existing ResultEventMessage or main JSON/CSV writing logic; the new feature is additive and gated by config.


Author: Mahima Ghosh