Skip to content

Commit 7743f73

Browse files
committed
Small updates to add defaults for missing data or configuration settings, mostly applicable to synthea-international configurations.
1 parent 055d977 commit 7743f73

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

src/main/java/org/mitre/synthea/world/agents/PayerManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,24 +256,24 @@ private static void csvLineToPlan(Map<String, String> line) {
256256
// Return without an error, because the given payer might only exist in another state.
257257
return;
258258
}
259-
String planName = line.remove(NAME).trim();
260259
Set<String> servicesCovered
261260
= commaSeparatedStringToHashSet(line.remove(SERVICES_COVERED).trim());
262261
BigDecimal deductible = new BigDecimal(line.remove(DEDUCTIBLE).trim());
263262
BigDecimal defaultCoinsurance = new BigDecimal(line.remove(COINSURANCE).trim());
264263
BigDecimal defaultCopay = new BigDecimal(line.remove(COPAY).trim());
265264
BigDecimal monthlyPremium = new BigDecimal(line.remove(MONTHLY_PREMIUM).trim());
266265
boolean medicareSupplement = Boolean.parseBoolean(line.remove(MEDICARE_SUPPLEMENT).trim());
267-
boolean isACA = Boolean.parseBoolean(line.remove(ACA).trim());
268-
boolean incomeBasedPremium = Boolean.parseBoolean(line.remove(INCOME_BASED_PREMIUM).trim());
266+
boolean isACA = Boolean.parseBoolean(line.getOrDefault(ACA, "false").trim());
267+
boolean incomeBasedPremium
268+
= Boolean.parseBoolean(line.getOrDefault(INCOME_BASED_PREMIUM, "false").trim());
269269
String yearStartStr = line.remove(START_YEAR).trim();
270270
int yearStart = yearStartStr.equals("") ? 0 : Integer.parseInt(yearStartStr);
271271
String yearEndStr = line.remove(END_YEAR).trim();
272272
int yearEnd = StringUtils.isBlank(yearEndStr)
273273
? Integer.MAX_VALUE : Integer.parseInt(yearEndStr);
274-
BigDecimal maxOutOfPocket = new BigDecimal(line.remove(MAX_OOP).trim());
274+
BigDecimal maxOutOfPocket = new BigDecimal(line.getOrDefault(MAX_OOP, "0").trim());
275275
// If the priority is blank, give it minimum priority (maximum int value).
276-
String priorityString = line.remove(PRIORITY_LEVEL).trim();
276+
String priorityString = line.getOrDefault(PRIORITY_LEVEL,"").trim();
277277
int priority = StringUtils.isBlank(priorityString)
278278
? Integer.MAX_VALUE : Integer.parseInt(priorityString);
279279
String eligibilityName = line.remove(ELIGIBILITY_POLICY);

src/main/java/org/mitre/synthea/world/agents/behaviors/providerfinder/ProviderFinderNearest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public Provider find(List<Provider> providers, Person person, EncounterType serv
3030
|| !(service.equals(EncounterType.URGENTCARE) || service.equals(EncounterType.EMERGENCY))) {
3131
// Filter to only VA Facilities if the person is a veteran
3232
if (person.attributes.containsKey(Person.VETERAN)) {
33-
options = options.filter(p -> ProviderType.VETERAN.equals(p.type));
34-
}
35-
36-
// Filter out IHS facilities if someone is not Native American
37-
if (! "native".equals(person.attributes.get(Person.RACE))) {
33+
if (providers.stream().anyMatch(p -> ProviderType.VETERAN.equals(p.type))) {
34+
options = options.filter(p -> ProviderType.VETERAN.equals(p.type));
35+
}
36+
} else if (! "native".equals(person.attributes.get(Person.RACE))) {
37+
// Filter out IHS facilities if someone is not Native American
3838
options = options.filter(p -> ! ProviderType.IHS.equals(p.type));
3939
}
4040
}

src/main/java/org/mitre/synthea/world/concepts/healthinsurance/InsurancePlan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public BigDecimal payMonthlyPremium(double employerLevel, int income) {
158158
&& (!this.payer.isGovernmentPayer() && !this.isACA)) {
159159
// If this is a private plan non-ACA plan, then employers will provide coverage.
160160
double employeeContribution
161-
= 1.0 - Config.getAsDouble("generate.insurance.employer_coverage");
161+
= 1.0 - Config.getAsDouble("generate.insurance.employer_coverage", 0.83);
162162
premiumPrice = premiumPrice.multiply(new BigDecimal(employeeContribution));
163163
}
164164
return premiumPrice;

src/main/java/org/mitre/synthea/world/geography/Location.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@ public Location(String state, String city) {
172172
averages.put(determinant, (probability / socialDeterminantsOfHealth.keySet().size()));
173173
}
174174
socialDeterminantsOfHealth.put("AVERAGE", averages);
175+
} else {
176+
// An SDoH file was not provided, and a non-fatal exception was caught above.
177+
// This can occur with older synthea-international configurations.
178+
String[] determinants = { Person.FOOD_INSECURITY, Person.SEVERE_HOUSING_COST_BURDEN,
179+
Person.UNEMPLOYED, Person.NO_VEHICLE_ACCESS, Person.UNINSURED };
180+
Map<String, Double> averages = new HashMap<String, Double>();
181+
for (String determinant : determinants) {
182+
averages.put(determinant, 0.5);
183+
}
184+
socialDeterminantsOfHealth.put("AVERAGE", averages);
175185
}
176186
}
177187

0 commit comments

Comments
 (0)