mednotegen
This project uses Synthea™ to generate realistic synthetic patient data for medical notes.
Usage
from mednotegen.generator import NoteGenerator
gen = NoteGenerator.from_config("config.yaml")
gen.generate_notes(10, "output_dir")
# Or specify Synthea CSV directory directly:
gen = NoteGenerator(synthea_csv_dir="/path/to/synthea/output/csv")
gen.generate_notes(10, "output_dir")
Using a Custom Synthea Directory with config.yaml
You can specify the Synthea CSV directory directly in your config file. Add the following line to your config.yaml:
Example config.yaml:
count: 10
output_dir: output_dir
synthea_csv_dir: /path/to/synthea/output/csv
Then generate notes using:
from mednotegen.generator import NoteGenerator
gen = NoteGenerator.from_config("config.yaml")
gen.generate_notes(10, "output_dir")
⚠️ Synthea Dependency Required
This project requires Synthea™, an open-source synthetic patient generator, as an external dependency. You must clone and build Synthea yourself before using mednotegen.
To set up Synthea:
- Clone Synthea
git clone https://github.com/synthetichealth/synthea.git
- Build the Synthea JAR
cd synthea ./gradlew build check test cp build/libs/synthea-with-dependencies.jar . cd ..
Ensuresynthea-with-dependencies.jaris in thesynthea/directory at the root of your project.
Configuration (config.yaml)
You can customize patient generation and report output using a config.yaml file. Example options:
count: 10 # Number of reports to generate
output_dir: output_dir # Output directory for PDFs
use_llm: false # Use LLM for report generation
synthea_csv_dir: /path/to/synthea/output/csv # Path to Synthea-generated CSV files
seed: 1234 # Random seed for reproducibility
reference_date: "20250628" # Reference date for data generation (YYYYMMDD)
clinician_seed: 5678 # Optional: separate seed for clinician assignment
gender: female # male, female, or any
min_age: 30 # Minimum patient age
max_age: 60 # Maximum patient age
state: New York # Synthea state parameter
modules:
- cardiovascular-disease
- diabetes
- hypertension
- asthma
local_config: custom_synthea.properties # Custom Synthea config file
local_modules: ./synthea_modules # Directory for custom modules
- count: Number of reports to generate
- output_dir: Directory to save generated PDFs
- use_llm: If true, uses OpenAI LLM for report text
- seed: Random seed for reproducibility
- reference_date: Reference date for age calculations (YYYYMMDD)
- clinician_seed: Optional, separate seed for clinician assignment
- gender: Gender filter for patients (
male,female, orany) - min_age, max_age: Age range for patients
- state: US state for Synthea simulation
- modules: Synthea disease modules to enable
- local_config: Path to a custom Synthea config file
- local_modules: Directory for custom Synthea modules
More Synthea Modules
For an up-to-date and complete list of available modules, see the official Synthea modules directory.
Troubleshooting:
Synthea Data Location
If you see errors about missing patients.csv, medications.csv, or conditions.csv, make sure you have generated Synthea data and that the path you provide (via synthea_csv_dir, CLI, or config) points to the correct directory containing those files.
If you installed mednotegen via pip, the default location is inside the package directory. For custom or system-wide Synthea runs, always specify the output CSV directory explicitly.
- No CSV files generated:
- Make sure you edited the correct
synthea.propertiesand used the-cflag when running Synthea. - Ensure
exporter.csv.export = trueis set and not overridden elsewhere in the file.
- Make sure you edited the correct
- FileNotFoundError for CSVs:
- Confirm the CSV files exist in the path specified by
synthea_csv_diror in the expected package location.
- Confirm the CSV files exist in the path specified by
- ValueError: No patients found matching the specified filters:
- Check your age/gender filters in
config.yaml. Try relaxing them if you have too few patients.
- Check your age/gender filters in
Configure Synthea to Export CSVs
Edit src/main/resources/synthea.properties in your Synthea directory:
exporter.csv.export = true
(Ensure any exporter.csv.export = false lines are removed or commented out.)
Generate Patient Data with Synthea
From your Synthea directory, clean any old output and generate new data:
rm -rf output/
java -jar synthea-with-dependencies.jar -c src/main/resources/synthea.properties -p 1000
- The
-p 1000flag generates 1000 patients. - After running, check for CSV files in
output/csv/.
Attribution
See README_SYNTHEA_NOTICE.md and LICENSE-APACHE-2.0 for license and attribution requirements.
Metadata
Release files for mednotegen 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mednotegen-0.1.2.tar.gz | 14.3 kB | Without provenance | Details for mednotegen-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mednotegen-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for mednotegen-0.1.2-py3-none-any.whl |
Total release size: 28.2 kB
Release files / mednotegen-0.1.2.tar.gz
| Download URL | mednotegen-0.1.2.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23ec9e2edf97e77c004818d8335de72500e64673594a4cb3ce5c6874311fbd0e
|
|
BLAKE2b-256 checksum How to use checksums |
f19fb4dd049b9a73a93b35a666b110ebf3569c0bcdcaeb39eb6298caa9c238b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / mednotegen-0.1.2-py3-none-any.whl
| Download URL | mednotegen-0.1.2-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9dea9607f01eb415a5c6bafb19725eed60d20db2898bcda3c000556ada22758f
|
|
BLAKE2b-256 checksum How to use checksums |
f7c59c20c2c5c3c9cb55e44cd904e4bb0590ab4f981d970429256b0505604d3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for mednotegen 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.