This document provides detailed information about the integration with Synthea synthetic patient data in the Australian Health Insurance Simulation project.
Synthea is an open-source synthetic patient generator that creates realistic but synthetic patient records. This project integrates Synthea data to enhance the health insurance simulation with detailed clinical information.
The integration allows:
- Importing Synthea FHIR patient data into the insurance database
- Linking synthetic patients to insurance members
- Generating insurance claims based on Synthea encounters
- Creating a more realistic end-to-end healthcare simulation
The standard Synthea data is adapted for the Australian healthcare context with:
-
Australian Demographics:
- Australian postcodes and states
- Adjusted disease prevalence to match Australian population
- Australian naming patterns
-
Australian Healthcare System:
- Medicare Benefits Schedule (MBS) item numbers
- Pharmaceutical Benefits Scheme (PBS) medications
- Australian hospital and provider naming conventions
-
Insurance-Specific Adaptations:
- Hospital tiers (Basic, Bronze, Silver, Gold)
- Waiting periods
- Lifetime Health Cover (LHC) loading
- Private Health Insurance (PHI) rebate
The integration uses three main tables in the Integration schema:
-
Integration.SyntheaPatients:
- Links Synthea patients to insurance members
- Stores the complete FHIR Patient resource as JSON
- Tracks import date and modifications
-
Integration.SyntheaEncounters:
- Links Synthea encounters to insurance claims
- Stores the complete FHIR Encounter resource as JSON
- Contains references to the patient and provider
-
Integration.SyntheaProcedures:
- Links Synthea procedures to insurance claims
- Stores the complete FHIR Procedure resource as JSON
- Contains references to the encounter and patient
- Download and set up Synthea from GitHub
- Configure Synthea for Australian context (see configuration examples in
synthea_configs/) - Generate patient data:
./run_synthea -p 100 Australia
- The generated FHIR JSON files will be in the
output/fhirdirectory
Use the import_synthea.py script to import Synthea data:
python import_synthea.py --dir path/to/synthea/output/fhir --patients 100Options:
--dir: Directory containing Synthea FHIR JSON files (required)--patients: Limit on number of patients to import (default: all)--encounters: Limit on number of encounters to import (default: all)--procedures: Limit on number of procedures to import (default: all)--skip-patients: Skip patient import--skip-encounters: Skip encounter import--skip-procedures: Skip procedure import
Use the generate_synthea_claims.py script to generate insurance claims from Synthea encounters:
python generate_synthea_claims.py --claims 50Options:
--claims: Number of claims to generate (default: 50)--start-date: Start date for claims (default: 30 days ago)--end-date: End date for claims (default: today)--hospital-ratio: Ratio of hospital claims (default: 0.2)
The integration follows these steps:
-
Patient-Member Matching:
- Synthea patients are matched to insurance members
- Matching uses name, date of birth, and address
- New members are created if no match is found
-
Encounter Processing:
- Encounters are processed to extract service information
- Hospital encounters are mapped to hospital claims
- Other encounters are mapped to general treatment claims
-
MBS Code Mapping:
- Synthea SNOMED codes are mapped to Australian MBS codes
- Default MBS codes are used when no mapping exists
- MBS codes determine Medicare benefits and gap amounts
-
Claim Generation:
- Claims are generated with appropriate service dates
- Claim amounts are calculated based on service type
- Excess and gap amounts are applied according to policy
Mapping files in the mappings/ directory control how Synthea data is interpreted:
snomed_to_mbs.json: Maps SNOMED codes to MBS item numbersprovider_types.json: Maps Synthea organization types to provider typesencounter_types.json: Maps Synthea encounter types to claim types
The integration behavior can be customized in health_insurance_au/config.py:
SYNTHEA_INTEGRATION: General integration settingsSYNTHEA_CLAIM_GENERATION: Claim generation parametersSYNTHEA_MBS_MAPPING: MBS mapping parameters
You can import custom FHIR resources by extending the SyntheaImporter class:
from health_insurance_au.integration.synthea import SyntheaImporter
class CustomImporter(SyntheaImporter):
def process_custom_resource(self, resource):
# Custom processing logic
pass
importer = CustomImporter()
importer.import_directory('path/to/fhir/files')The integration supports bidirectional data flow:
- Synthea to Insurance: Import patient data and generate claims
- Insurance to Synthea: Export member data to create targeted Synthea patients
Use the export_members_for_synthea.py script for the second direction:
python export_members_for_synthea.py --members 50 --output members.csv- Missing FHIR resources: Ensure the Synthea output directory contains valid FHIR JSON files
- Mapping errors: Check the mapping files for missing codes
- Database errors: Verify database connection and permissions
- Duplicate patients: Use the
--skip-patientsoption if patients are already imported
Enable detailed logging for troubleshooting:
python import_synthea.py --dir path/to/fhir --log-level DEBUG