use of org.mitre.synthea.editors.GrowthDataErrorsEditor in project synthea by synthetichealth.
the class GrowthDataErrorsEditorTest method encountersWithObservationsOfCode.
@Test
public void encountersWithObservationsOfCode() {
GrowthDataErrorsEditor mod = new GrowthDataErrorsEditor();
List<HealthRecord.Encounter> es = mod.encountersWithObservationsOfCode(record.encounters, GrowthDataErrorsEditor.HEIGHT_LOINC_CODE);
assertEquals(2, es.size());
}
use of org.mitre.synthea.editors.GrowthDataErrorsEditor in project synthea by synthetichealth.
the class GrowthDataErrorsEditorTest method process.
@Test
public void process() {
GrowthDataErrorsEditor m = new GrowthDataErrorsEditor();
m.process(new Person(1), record.encounters, 100000);
}
use of org.mitre.synthea.editors.GrowthDataErrorsEditor in project synthea by synthetichealth.
the class Generator method init.
private void init() {
if (options.state == null) {
options.state = DEFAULT_STATE;
}
int stateIndex = Location.getIndex(options.state);
if (Config.getAsBoolean("exporter.cdw.export")) {
CDWExporter.getInstance().setKeyStart((stateIndex * 1_000_000) + 1);
}
this.populationRandom = new DefaultRandomNumberGenerator(options.seed);
this.clinicianRandom = new DefaultRandomNumberGenerator(options.clinicianSeed);
this.timestep = Long.parseLong(Config.get("generate.timestep"));
this.stop = options.endTime;
this.referenceTime = options.referenceTime;
this.location = new Location(options.state, options.city);
this.logLevel = Config.get("generate.log_patients.detail", "simple");
this.onlyDeadPatients = Config.getAsBoolean("generate.only_dead_patients");
this.onlyAlivePatients = Config.getAsBoolean("generate.only_alive_patients");
// If both values are set to true, then they are both set back to the default
if (this.onlyDeadPatients && this.onlyAlivePatients) {
Config.set("generate.only_dead_patients", "false");
Config.set("generate.only_alive_patients", "false");
this.onlyDeadPatients = false;
this.onlyAlivePatients = false;
}
try {
this.maxAttemptsToKeepPatient = Long.parseLong(Config.get("generate.max_attempts_to_keep_patient", "1000"));
if (this.maxAttemptsToKeepPatient == 0) {
// set it to null to make the check more clear
this.maxAttemptsToKeepPatient = null;
}
} catch (Exception e) {
this.maxAttemptsToKeepPatient = null;
}
this.onlyVeterans = Config.getAsBoolean("generate.veteran_population_override");
this.totalGeneratedPopulation = new AtomicInteger(0);
this.stats = Collections.synchronizedMap(new HashMap<String, AtomicInteger>());
this.modulePredicate = getModulePredicate();
stats.put("alive", new AtomicInteger(0));
stats.put("dead", new AtomicInteger(0));
if (Config.getAsBoolean("generate.track_detailed_transition_metrics", false)) {
this.metrics = new TransitionMetrics();
}
// initialize hospitals
Provider.loadProviders(location, this.clinicianRandom);
// Initialize Payers
Payer.loadPayers(location);
// ensure modules load early
if (options.localModuleDir != null) {
Module.addModules(options.localModuleDir);
}
List<String> coreModuleNames = getModuleNames(Module.getModules(path -> false));
List<String> moduleNames = getModuleNames(Module.getModules(modulePredicate));
if (options.keepPatientsModulePath != null) {
try {
Path path = options.keepPatientsModulePath.toPath().toAbsolutePath();
this.keepPatientsModule = Module.loadFile(path, false, null, true);
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
}
// ensure cost data loads early
Costs.loadCostData();
String locationName;
if (options.city == null) {
locationName = options.state;
} else {
locationName = options.city + ", " + options.state;
}
System.out.println("Running with options:");
System.out.println(String.format("Population: %d\nSeed: %d\nProvider Seed:%d\nReference Time: %d\nLocation: %s", options.population, options.seed, options.clinicianSeed, options.referenceTime, locationName));
System.out.println(String.format("Min Age: %d\nMax Age: %d", options.minAge, options.maxAge));
if (options.gender != null) {
System.out.println(String.format("Gender: %s", options.gender));
}
if (options.enabledModules != null) {
moduleNames.removeAll(coreModuleNames);
moduleNames.sort(String::compareToIgnoreCase);
System.out.println("Modules: " + String.join("\n & ", moduleNames));
System.out.println(String.format(" > [%d loaded]", moduleNames.size()));
}
if (Config.getAsBoolean("growtherrors", false)) {
HealthRecordEditors hrm = HealthRecordEditors.getInstance();
hrm.registerEditor(new GrowthDataErrorsEditor());
}
}
Aggregations