use of org.mitre.synthea.world.geography.Demographics in project synthea by synthetichealth.
the class Generator method pickFixedDemographics.
/**
* Pick a person's demographics based on their FixedRecords.
* @param index The index to use.
* @param random Random object.
*/
private Map<String, Object> pickFixedDemographics(int index, Random random) {
// Get the first FixedRecord from the current RecordGroup
FixedRecordGroup recordGroup = this.recordGroups.get(index);
FixedRecord fr = recordGroup.records.get(0);
// Get the city from the location in the fixed record.
this.location = new Location(fr.state, recordGroup.getSafeCity());
Demographics city = this.location.randomCity(random);
// Pick the rest of the demographics based on the location of the fixed record.
Map<String, Object> demoAttributes = pickDemographics(random, city);
// Overwrite the person's attributes with the FixedRecord.
demoAttributes.put(Person.BIRTHDATE, recordGroup.getValidBirthdate());
demoAttributes.put(Person.BIRTH_CITY, city.city);
String g = fr.gender;
if (g.equalsIgnoreCase("None") || StringUtils.isBlank(g)) {
g = "F";
}
demoAttributes.put(Person.GENDER, g);
// Give the person their FixedRecordGroup of FixedRecords.
demoAttributes.put(Person.RECORD_GROUP, recordGroup);
demoAttributes.put(Person.LINK_ID, recordGroup.linkId);
// Return the Demographic Attributes of the current person.
return demoAttributes;
}
use of org.mitre.synthea.world.geography.Demographics in project synthea by synthetichealth.
the class Generator method randomDemographics.
/**
* Create a set of random demographics.
* @param random The random number generator to use.
* @return demographics
*/
public Map<String, Object> randomDemographics(Random random) {
Demographics city = location.randomCity(random);
Map<String, Object> demoAttributes = pickDemographics(random, city);
return demoAttributes;
}
use of org.mitre.synthea.world.geography.Demographics in project synthea by synthetichealth.
the class Provider method generateClinician.
/**
* Generate a random clinician, from the given seed.
*
* @param clinicianSeed
* Seed for the random clinician
* @return generated Clinician
*/
private Clinician generateClinician(long clinicianSeed, Random clinicianRand, long clinicianIdentifier) {
Clinician clinician = null;
try {
Person doc = new Person(clinicianIdentifier);
Demographics cityDemographics = location.randomCity(doc);
Map<String, Object> out = new HashMap<>();
String race = cityDemographics.pickRace(clinicianRand);
out.put(Person.RACE, race);
String ethnicity = cityDemographics.pickEthnicity(clinicianRand);
out.put(Person.ETHNICITY, ethnicity);
String language = cityDemographics.languageFromRaceAndEthnicity(race, ethnicity, clinicianRand);
out.put(Person.FIRST_LANGUAGE, language);
String gender = cityDemographics.pickGender(clinicianRand);
if (gender.equalsIgnoreCase("male") || gender.equalsIgnoreCase("M")) {
gender = "M";
} else {
gender = "F";
}
out.put(Person.GENDER, gender);
clinician = new Clinician(clinicianSeed, clinicianRand, clinicianIdentifier, this);
clinician.attributes.putAll(out);
clinician.attributes.put(Person.ADDRESS, address);
clinician.attributes.put(Person.CITY, city);
clinician.attributes.put(Person.STATE, state);
clinician.attributes.put(Person.ZIP, zip);
clinician.attributes.put(Person.COORDINATE, coordinates);
String firstName = Names.fakeFirstName(gender, language, doc);
String lastName = Names.fakeLastName(language, doc);
clinician.attributes.put(Clinician.FIRST_NAME, firstName);
clinician.attributes.put(Clinician.LAST_NAME, lastName);
clinician.attributes.put(Clinician.NAME, firstName + " " + lastName);
clinician.attributes.put(Clinician.NAME_PREFIX, "Dr.");
// Degree's beyond a bachelors degree are not currently tracked.
clinician.attributes.put(Clinician.EDUCATION, "bs_degree");
String ssn = "999-" + ((doc.randInt(99 - 10 + 1) + 10)) + "-" + ((doc.randInt(9999 - 1000 + 1) + 1000));
clinician.attributes.put(Person.IDENTIFIER_SSN, ssn);
} catch (Throwable e) {
e.printStackTrace();
throw e;
}
return clinician;
}
Aggregations