How synthetichealth/synthea works
Main Components
• Modules & Rule System: The project uses “modules” stored in the resources directory (e.g., under src/main/resources/modules) to define simulation rules, disease progression, lifecycle events, and demographics. This forms the modular rule system that drives individual patient simulation.
• World and Agents: The org.mitre.synthea.world package contains the definitions for simulated entities (e.g., Patient, Clinician, Provider, Payer). This part of the system models interactions and behaviors in the “world” of the simulation.
• Exporters: Multiple exporters (e.g., FHIR export, CCDA, CSV, CPCDS) are defined under org.mitre.synthea.export and its sub-packages. They transform generated simulation data into various output formats for consumption.
• Configuration & Resources: Configuration files (found in config and in src/main/resources) supply key simulation parameters, cost files, simulation modules, demographic data, physiology XML configurations, templates (for CCDA), and lookup tables.
• GraphViz Integration: Components like Graphviz.java support rendering simulation rules and modules visually. This rendering tool integrates with the simulation engine to provide graphical representations.
• Build and CI/CD: Although not the focus of the runtime system, the Gradle build files, wrapper scripts, and GitHub workflows (inside .github) indicate the automated build, test, and deployment pipeline used in development.
Relationships and Interactions
• The Simulation Engine reads configuration, modules, and templates from the configuration and resource directories. It uses the Modular Rule System and Physiological Models (under “physiology”) to simulate the lifecycle of synthetic patients.
• The World/Agents modules are used to model individual entities (patients, payers, providers, etc.) and govern the interactions among them. The simulation engine drives state transitions in the life of each patient.
• Graphviz (and helper classes) interact with the engine to produce visualizations of modules, which in turn feed back into the developer workflow.
Architectural Patterns and Design Principles
• Modularity: The system is divided clearly into simulation logic, rule/configuration modules, patient "world" agents, and export functionality.
• Separation of Concerns: Simulation and export functionality are separated, so each aspect of patient simulation and data output is encapsulated.
• Extensibility: The module framework (with drop-in JSON modules and custom Java rule modules) shows clear intent for extensibility and customization.
Elements
• Optionally, include a feedback loop from the Graphviz rendering tool back to the simulation engine to underline the visualization capability.
• If desired, include a build/integration section (e.g., Gradle build & CI workflows) to complete the overall architecture picture even though it may be viewed as “infrastructure.”