How to generate a single patient with a specific module
schowdary55 opened this issue · comments
Requested Feature
I need to generate a single patient say with just Atrial Fibrillation module data. I tried
./run_synthea -g M -a 60-60 -m *fibrillation*
but I still see FHIR json created with over 100 FHIR records.
For example command: ./run_synthea -g M -a 60-60 -m *fibrillation* -p 1
Output:
Running with options:
Population: 1
Seed: 1716923914673
Provider Seed:1716923914673
Reference Time: 1716923914673
Location: Massachusetts
Min Age: 60
Max Age: 60
Gender: M
Modules: Atrial Fibrillation Module
> [1 loaded]
1 -- Cyrus914 Herzog843 (60 y/o M) Plymouth, Massachusetts (1299)
Records: total=1, alive=1, dead=0
RNG=1
Clinician RNG=5637
FHIR Json: has over 100 records. I did comment out: Lifecycle, Cardiovascular Disease, Quality Of Life, Weight Loss and COVID-19 Immunization Modules in Module.java before running above command.
Respectfully, please see https://github.com/synthetichealth/synthea/wiki/The--M-Feature
Alternatively, I suggest you look into this: https://github.com/synthetichealth/synthea/wiki/Keep-Patients-Module
@jawalonoski Thanks for responding.
I added keep state to atrial_fibrillation.json
"Keep": { "type": "Terminal" }
Ran below command:
./run_synthea -m *fibrillation* -k src/main/resources/modules/atrial_fibrillation.json -p 1000
Got this error:
java.lang.RuntimeException: Failed to produce a matching patient after 1000 attempts. Ensure that it is possible for all requested demographics to meet the criteria. (e.g., make sure there is no age restriction that conflicts with a requested condition, such as limiting age to 0-18 and requiring all patients have a condition that only onsets after 55.) If you are confident that the constraints are possible to satisfy but rare, consider increasing the value in config setting
generate.max_attempts_to_keep_patient``
I did not provide any age or gender restrictions. afaik, atrial_fibrillation.json doesn't have any conditions and is pretty straight forward.
atrial_fibrillation.json
Wondering, why i'm not able to generate even one patient.
You are misunderstanding the Keep Patients Module article.
- You are not supposed to use or modify any of the disease modules in
src/main/resources/modules/
as the keep module(s). - You are supposed to create a new module that specifies what criteria you're using to determine if the patient is kept (e.g., has an Active Condition with the SNOMED code
49436004
,"Atrial fibrillation (disorder)"
) - This "keep module" is ran separately, after all the medical history has already been generated. The keep module does not onset a condition, assign a medication, or conduct any procedures. Literally it is a test function to determine whether or not to "keep" a given patient if they meet your criteria, or try again.