Package org.mitre.synthea.engine
Class Generator
java.lang.Object
org.mitre.synthea.engine.Generator
Generator creates a population by running the generic modules each timestep
per Person.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHelper class following the "Parameter Object" pattern. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThe state to default tostatic EntityManagerEntityManager is used to manage fixed patient demographics records.final UUIDUnique ID for this instance of the Generator.The location where the population is generated.Options for configuring the generator.longThe reference time for the simulation, in milliseconds since epoch.Statistics about the generated population, such as counts of alive and dead individuals.longThe time at which the simulation stops, in milliseconds since epoch.final intThe size of the thread pool used for generating patients.longThe amount of time per timestep, in milliseconds.The total number of individuals generated in the population. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a Generator, using all default settings.Generator(int population) Create a Generator, with the given population size and seed.Generator(int population, long seed, long clinicianSeed) Create a Generator, with the given population size and seed.Create a Generator, with the given options.Generator(Generator.GeneratorOptions o, org.mitre.synthea.export.Exporter.ExporterRuntimeOptions ero) Create a Generator, with the given options. -
Method Summary
Modifier and TypeMethodDescriptionorg.mitre.synthea.engine.Generator.CriteriaCheckcheckCriteria(Person person, long finishTime, int index, boolean isAlive) Determines if a patient meets the requested criteria.createPerson(long personSeed, Map<String, Object> demoAttributes) Create a new person and update them until Generator.stop or they die, whichever comes sooner.generatePerson(int index) Deprecated.generatePerson(int index, long personSeed) Generate a random Person, from the given seed.Get the seeded random number generator used by this Generator.pickFixedDemographics(Entity entity, RandomNumberGenerator random) Pick a person's demographics based on their seed fixed record.Create a set of random demographics.voidrecordPerson(Person person, int index) Record the person using whatever tracking mechanisms are currently configured.voidrun()Generate the population, using the currently set configuration settings.voidupdatePerson(Person person) Update a previously created person from the time they were last updated until Generator.stop or they die, whichever comes sooner.updateRecordExportPerson(Person person, int index) Update person record to stop time, record the entry and export record.
-
Field Details
-
id
Unique ID for this instance of the Generator. Even if the same settings are used multiple times, this ID should be unique. -
options
Options for configuring the generator. -
timestep
public long timestepThe amount of time per timestep, in milliseconds. -
stop
public long stopThe time at which the simulation stops, in milliseconds since epoch. -
referenceTime
public long referenceTimeThe reference time for the simulation, in milliseconds since epoch. -
stats
Statistics about the generated population, such as counts of alive and dead individuals. -
location
The location where the population is generated. -
totalGeneratedPopulation
The total number of individuals generated in the population. -
DEFAULT_STATE
The state to default to -
entityManager
EntityManager is used to manage fixed patient demographics records. -
threadPoolSize
public final int threadPoolSizeThe size of the thread pool used for generating patients.
-
-
Constructor Details
-
Generator
public Generator()Create a Generator, using all default settings. -
Generator
public Generator(int population) Create a Generator, with the given population size and seed. All other settings are left as defaults.- Parameters:
population- Target population size
-
Generator
public Generator(int population, long seed, long clinicianSeed) Create a Generator, with the given population size and seed. All other settings are left as defaults.- Parameters:
population- Target population sizeseed- Seed used for randomnessclinicianSeed- Seed used for clinician randomness
-
Generator
Create a Generator, with the given options.- Parameters:
o- Desired configuration options
-
Generator
public Generator(Generator.GeneratorOptions o, org.mitre.synthea.export.Exporter.ExporterRuntimeOptions ero) Create a Generator, with the given options.- Parameters:
o- Desired configuration optionsero- Desired exporter options
-
-
Method Details
-
run
public void run()Generate the population, using the currently set configuration settings. -
generatePerson
Deprecated.Generate a completely random Person. The returned person will be alive at the end of the simulation. This means that if in the course of the simulation the person dies, a new person will be started to replace them. The seed used to generate the person is randomized as well. Note that this method is only used by unit tests.- Parameters:
index- Target index in the whole set of people to generate- Returns:
- generated Person
-
generatePerson
Generate a random Person, from the given seed. The returned person will be alive at the end of the simulation. This means that if in the course of the simulation the person dies, a new person will be started to replace them. Note also that if the person dies, the seed to produce them can't be re-used (otherwise the new person would die as well) so a new seed is picked, based on the given seed.- Parameters:
index- Target index in the whole set of people to generatepersonSeed- Seed for the random person- Returns:
- generated Person
-
checkCriteria
public org.mitre.synthea.engine.Generator.CriteriaCheck checkCriteria(Person person, long finishTime, int index, boolean isAlive) Determines if a patient meets the requested criteria. If a patient does not meet the criteria the process will be repeated so a new one is generated.- Parameters:
person- the patient to check if we want to export themfinishTime- the time simulation finishedindex- Target index in the whole set of people to generateisAlive- Whether the patient is alive at end of simulation.- Returns:
- CriteriaCheck to determine if the patient should be exported/re-simulated
-
updateRecordExportPerson
Update person record to stop time, record the entry and export record.- Parameters:
person- the person to update and exportindex- the index of the person being updated- Returns:
- the updated person
-
createPerson
Create a new person and update them until Generator.stop or they die, whichever comes sooner.- Parameters:
personSeed- Seed for the random persondemoAttributes- Demographic attributes for the new person,randomDemographics(org.mitre.synthea.helpers.RandomNumberGenerator)- Returns:
- the new person
-
updatePerson
Update a previously created person from the time they were last updated until Generator.stop or they die, whichever comes sooner.- Parameters:
person- the previously created person to update
-
randomDemographics
Create a set of random demographics.- Parameters:
random- The random number generator to use.- Returns:
- a map of random demographics
-
pickFixedDemographics
Pick a person's demographics based on their seed fixed record.- Parameters:
entity- The record group to pull demographics from.random- Random object.- Returns:
- a map of fixed demographics
-
recordPerson
Record the person using whatever tracking mechanisms are currently configured.- Parameters:
person- the person to recordindex- the index of the person being recorded, e.g. if generating 100 people, the index would identify which of those 100 is being recorded.
-
getRandomizer
Get the seeded random number generator used by this Generator.- Returns:
- the random number generator.
-