### Run Synthea with Custom Exporter (Basic Setup) Source: https://github.com/synthetichealth/synthea/wiki/Custom-Exporters Execute Synthea with your custom exporter JAR added to the classpath. This command assumes a basic Synthea setup. ```sh java -jar synthea-with-dependencies.jar -cp path/to/custom-exporter-template.jar ``` -------------------------------- ### Example Synthea Properties File Source: https://github.com/synthetichealth/synthea/wiki/Common-Configuration This is an example of a Synthea properties file, showing comments and export settings. Default settings can be overridden in a local settings file. ```properties # this is a comment exporter.ccda.export = false exporter.fhir.export = true exporter.fhir_stu3.export = false exporter.fhir_dstu2.export = false ``` -------------------------------- ### Apply Profiles Action Example Source: https://github.com/synthetichealth/synthea/wiki/Flexporter Example configuration for the 'Apply Profiles' action to assign specific profiles to Patient and Encounter resources. ```yaml - name: Apply Profiles profiles: - profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient applicability: Patient - profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter applicability: Encounter ``` -------------------------------- ### Example Usage of Value Functions Source: https://github.com/synthetichealth/synthea/wiki/Flexporter An example demonstrating the use of Synthea value functions within resource definition. ```APIDOC ```yaml - create_resource: - resourceType: ServiceRequest based_on: resource: Procedure fields: - location: ServiceRequest.intent value: plan - location: ServiceRequest.encounter.reference value: $getField([Procedure.encounter.reference]) - location: ServiceRequest.subject.reference value: $findRef([Patient]) - location: ServiceRequest.code.coding value: $randomCode([http://hl7.org/fhir/us/mcode/ValueSet/mcode-laterality-vs]) ``` ``` -------------------------------- ### Install Graphviz and Generate Synthea Rules Diagram Source: https://github.com/synthetichealth/synthea/wiki/Graphviz-Rules-Diagram Install Graphviz using Homebrew and then execute the rake task to generate a flowchart diagram of Synthea's rules and attributes. The diagram will be saved in the output/graphviz folder. ```bash brew install graphviz bundle exec rake synthea:graphviz ``` -------------------------------- ### Example: Display Help Messages Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Display help messages and command-line options without further processing. ```bash run_synthea -h ``` -------------------------------- ### Example: Generate Population of 1000 Patients Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population consisting of 1000 patients. ```bash run_synthea -p 1000 ``` -------------------------------- ### Physiology Generator Input Example Source: https://github.com/synthetichealth/synthea/wiki/Physiology-Models Example structure for physiology model inputs. ```yaml inputs: # # Effects of age and BMI loosely estimated from a comprehensive study on adult blood pressure # # percentiles (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4553889/) ``` -------------------------------- ### Example: Generate Population in Massachusetts Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population for all cities and towns within Massachusetts. ```bash run_synthea Massachusetts ``` -------------------------------- ### Run Synthea with Dependencies Source: https://github.com/synthetichealth/synthea/wiki/Basic-Setup-and-Running Execute the Synthea JAR file to start the data generation process. Ensure you are in the directory where the JAR was downloaded. ```bash cd /directory/you/downloaded/synthea/to java -jar synthea-with-dependencies.jar ``` -------------------------------- ### Lookup Table CSV Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Transitions An example CSV file defining probabilities for 'Lookuptablitis' and 'No_Lookuptablitis' transitions based on age, gender, and state. The last two columns correspond to the transition names defined in the JSON configuration. ```csv age,gender,state,Lookuptablitis,No_Lookuptablitis 0-17,M,Massachusetts,0,1 18-44,M,Massachusetts,0.25,0.75 45-64,M,Massachusetts,0.5,0.5 64-140,M,Massachusetts,0.75,0.25 0-17,F,Massachusetts,0,1 18-44,F,Massachusetts,0.3,0.7 45-64,F,Massachusetts,0.8,0.2 64-140,F,Massachusetts,0,1 ... ``` -------------------------------- ### Example: Generate Population in Juneau, Alaska Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population specifically for Juneau, Alaska. ```bash run_synthea Alaska Juneau ``` -------------------------------- ### Example: Generate Population in Seattle with Seed Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population in Seattle, Washington, using a specific seed. ```bash run_synthea -s 987 Washington Seattle ``` -------------------------------- ### Module Remarks Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Basics Illustrates how to add remarks (comments) to a module. Remarks are lists of strings and are ignored by Synthea. ```json { "remarks": [ "Remarks describe their parent object or detail important ", "aspects of the module. Links to sources may be included here: ", "http://www.example.com/source/ ", "You may write use extra newlines to separate out remarks." ] } ``` -------------------------------- ### Programmatically Generate Patient Records Source: https://github.com/synthetichealth/synthea/wiki/Embedding Example of initializing the Generator and running it to produce patient records. ```java package com.example.generator; import org.mitre.synthea.engine.Generator; import org.mitre.synthea.helpers.Config; public class Main { public static void main(String[] args) { Generator.GeneratorOptions options = new Generator.GeneratorOptions(); options.population = 10; Config.set("exporter.hospital.fhir.export", "false"); Config.set("exporter.practitioner.fhir.export", "false"); Generator generator = new Generator(options); generator.run(); } } ``` -------------------------------- ### Run Synthea with custom modules Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Running-New-Modules Commands to specify a custom module directory for different Synthea installation types. ```bash java -jar synthea-with-dependencies.jar -d path/to/modules/directory ``` ```bash ./run_synthea -d path/to/modules/directory ``` -------------------------------- ### Example: Generate Population Aged 30-40 Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population where all patients are between 30 and 40 years old. ```bash run_synthea -a 30-40 ``` -------------------------------- ### View Text-Based Patient Record Sample Source: https://github.com/synthetichealth/synthea/wiki/Getting-Started Example of the human-readable text output generated by the Synthea exporter. ```text Mekhi724 Kemmer911 ================== Race: White Ethnicity: Non-Hispanic Gender: F Age: 33 Birth Date: 1983-11-04 Marital Status: M -------------------------------------------------------------------------------- ALLERGIES: N/A -------------------------------------------------------------------------------- MEDICATIONS: 2013-08-22 [CURRENT] : Acetaminophen 160 MG for Acute bronchitis (disorder) 1996-05-12 [CURRENT] : Acetaminophen 160 MG for Acute bronchitis (disorder) 1995-04-13 [CURRENT] : Acetaminophen 160 MG for Acute bronchitis (disorder) 1984-01-14 [CURRENT] : Penicillin V Potassium 250 MG for Streptococcal sore throat (disorder) -------------------------------------------------------------------------------- CONDITIONS: 2015-10-30 - 2015-11-07 : Fetus with chromosomal abnormality 2015-10-30 - 2015-11-07 : Miscarriage in first trimester 2015-10-30 - 2015-11-07 : Normal pregnancy 2013-08-22 - 2013-09-08 : Acute bronchitis (disorder) 1985-08-07 - : Food Allergy: Fish -------------------------------------------------------------------------------- CARE PLANS: 2013-08-22 [STOPPED] : Respiratory therapy Reason: Acute bronchitis (disorder) Activity: Recommendation to avoid exercise Activity: Deep breathing and coughing exercises -------------------------------------------------------------------------------- OBSERVATIONS: 2014-01-14 : Body Weight 73.9 kg 2014-01-14 : Body Height 163.7 cm 2014-01-14 : Body Mass Index 27.6 kg/m2 2014-01-14 : Systolic Blood Pressure 133.0 mmHg 2014-01-14 : Diastolic Blood Pressure 76.0 mmHg 2014-01-14 : Blood Pressure 2.0 -------------------------------------------------------------------------------- PROCEDURES: 2015-10-30 : Standard pregnancy test for Normal pregnancy 2014-01-14 : Documentation of current medications -------------------------------------------------------------------------------- ENCOUNTERS: 2015-11-07 : Encounter for Fetus with chromosomal abnormality 2015-10-30 : Encounter for Normal pregnancy 2014-01-14 : Outpatient Encounter 2013-08-22 : Encounter for Acute bronchitis (disorder) -------------------------------------------------------------------------------- ``` -------------------------------- ### Example: Generate Population with Specific Seed Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population using a specific seed value for reproducible results. ```bash run_synthea -s 12345 ``` -------------------------------- ### Migrate MedicationOrder to CallSubmodule Source: https://github.com/synthetichealth/synthea/wiki/Medication-Diversification-Tool-(MDT) Example showing the transition from a legacy MedicationOrder state to a CallSubmodule state in an asthma module. ```json ... "Prescribe_Maintenance_Inhaler": { "type": "MedicationOrder", "reason": "asthma_condition", "codes": [ { "system": "RxNorm", "code": "895994", "display": "120 ACTUAT Fluticasone propionate 0.044 MG/ACTUAT Metered Dose Inhaler" } ], "prescription": { "as_needed": true }, "direct_transition": "Prescribe_Emergency_Inhaler", "chronic": true }, ... ``` ```json ... "Prescribe_Maintenance_Inhaler": { "type": "CallSubmodule", "submodule": "medications/maintenance_inhaler", "direct_transition": "Prescribe_Emergency_Inhaler" }, ... ``` -------------------------------- ### Submodule Log Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Submodules Shows the state transition log for a medication submodule when processed independently. This log details the sequence of states within the submodule itself. ```text /=============================================================================== | Medication Submodule Log |=============================================================================== | Entered | Exited | State |---------------------------|---------------------------|----------------------- | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Initial | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Prescribe_Medication | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Med_Terminal \=============================================================================== ``` -------------------------------- ### Initial State Configuration Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-States The Initial state marks the starting point of a generic module. It requires the type to be set to 'Initial' and can only appear once per module. ```json "Initial": { "type": "Initial" } ``` -------------------------------- ### Example: Export FHIR with US Core IG Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population that exports FHIR data according to the US Core R4 Implementation Guide profiles. ```bash run_synthea --exporter.fhir.use_us_core_ig true --exporter.fhir.us_core_version 4.0.0 ``` -------------------------------- ### Invalid Attribute Name Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Basics Shows an example of a bad attribute name, which is not in lower_snake_case and contains spaces. ```json { "assign_to_attribute": "Type of Alzheimer's" } ``` -------------------------------- ### Synthea Snapshot Evolution Example Source: https://github.com/synthetichealth/synthea/wiki/Evolving-a-Population This sequence demonstrates creating an initial population, saving a snapshot, and then evolving it over time in multiple steps, saving updated snapshots at each stage. Ensure unique base directories for each step to avoid export failures. ```bash $ mkdir -p output/1 output/2 output/3 $ ./run_synthea -p 5 -u output/1/snap --exporter.baseDirectory output/1 $ ./run_synthea -i output/1/snap -u output/2/snap -t 100 --exporter.baseDirectory output/2 $ ./run_synthea -i output/2/snap -u output/3/snap -t 100 --exporter.baseDirectory output/3 ``` -------------------------------- ### Procedure: Appendectomy Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-States Example of a Procedure state for an appendectomy, including reason and duration. The duration is specified in hours. ```JSON "Appendectomy": { "type": "Procedure", "reason": "Appendicitis", "codes": [ { "system": "SNOMED-CT", "code": "6025007", "display": "Laparoscopic appendectomy" } ], "duration": { "low": 2, "high": 3, "unit": "hours" } } ``` -------------------------------- ### Run Synthea with Custom Settings (Developer) Source: https://github.com/synthetichealth/synthea/wiki/Common-Configuration Use this command to run Synthea with a custom settings file when using the developer setup. The `-c` flag specifies the path to your settings file. ```bash ./run_synthea -c path/to/settings/file ``` -------------------------------- ### Build and Run Synthea via Gradle Source: https://context7.com/synthetichealth/synthea/llms.txt Use Gradle commands to build the project from source and execute the simulator using convenience scripts. ```bash # Clone the repository git clone https://github.com/synthetichealth/synthea.git cd synthea # Build and run tests ./gradlew build check test # Run Synthea using Gradle ./gradlew run # Run using the convenience script (easier for passing arguments) ./run_synthea -p 100 Massachusetts Boston # Generate 1000 patients with a specific seed ./run_synthea -s 987 -p 1000 Washington Seattle # Use a custom configuration file ./run_synthea -c /path/to/custom.properties -p 100 # Use custom disease modules from a directory ./run_synthea -d /path/to/custom/modules -p 100 # Generate GraphViz visualizations of disease modules ./gradlew graphviz # Generate a list of concepts used in records ./gradlew concepts # Generate a list of patient attributes ./gradlew attributes # On Windows, use the .bat equivalents .\gradlew.bat build .\run_synthea.bat -p 100 ``` -------------------------------- ### SNOMED Code Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Basics Example of a SNOMED-CT code used for clinical findings, symptoms, or diagnoses within Synthea states. ```json { "system": "SNOMED-CT", "code": "44054006", "display": "Diabetes" } ``` -------------------------------- ### FHIR query reference example Source: https://github.com/synthetichealth/synthea/wiki/FHIR-Transaction-Bundles Example of a query reference used within patient bundles to refer to omitted Practitioner resources. ```text Practitioner?identifier=http://hl7.org/fhir/sid/us-npi|999999647 ``` -------------------------------- ### Main Module with Submodule Log Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Submodules Demonstrates the combined state transition log when a submodule is called by a main module. The submodule's states are interleaved within the main module's log, showing inline execution. ```text /=============================================================================== | Main Module Log |=============================================================================== | Entered | Exited | State |---------------------------|---------------------------|----------------------- | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Initial | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Example_Condition | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Encounter | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | CallSubmodule | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Initial | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Prescribe_Medication | 2017-01-17T09:50:41-05:00 | 2017-01-17T09:50:41-05:00 | Med_Terminal | 2017-01-17T09:50:41-05:00 | | Terminal \=============================================================================== ``` -------------------------------- ### Abridged Zip Code CSV Example for UK Source: https://github.com/synthetichealth/synthea/wiki/Zip-or-Postal-Codes Example format for defining non-US geography data using the required CSV structure. ```csv ,USPS,ST,NAME,ZCTA5,LAT,LON 0,West Midlands,WMS,Shrewsbury,SY1,52.7081,-2.7549 1,West Midlands,WMS,Shrewsbury,SY2,52.7083,-2.7546 2,West Midlands,WMS,Shrewsbury,SY3,52.7089,-2.7543 ``` -------------------------------- ### Build and Run Synthea with Custom Exporters Source: https://context7.com/synthetichealth/synthea/llms.txt Commands for building the custom exporter JAR and executing Synthea with the custom classpath. ```bash # Build the custom exporter JAR ./gradlew jar # Run Synthea with custom exporter # Basic setup: java -jar synthea-with-dependencies.jar -cp path/to/custom-exporter.jar -p 100 # Developer setup: # Place JAR in ./lib/custom/ directory ./run_synthea -p 100 ``` -------------------------------- ### Intersection Function Example Source: https://github.com/synthetichealth/synthea/wiki/Physiology-Models This is a placeholder for an intersection function example, intended to represent discrete data generated by medical devices and wearables. The specific implementation is left to the reader. ```yml ... ``` -------------------------------- ### Clone and Build Synthea Project Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Clone the Synthea repository and build the project using Gradle. Ensure Java 17 or newer is installed. On Windows, use `.\gradlew.bat`. ```bash git clone https://github.com/synthetichealth/synthea.git cd synthea ./gradlew build check test ``` -------------------------------- ### List Synthea output files Source: https://github.com/synthetichealth/synthea/wiki/Docker Navigates to the mounted directory and lists the generated output files. ```bash $ cd /mnt/synthea && ls CCDA fhir html ``` -------------------------------- ### Override File Format Example Source: https://github.com/synthetichealth/synthea/wiki/Module-Overrides This is an example of a Java properties file used for module overrides. It specifies the module file path, a JSONPath to the value, and the new value. ```properties congestive_heart_failure.json\:\:$['states']['Age_70-79-Chance\ of\ CHF']['distributed_transition'][0]['distribution'] = 0.024 congestive_heart_failure.json\:\:$['states']['Age_80-Chance\ of\ CHF']['distributed_transition'][0]['distribution'] = 0.045 atopy.json\:\:$['states']['Initial']['complex_transition'][0]['distributions'][0]['distribution'] = 0.917 atopy.json\:\:$['states']['Initial']['complex_transition'][1]['distributions'][0]['distribution'] = 0.033 ``` -------------------------------- ### Run Synthea with Custom Settings (JAR) Source: https://github.com/synthetichealth/synthea/wiki/Common-Configuration Use this command to run Synthea with a custom settings file when using the JAR distribution. The `-c` flag specifies the path to your settings file. ```bash java -jar synthea-with-dependencies.jar -c path/to/settings/file ``` -------------------------------- ### Hospital CSV File Format Example (UK) Source: https://github.com/synthetichealth/synthea/wiki/Provider-Data This CSV example demonstrates the expected format for hospital data, including columns for ID, name, address, location (LAT/LON), and other relevant details. The first column is ignored by the program. ```csv ,id,name,address,city,state,zip,county,phone,type,ownership,emergency,quality,LAT,LON 0,010001,Royal Shrewsbury Hospital,Mytton Oak Rd,Shrewsbury,WMS,SY3 8XQ,Shropshire,01743261000,NHS Teaching Hospital,Government - Hospital District or Authority,Yes,5,52.7091,-2.7931 ``` -------------------------------- ### ImagingStudy: Ankle X-Ray Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-States Example of an ImagingStudy state for an ankle X-ray. It includes procedure code, series details (body site, modality), and image instances with titles and SOP classes. The modality is 'Digital Radiography' and the SOP class is 'Digital X-Ray Image Storage'. ```JSON "Ankle_X_Ray": { "type": "ImagingStudy", "procedure_code": { "system": "SNOMED-CT", "code": "19490002", "display": "Ankle X-ray" }, "series": [ { "body_site": { "system": "SNOMED-CT", "code": "344001", "display": "Ankle" }, "modality": { "system": "DICOM-DCM", "code": "DX", "display": "Digital Radiography" }, "instances": [ { "title": "Image of ankle", "sop_class": { "system": "DICOM-SOP", "code": "1.2.840.10008.5.1.4.1.1.1.1", "display": "Digital X-Ray Image Storage" } } ] } ] } ``` -------------------------------- ### Examplitis Module Definition (JSON) Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Complete-Example This JSON defines a complete medical module for the artificial disease 'Examplitis'. It includes states for initial conditions, age guards, disease onset, treatment, and outcomes like death. Use this structure to define custom medical scenarios in Synthea. ```json { "name": "Examplitis", "remarks": [ "Examplitis is a painful condition that affects only males. Most patients ", "can be cured with Examplitol or an Examplotomy but some never recover." ], "states": { "Initial": { "type": "Initial", "conditional_transition": [ { "condition": { "condition_type": "Gender", "gender": "M" }, "transition": "Age_Guard" }, { "transition": "Terminal" } ] }, "Age_Guard": { "type": "Guard", "allow": { "condition_type": "Age", "operator": ">", "quantity": 40, "unit": "years" }, "distributed_transition": [ { "distribution": 0.10, "transition": "Pre_Examplitis" }, { "distribution": 0.90, "transition": "Terminal" } ] }, "Pre_Examplitis": { "type": "Delay", "range": { "low": 0, "high": 10, "unit": "years" }, "direct_transition": "Examplitis" }, "Examplitis": { "type": "ConditionOnset", "target_encounter": "Wellness_Encounter", "codes": [ { "system": "SNOMED-CT", "code": "123", "display": "Examplitis" } ], "direct_transition": "Wellness_Encounter" }, "Wellness_Encounter": { "type": "Encounter", "wellness": true, "direct_transition": "Examplitol" }, "Examplitol": { "type": "MedicationOrder", "reason": "Examplitis", "codes": [ { "system": "RxNorm", "code": "456", "display": "Examplitol" } ], "distributed_transition": [ { "distribution": 0.2, "transition": "Pre_Examplotomy" }, { "distribution": 0.1, "transition": "Last_Days" }, { "distribution": 0.7, "transition": "Terminal" } ] }, "Pre_Examplotomy": { "type": "Delay", "range": { "low": 18, "high": 36, "unit": "months" }, "direct_transition": "Examplotomy_Encounter" }, "Examplotomy_Encounter": { "type": "Encounter", "encounter_class": "ambulatory", "codes": [ { "system": "SNOMED-CT", "code": "ABC", "display": "Examplotomy Encounter" } ], "direct_transition": "Examplotomy" }, "Examplotomy": { "type": "Procedure", "duration": { "low": 2, "high": 3, "unit": "hours" }, "codes": [ { "system": "SNOMED-CT", "code": "789", "display": "Examplotomy" } ], "reason": "Examplitis", "direct_transition": "End_Examplotomy_Encounter" }, "End_Examplotomy_Encounter": { "type": "EncounterEnd", "distributed_transition": [ { "distribution": 0.1, "transition": "Death" }, { "distribution": 0.9, "transition": "Terminal" } ] }, "Last_Days": { "type": "Delay", "range": { "low": 8, "high": 20, "unit": "years" }, "direct_transition": "Death" }, "Death": { "type": "Death" }, "Terminal": { "type": "Terminal" } } } ``` -------------------------------- ### Example: Generate Only Female Patients Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population consisting solely of female patients. ```bash run_synthea -g F ``` -------------------------------- ### Run Synthea with Script Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Use the `run_synthea` script for easier command-line argument passing. On Windows, use `.\run_synthea.bat`. ```bash ./run_synthea ``` -------------------------------- ### Example: Generate Population in Salt Lake City with Seed and Size Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Generate a population of 100 patients in Salt Lake City, Utah, using a specific seed. ```bash run_synthea -s 21 -p 100 Utah "Salt Lake City" ``` -------------------------------- ### Code with ValueSet Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Basics Includes a code with system, code, and display, along with an optional ValueSet for terminology services. Requires a configured terminology service URL. ```json { "system": "SNOMED-CT", "code": "2501000087107", "display": "MRI of right knee with contrast", "value_set": "http://snomed.info/sct?fhir_vs=ecl/<<2491000087104" } ``` -------------------------------- ### Define MedicationOrder States Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-States Examples of prescribing medications with optional dosage, duration, and as-needed status. ```json "Prescribe_Metformin": { "type": "MedicationOrder", "assign_to_attribute": "diabetes_medication", "reason": "Diabetes", "codes": [ { "system": "RxNorm", "code": "860975", "display": "24 HR Metformin hydrochloride 500 MG Extended Release Oral Tablet" } ] } ``` ```json "Examplitol": { "type": "MedicationOrder", "reason": "Examplitis", "codes": [ { "system": "RxNorm", "code": "123456", "display": "Examplitol 100mg [Examplitol]" } ], "prescription": { "refills": 2, "dosage": { "amount": 1, "frequency": 2, "period": 1, "unit": "days" }, "duration": { "quantity": 2, "unit": "weeks" }, "instructions": [ { "system": "SNOMED-CT", "code": "311501008", "display": "Half to one hour before food" } ] } } ``` ```json "Examplitol": { "type": "MedicationOrder", "reason": "Examplitis", "codes": [ { "system": "RxNorm", "code": "123456", "display": "Examplitol 100mg [Examplitol]" } ], "prescription": { "as_needed": true } } ``` -------------------------------- ### Run Synthea with Overrides Source: https://github.com/synthetichealth/synthea/wiki/Module-Overrides Execute the simulation using the custom override properties file. ```bash run_synthea --module_override=./appendicitis_overrides.properties ``` -------------------------------- ### Run One-Off Physiology Simulations Source: https://github.com/synthetichealth/synthea/wiki/Physiology-Models Execute individual physiology models using Gradle for debugging and optimization. ```bash ./gradlew physiology --args="config/simulations/circadian_clock.yml" ./gradlew physiology --args="config/simulations/ecg.yml" ./gradlew physiology --args="config/simulations/insulin_signalling_diabetic.yml" ./gradlew physiology --args="config/simulations/insulin_signalling_normal.yml" ./gradlew physiology --args="config/simulations/liver_metabolism.yml" ./gradlew physiology --args="config/simulations/mammalian_circadian_rhythm_non_24hr.yml" ./gradlew physiology --args="config/simulations/menstrual_cycle.yml" ./gradlew physiology --args="config/simulations/o2_transport_metabolism.yml" ./gradlew physiology --args="config/simulations/plasma_melatonin.yml" ./gradlew physiology --args="config/simulations/pulmonary_fluid_dynamics.yml" ./gradlew physiology --args="config/simulations/pulmonary_oxygen_intake.yml" ./gradlew physiology --args="config/simulations/telomere_associated_dna_damage.yml" ./gradlew physiology --args="config/simulations/weight_change.yml" ``` -------------------------------- ### Define MedicationEnd States Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-States Examples of ending medication prescriptions using codes, attributes, or state references. ```json "End_Metformin": { "type": "MedicationEnd", "codes": [ { "system": "RxNorm", "code": "860975", "display": "24 HR Metformin hydrochloride 500 MG Extended Release Oral Tablet" } ] } ``` ```json "End_Insulin_Medicine": { "type": "MedicationEnd", "referenced_by_attribute": "insulin_medicine" }, ``` ```json "End_Bromocriptine": { "type": "MedicationEnd", "medication_order": "Bromocriptine_Start" }, ``` -------------------------------- ### Clone and Build Synthea Repository Source: https://github.com/synthetichealth/synthea/wiki/Dev-Days Clone the Synthea repository from GitHub and build the project using Gradle. This is a prerequisite for running Synthea. ```bash git clone https://github.com/synthetichealth/synthea.git cd synthea ./gradlew test ``` -------------------------------- ### Synthea Command-Line Options Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Overview of command-line arguments for `run_synthea`, including options for seed, population size, age, gender, configuration, and location. ```bash run_synthea [-h] [-s seed] [-cs clinician seed] [-p populationSize] [-g gender] [-a minAge-maxAge] [-c localConfigFilePath] [-d localModulesDirPath] [state [city]] ``` -------------------------------- ### False Condition Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Logic This condition always evaluates to false and is primarily for testing purposes. It requires no sub-conditions. ```json { "condition_type": "False" } ``` -------------------------------- ### Run Synthea Simulation Source: https://github.com/synthetichealth/synthea/wiki/Developer-Setup-and-Running Execute the primary Synthea simulation using the `run` Gradle task. On Windows, use `.\gradlew.bat`. ```bash ./gradlew run ``` -------------------------------- ### True Condition Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Logic This condition always evaluates to true and is primarily for testing purposes. It requires no sub-conditions. ```json { "condition_type": "True" } ``` -------------------------------- ### Running Synthea Data Generator Source: https://github.com/synthetichealth/synthea/wiki/Other-Areas Execute the Synthea generator from the command line with specified population, location, and other options. The output shows the loading of modules and the generation progress. ```bash ./run_synthea -p 1 "West Midlands" Shrewsbury ...abridged... Loaded 70 modules. Running with options: Population: 1 Seed: 0 Location: Shrewsbury, West Midlands Min Age: 0 Max Age: 140 1 -- Brigitte394 Stark857 (50 y/o F) Shrewsbury, West Midlands DECEASED 1 -- Jeanine128 Gleason633 (57 y/o F) Shrewsbury, West Midlands {alive=1, dead=1} ``` -------------------------------- ### Or Condition Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Logic Use this condition to return true if any of the sub-conditions are met. It requires a list of conditions to evaluate. ```json { "condition_type": "Or", "conditions": [ { "condition_type": "Gender", "gender": "M" }, { "condition_type": "Age", "operator": ">=", "quantity": 40, "unit": "years" } ] } ``` -------------------------------- ### Build JAR File with Gradle Source: https://github.com/synthetichealth/synthea/wiki/Custom-Exporters Use this Gradle command to compile your custom exporter code and package it into a JAR file for use with Synthea. ```sh ./gradlew jar ``` -------------------------------- ### Measurement Unit Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Basics Defines a unit of measurement. Any string is valid, but metric units are typically used. ```json { "unit": "cm" } ``` -------------------------------- ### Age Unit Example Source: https://github.com/synthetichealth/synthea/wiki/Generic-Module-Framework:-Basics Specifies a quantity with a unit of age. Valid age units are the same as time units. ```json { "quantity": 40, "unit": "years" } ``` -------------------------------- ### Synthea Help Option Source: https://github.com/synthetichealth/synthea/wiki/Basic-Setup-and-Running Use the -h flag to display help messages and command-line options without running Synthea. ```bash java -jar synthea-with-dependencies.jar -h ```