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);
}
}
}
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;
}
Aggregations