Search in sources :

Example 1 with QualityOfLifeModule

use of org.mitre.synthea.modules.QualityOfLifeModule in project synthea by synthetichealth.

the class StateTest method the_dead_should_stay_dead.

@Test
public void the_dead_should_stay_dead() throws Exception {
    // Load all the static modules used in Generator.java
    EncounterModule encounterModule = new EncounterModule();
    List<Module> modules = new ArrayList<Module>();
    modules.add(new LifecycleModule());
    modules.add(new CardiovascularDiseaseModule());
    modules.add(new QualityOfLifeModule());
    // modules.add(new HealthInsuranceModule());
    modules.add(new WeightLossModule());
    // Make sure the patient dies...
    modules.add(TestHelper.getFixture("death_life_expectancy.json"));
    // And make sure the patient has weird delays that are between timesteps...
    modules.add(Module.getModuleByPath("dialysis"));
    // Set life signs at birth...
    long timeT = (long) person.attributes.get(Person.BIRTHDATE);
    LifecycleModule.birth(person, timeT);
    // Make sure the patient requires dialysis to use that module's
    // repeating delayed encounters...
    person.attributes.put("ckd", 5);
    long timestep = Long.parseLong(Config.get("generate.timestep"));
    long stop = time;
    while (person.alive(timeT) && timeT < stop) {
        encounterModule.process(person, timeT);
        Iterator<Module> iter = modules.iterator();
        while (iter.hasNext()) {
            Module module = iter.next();
            if (module.process(person, timeT)) {
                // this module has completed/terminated.
                iter.remove();
            }
        }
        encounterModule.endEncounterModuleEncounters(person, timeT);
        timeT += timestep;
    }
    DeathModule.process(person, time);
    // Now check that the person stayed dead...
    long deathTime = (Long) person.attributes.get(Person.DEATHDATE);
    for (Encounter encounter : person.record.encounters) {
        if (!encounter.codes.contains(DeathModule.DEATH_CERTIFICATION)) {
            assertTrue(encounter.start < deathTime);
        }
    }
}
Also used : CardiovascularDiseaseModule(org.mitre.synthea.modules.CardiovascularDiseaseModule) ArrayList(java.util.ArrayList) QualityOfLifeModule(org.mitre.synthea.modules.QualityOfLifeModule) EncounterModule(org.mitre.synthea.modules.EncounterModule) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) WeightLossModule(org.mitre.synthea.modules.WeightLossModule) QualityOfLifeModule(org.mitre.synthea.modules.QualityOfLifeModule) CardiovascularDiseaseModule(org.mitre.synthea.modules.CardiovascularDiseaseModule) EncounterModule(org.mitre.synthea.modules.EncounterModule) WeightLossModule(org.mitre.synthea.modules.WeightLossModule) LifecycleModule(org.mitre.synthea.modules.LifecycleModule) DeathModule(org.mitre.synthea.modules.DeathModule) LifecycleModule(org.mitre.synthea.modules.LifecycleModule) Test(org.junit.Test)

Example 2 with QualityOfLifeModule

use of org.mitre.synthea.modules.QualityOfLifeModule in project synthea by synthetichealth.

the class Module method loadModules.

private static Map<String, ModuleSupplier> loadModules() {
    Map<String, ModuleSupplier> retVal = new ConcurrentHashMap<>();
    int submoduleCount = 0;
    retVal.put("Lifecycle", new ModuleSupplier(new LifecycleModule()));
    // retVal.put("Health Insurance", new ModuleSupplier(new HealthInsuranceModule()));
    retVal.put("Cardiovascular Disease", new ModuleSupplier(new CardiovascularDiseaseModule()));
    retVal.put("Quality Of Life", new ModuleSupplier(new QualityOfLifeModule()));
    retVal.put("Weight Loss", new ModuleSupplier(new WeightLossModule()));
    retVal.put("COVID-19 Immunization Module", new ModuleSupplier(new C19ImmunizationModule()));
    Properties moduleOverrides = getModuleOverrides();
    try {
        Path modulesPath = getModulesPath();
        submoduleCount = walkModuleTree(modulesPath, retVal, moduleOverrides, false);
    } catch (Exception e) {
        e.printStackTrace();
    }
    System.out.format("Scanned %d modules and %d submodules.\n", retVal.size() - submoduleCount, submoduleCount);
    return retVal;
}
Also used : Path(java.nio.file.Path) JsonPath(com.jayway.jsonpath.JsonPath) QualityOfLifeModule(org.mitre.synthea.modules.QualityOfLifeModule) Properties(java.util.Properties) URISyntaxException(java.net.URISyntaxException) FileSystemNotFoundException(java.nio.file.FileSystemNotFoundException) IOException(java.io.IOException) C19ImmunizationModule(org.mitre.synthea.modules.covid.C19ImmunizationModule) CardiovascularDiseaseModule(org.mitre.synthea.modules.CardiovascularDiseaseModule) WeightLossModule(org.mitre.synthea.modules.WeightLossModule) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) LifecycleModule(org.mitre.synthea.modules.LifecycleModule)

Aggregations

CardiovascularDiseaseModule (org.mitre.synthea.modules.CardiovascularDiseaseModule)2 LifecycleModule (org.mitre.synthea.modules.LifecycleModule)2 QualityOfLifeModule (org.mitre.synthea.modules.QualityOfLifeModule)2 WeightLossModule (org.mitre.synthea.modules.WeightLossModule)2 JsonPath (com.jayway.jsonpath.JsonPath)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 FileSystemNotFoundException (java.nio.file.FileSystemNotFoundException)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Test (org.junit.Test)1 DeathModule (org.mitre.synthea.modules.DeathModule)1 EncounterModule (org.mitre.synthea.modules.EncounterModule)1 C19ImmunizationModule (org.mitre.synthea.modules.covid.C19ImmunizationModule)1 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)1