JSON Export - synthetichealth/synthea GitHub Wiki

JSON Export

The JSON Export is somewhat close to a Synthea "object dump". It uses the Gson library to serialize instances of the Person class into JSON. Each Person is written into a single JSON file in a directory called json, where ever Synthea is configured to output records.

Export Properties

Each JSON file will contain a single object with the following properties:

  • attributes - the Map of properties associated with the Person. There is a lot of information in this property. Some information is removed prior to export. See below for details.
  • coverage - the Person's CoverageRecord
  • lastUpdated - time in the simulation that the Person was last updated
  • seed - random seed used in generation
  • record or records - A Person's HealthRecord. If the Person has a single HealthRecord, then the property will be called record. If there are multiple, the property will be called records

What is not exported

  • Any java fields marked as static, transient or volatile. These fields are often references to look up data structures.
  • Person.attributes with key names starting with "ehr_", containing "lookup" or containing "UUID".
    • The "ehr_" attributes are generated by the ClinicalNoteExporter and contain references to objects in the HealthRecord, so nothing is really lost by dropping it.
    • "lookup" attributes are dropped because they contain look up tables.
    • "UUID" attributes are dropped because they contain UUID generators, not UUIDs themselves. UUID generators in Synthea are problematic for JSON export, as they often contain a reference to the Person as a source of randomness. This creates a circular reference.
  • Payer export is limited to name and UUID. This eliminates many circular references and references to information held elsewhere.
  • Any instance of Module or anything that subclasses it gets skipped in the export.

Export of State and Module History

Synthea stores the path an individual takes through each module in Person.attributes. Each module history is stored in a key that is the name of the module. By default, module history is removed before export into JSON. It can be enabled through configuration.

If module history export is enabled, it will be available under the attributes property. Each module will have history under a property that is its name. The history is a JSON Array. The objects in the array, each representing a state, have the following properties:

  • state_name
  • entered (optional)
  • exited (optional)

Configuration

exporter.json.export set to true to enable JSON Export. The default is false.

exporter.json.include_module_history set to true to enable export of module history in Person.attributes. The default is false.