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.1

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.1
File Size Uploaded Provenance Actions
raxtik_synth-0.1.1.tar.gz 57.2 kB With provenance Details for raxtik_synth-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 111.2 kB

Release files / raxtik_synth-0.1.1.tar.gz

Download URL raxtik_synth-0.1.1.tar.gz
Size 57.2 kB
Tags Source
SHA-256 checksum
How to use checksums
da9c8eeb37713e4f5a8993ab10773c11291847e56a27b9b5d93e726c75dcd520
BLAKE2b-256 checksum
How to use checksums
94d5e897484b89354126f7eef110bb8ee577c3f8f846637706484516ba12f94d
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 29, 2026.

Transparency log

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

Download URL raxtik_synth-0.1.1-py3-none-any.whl
Size 54.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53f137e6581b0e614925110488e1edcf62cac38550f1e7f3e8fde5d50636c9c4
BLAKE2b-256 checksum
How to use checksums
7cfc884edbc32e1329af214a4f473734cfcc15a8369868aabb8e0e6fc3036a76
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 29, 2026.

Transparency log

Security for raxtik-synth 0.1.1

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.1.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 29, 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.1 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