Skip to content

Implement profile generator of patientZero#12

Merged
Sahandfer merged 6 commits into
masterfrom
feature/patientZero
May 8, 2026
Merged

Implement profile generator of patientZero#12
Sahandfer merged 6 commits into
masterfrom
feature/patientZero

Conversation

@w1z1x0
Copy link
Copy Markdown
Collaborator

@w1z1x0 w1z1x0 commented May 3, 2026

Summary

It builds a disease-grounded synthetic patient record through disease outline generation, epidemiological attribute sampling, patient profile/symptom generation, examination result generation, and validation-driven retry.

How It Works

The generator follows the Patient-Zero static synthesis flow:

  1. Standardizes raw disease knowledge into a structured DiseaseOutline.
  2. Samples patient attributes from global and disease-specific priors with hard demographic constraints.
  3. Generates patient profile and symptom trajectory from the sampled attributes and disease outline.
  4. Generates psychiatric examination results using disease-specific examination references and selected scales.
  5. Validates patient records and examination results with LLM critic prompts.
  6. On validation failure, feeds revision guidance into the next retry attempt.
  7. Saves intermediate outputs under data/resources/PatientZero/ and the final record to data/characters/PatientZero.json.

How to Use

Generate through the standard generator entrypoint by setting disease_key in PatientZeroGeneratorConfig:

from patienthub.generators.patientZero import PatientZeroGenerator, PatientZeroGeneratorConfig

config = PatientZeroGeneratorConfig(disease_key="depression")
generator = PatientZeroGenerator(config)
record = generator.generate_character()

For reproducible direct generation, call generate_static_record with a seed:

record = generator.generate_static_record("depression", seed=13)

Add New Disease

To add a new disease, provide the disease source knowledge and disease-specific generation references in the Patient-Zero resource directory.

Files to update:

  • data/resources/PatientZero/raw_outlines/
    Add one raw disease outline JSON for the new disease.
  • data/resources/PatientZero/disease_attribute_priors.json
    Add disease-specific demographic, severity, and lifestyle prior overrides if needed.
  • data/resources/PatientZero/exam_references.json
    Add the disease examination reference, including selected scales and expected findings.
  • data/resources/PatientZero/disease_outlines/
    This can be generated automatically by generate_disease_outline() from the raw outline.

After adding the resources, run generation with the new disease_key.

w1z1x0 and others added 6 commits May 4, 2026 02:19
1. merge outline files
2. final character output file
3. delete inter-results of exam and symptoms
4. mv profile schema to schemas folder
5. delete prefix '_' in front of functions
6. docs
7. attribute priors' sources
@Sahandfer Sahandfer merged commit 0b55dd8 into master May 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants