Skip to main content

Raxtik Synth

CI Docs codecov PyPI version Python Versions License: AGPL v3

raxtik-synth is an open-source Python library for generating realistic synthetic pharmacovigilance (PV) data. It provides structured adverse-event cases, patient demographics, medicinal products, clinical reactions, reporters, outcomes, and unstructured narratives for developing, testing, and evaluating safety systems.

The generated datasets are synthetic and privacy-preserving by design, enabling robust pipeline development, model benchmarking, and QA without dealing with sensitive Protected Health Information (PHI).


🎯 Use Cases

  • Pharmacovigilance Pipeline Testing: Simulate complete safety datasets for end-to-end ingestion, validation, and analytics pipeline verification.
  • Regulatory Form Generation (Downstream): Provide rich, schema-valid synthetic cases to document renderers (such as raxtik-forms) to test layout boundaries and overflow handling on standard CIOMS I and MedWatch 3500A documents.
  • AI & Document Extraction Benchmarking: Train and evaluate OCR, Document Layout Analysis, and LLM-based structured data extraction models on diverse synthetic medical scenarios.
  • Empirical Data Grounding: Seed synthetic cases with authentic co-occurrence patterns, dosages, and outcomes sampled from FDA FAERS safety data via raxtik-etl.

🛠️ Project Structure

raxtik-synth/
├── pyproject.toml         # Package definition and dependencies
├── README.md              # Project documentation
├── src/
│   └── raxtik_synth/
│       ├── __init__.py
│       ├── cli.py         # Command-line interface to generate datasets
│       ├── generators/    # Domain generators (patient, drug, event, narrative, reporter)
│       ├── models/        # Pydantic data models (BFC/E2B aligned)
│       └── sources/       # Empirical data sources (FAERS via raxtik-etl)
└── tests/                 # Unit and integration test suites

📦 Installation

Core Package

Install raxtik-synth using pip:

pip install raxtik-synth

Or using uv:

uv pip install raxtik-synth

Optional FAERS Integration

To enable empirical case sampling grounded in FDA FAERS datasets:

pip install "raxtik-synth[faers]"

For local development in editable mode:

pip install -e ".[faers]"

💻 Command-Line Interface (CLI)

Generate synthetic safety cases directly from the terminal:

# Print a single case to stdout
raxtik-synth

# Generate 10 reproducible cases and export to JSON
raxtik-synth --count 10 --seed 42 --output cases.json

# Generate line-delimited JSON (JSONL) for bulk streaming / ML training
raxtik-synth -n 100 -s 42 -o dataset.jsonl

🚀 Basic Python Usage

from raxtik_synth.generators import CaseGenerator

# Generate a reproducible adverse event case payload
generator = CaseGenerator(seed=42)
case = generator.generate_case()

print(case.model_dump_json(indent=2))

🧬 Regulatory & Clinical Data Models (E2B-Aligned)

raxtik-synth implements E2B(R2/R3)-aligned synthetic data models informed by the Backward and Forward Compatibility (BFC v2.02) specification covering CIOMS I, FDA Form 3500A (MedWatch), and ICH E2B (R2/R3):

  • Patient (Patient): Demographics, explicit CIOMS Box 2 Initials (initials), death details, and pre-existing conditions (medical_history).
  • Products (Product): Suspect and concomitant medications, indications, dosage regimens, routes, lot numbers, and therapy dates.
  • Reactions (Reaction & SeriousnessCriteria): MedDRA Preferred Terms (PT), Lower Level Terms (LLT), onset dates, dechallenge/rechallenge outcomes, and ICH seriousness criteria.
  • Laboratory Investigations (LabTest): CIOMS Box 12 / E2B Section F.r test results, reference ranges (normal_low, normal_high), units, and clinical comments.
  • Clinical Context:
    • ParentInfo (Section D.10): For parent-child / in-utero exposure reports.
    • StudyInfo (Section C.5): Clinical study protocols, phases, and sponsor numbers.
    • DeviceDetails (Section G.k): Medical devices and drug-device combination products.
    • CausalityAssessment (Section G.k.9.i.2.r): Drug-event causality determinations (e.g. WHO-UMC).
  • Clinical Narrative (CaseNarrative): Unstructured case narrative text and structured medical history items (MedicalHistoryItem for CIOMS Box 13).

⚡ Integration with raxtik-etl (FDA FAERS Data)

raxtik-synth supports optional empirical data integration through raxtik-etl, enabling synthetic PV datasets informed by real-world FAERS distributions:

# Optional empirical data integration through raxtik-etl
try:
    from raxtik_synth.sources.faers import FAERSSource

    # Initialize data source grounded in empirical FAERS package
    source = FAERSSource(period="2004Q1")
    # case = source.generate_case()
except (ImportError, FileNotFoundError):
    pass

Interactive demonstrations and benchmarks are available in notebooks/raxtik_faers_integration_demo.ipynb.


👥 Contributors

Contributions are welcome! Please see contributor.md for the list of people who have contributed to this project.

Metadata

Release files for raxtik-synth 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raxtik-synth 0.1.0
File Size Uploaded Provenance Actions
raxtik_synth-0.1.0.tar.gz 56.5 kB With provenance Details for raxtik_synth-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for raxtik-synth 0.1.0
File Interpreter ABI Platform Actions
raxtik_synth-0.1.0-py3-none-any.whl Python 3 none any Details for raxtik_synth-0.1.0-py3-none-any.whl

Total release size: 110.5 kB

Release files / raxtik_synth-0.1.0.tar.gz

Download URL raxtik_synth-0.1.0.tar.gz
Size 56.5 kB
Tags Source
SHA-256 checksum
How to use checksums
44b36e7e2c5e5b495f571af0cef864c6a88b29b1e804f39a625f53ddc488bb2d
BLAKE2b-256 checksum
How to use checksums
eb5d93326bed30b357619b3defbd4b94199d2ceb4d62d0734f0b9950232692e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / raxtik_synth-0.1.0-py3-none-any.whl

Download URL raxtik_synth-0.1.0-py3-none-any.whl
Size 53.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80c9e53566a6ae269ed4aee96a8b95df88885afdc18af2d78e85725ffb4640c7
BLAKE2b-256 checksum
How to use checksums
4423116265f90653f5295d7fe76f4d9d982b6b2218d4409cd665519093048b39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for raxtik-synth 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for raxtik_synth-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page