Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

raxtik-etl ⚡

Documentation Status CI codecov License: AGPL v3 Python >= 3.11

High-performance canonical pharmacovigilance (PV) data engine and packaging toolkit powered by DuckDB and Polars.

raxtik-etl provides canonical schema definitions, multi-version case deduplication algorithms, and self-describing dataset packaging (DuckDB & Parquet) for safety surveillance datasets. It is completely decoupled from source-specific ingestion logic via an extensible Source Adapter Protocol.

👉 Architecture & Design: See Architecture Overview for plugin decoupling and internal pipeline design.


🏛️ Canonical Data Model & Entity Relationships

Every source connector projects raw records into an analytical star-schema architecture:

  • 7 Core Fact Tables: Normalized clinical entities (demo, drug, reac, outc, indi, ther, rpsr).
  • Authoritative Case View (cases): Deduplicates multi-version submissions across reporting periods (case_id / canonical_case_version / fda_date) and computes key safety flags (has_serious_outcome, is_death, is_expedited).
  • 16 Reference Dimensions (_code_*): Embedded lookup tables mapping ISO country codes, ICH E2B(R2/R3) guidelines, and FDA clinical codelists.
erDiagram
    demo ||--o{ drug : "primary_id"
    demo ||--o{ reac : "primary_id"
    demo ||--o{ outc : "primary_id"
    demo ||--o{ rpsr : "primary_id"
    drug ||--o{ indi : "primary_id, drug_seq"
    drug ||--o{ ther : "primary_id, drug_seq"

    demo {
        BIGINT primary_id PK "Unique submission report ID"
        BIGINT case_id "Unique patient case identifier"
        INTEGER case_version "Report version number"
        VARCHAR event_country "Country where reaction occurred"
        VARCHAR reporter_country_code "ISO 3166-1 alpha-2"
        DATE fda_date "Receipt date at FDA"
        VARCHAR age_group_code "ICH life stage classification"
        DOUBLE standard_age_years "Normalized age in decimal years"
        VARCHAR standard_sex_label "Male / Female / Unknown"
        DOUBLE standard_weight_kg "Normalized patient weight in kg"
        VARCHAR reporter_occupation_label "Physician, Pharmacist, Consumer..."
        VARCHAR report_type_label "Expedited 15-day, Periodic, Direct..."
    }

    drug {
        BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
        INTEGER drug_seq PK "Exposure sequence per report (Composite PK Part 2)"
        VARCHAR role_code "Role: PS, SS, C, I"
        VARCHAR standard_role_label "Primary Suspect, Concomitant..."
        VARCHAR reported_drug_name "Reported medicinal trade/brand name"
        VARCHAR active_ingredient "Normalized generic active substance"
        VARCHAR route "Administration route (Oral, IV...)"
        VARCHAR dose_form "Dosage formulation (Tablet, Solution...)"
        DOUBLE cumulative_dose "Normalized cumulative amount"
        VARCHAR cumulative_dose_unit_label "Metric dose unit (mg, mL...)"
    }

    reac {
        BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
        VARCHAR reported_reaction_term PK "MedDRA Preferred Term (Composite PK Part 2)"
        BIGINT reaction_seq "Reaction sequence ordinal"
        VARCHAR drug_reaction_action "Action taken with drug"
    }

    outc {
        BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
        VARCHAR outc_code PK "Seriousness criterion: DE, HO, LT, DS, CA, RI, OT (Composite PK Part 2)"
        VARCHAR standard_outc_label "Death, Hospitalization, Life-threatening..."
        BOOLEAN is_death "Flag for fatal outcome (DE)"
        BOOLEAN is_serious "Flag for serious adverse event"
    }

    indi {
        BIGINT primary_id PK,FK "Composite PK Part 1 / References drug(primary_id, drug_seq)"
        INTEGER indi_drug_seq PK,FK "Composite PK Part 2 / References drug(primary_id, drug_seq)"
        VARCHAR reported_indication_term PK "MedDRA Indication Term (Composite PK Part 3)"
        VARCHAR reported_indication "Reported condition / disease treated"
    }

    ther {
        BIGINT primary_id PK,FK "Composite PK Part 1 / References drug(primary_id, drug_seq)"
        INTEGER dsg_drug_seq PK,FK "Composite PK Part 2 / References drug(primary_id, drug_seq)"
        DATE start_date "Therapy initiation date"
        DATE end_date "Therapy cessation date"
        DOUBLE duration_days "Standardized duration in days"
    }

    rpsr {
        BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
        VARCHAR rpsr_code PK "Report source classification code (Composite PK Part 2)"
        VARCHAR standard_rpsr_label "Health Professional, Study, Consumer..."
    }

👉 Complete Specification: See the full Canonical Data Model Specification and Coded Values Reference.


🌐 Precompiled Dataset on Hugging Face

All 91 quarterly packages from 2004Q1 through 2026Q3 (20+ million safety reports) are compiled and publicly accessible on Hugging Face: 🔗 raxtik-org/faers-safety-database

Organized under bronze/<YEAR>/ as standalone DuckDB databases (.duckdb) and ZSTD Parquet tables (.parquet/).


📦 Installation

pip install raxtik-etl raxtik-source-faers

For developer setup and contributing from source, see CONTRIBUTING.md.


🚀 Quickstart

1. Download or Build via CLI

# Recommended: Download precompiled package directly from Hugging Face Hub (zero auth required)
raxtik-etl download -d 2004Q1

# Inspect package schema and data quality indicators
raxtik-etl inspect -d 2004Q1

# Build a quarterly package locally from raw FDA archives
raxtik-etl build -d 2004Q1 --source faers

👉 CLI Reference: See the full CLI Reference Guide for all commands and parameters.


💻 Python SDK Usage

Load and query precompiled safety packages directly in Python:

from raxtik_etl import FAERS

# 1. Default (Recommended): Downloads once, caches locally, and queries in milliseconds
with FAERS.from_hf("2024Q1") as faers:
    faers.print_summary()
    cases_df = faers.cases(limit=1000)
    drugs_df = faers.drugs(limit=1000)
    reactions_df = faers.reactions(limit=1000)

# 2. Zero Local Disk (Remote Streaming): Streams over HTTPS directly from Hugging Face
with FAERS.from_hf("2024Q1", remote=True) as faers:
    cases_df = faers.cases(limit=100)
    print(cases_df)

⚡ Remote Querying via DuckDB (Zero Local Storage)

You can run analytical SQL queries directly against datasets hosted on Hugging Face Hub over HTTPS without downloading full archives to disk. DuckDB's built-in httpfs extension fetches only the metadata and column pages required via HTTP Range requests.

Option A: Remote DuckDB ATTACH (Single File URL, Full Star-Schema & Views)

Points to one single database file containing all 7 fact tables (demo, drug, reac, outc, indi, ther, rpsr), the precomputed cases view, and all 16 reference codelists (_code_*):

import duckdb

con = duckdb.connect()
# httpfs is DuckDB's native C++ extension (no pip install required)
con.execute("INSTALL httpfs; LOAD httpfs;")

# 1 single URL attaches the entire quarterly database
db_url = "https://huggingface.co/datasets/raxtik-org/faers-safety-database/resolve/main/bronze/2024/faers_2024Q1.duckdb"
con.execute(f"ATTACH '{db_url}' AS faers (READ_ONLY);")

# Clean standard SQL joins across tables inside the attached database
con.execute("""
    SELECT
        d.reported_drug_name,
        COUNT(*) AS report_count
    FROM faers.drug d
    JOIN faers.reac r
      ON d.primary_id = r.primary_id
    WHERE d.role_code = 'PS'
      AND r.reported_reaction_term = 'Myocardial infarction'
    GROUP BY d.reported_drug_name
    ORDER BY report_count DESC
    LIMIT 5;
""").show()

Option B: Remote Parquet Scanning (Fast Columnar Range Requests)

Directly queries specific columnar Parquet files, skipping unqueried columns entirely:

import duckdb

con = duckdb.connect()
con.execute("INSTALL httpfs; LOAD httpfs;")

con.execute("""
    SELECT
        d.reported_drug_name,
        COUNT(*) AS report_count
    FROM 'https://huggingface.co/datasets/raxtik-org/faers-safety-database/resolve/main/bronze/2024/faers_2024Q1.parquet/drug.parquet' d
    JOIN 'https://huggingface.co/datasets/raxtik-org/faers-safety-database/resolve/main/bronze/2024/faers_2024Q1.parquet/reac.parquet' r
      ON d.primary_id = r.primary_id
    WHERE d.role_code = 'PS'
      AND r.reported_reaction_term = 'Myocardial infarction'
    GROUP BY d.reported_drug_name
    ORDER BY report_count DESC
    LIMIT 5;
""").show()

🛡️ Data Quality & Cross-Quarter Case Updates

In post-marketing pharmacovigilance surveillance, pharmaceutical manufacturers frequently submit follow-up reports updating therapy durations, additional reactions, or new clinical indications for cases originally reported in previous quarters.

When FDA releases quarterly ASCII snapshots, child tables (drug, reac, indi, ther) occasionally contain update records referencing a primary_id from an earlier quarter without re-emitting the unchanged demographic row:

  • In isolated single-quarter snapshots, this manifests as referential integrity warnings (< 0.0003% of rows, e.g., 5 orphan rows in 2012Q1 and 2026Q3).
  • Rather than silently dropping these clinically valuable update records, raxtik-etl retains them and transparently logs referential warnings during packaging.
  • Multi-quarter cohort consolidation (raxtik-etl consolidate) reconciles multi-version reports into unified case records.

📚 Documentation & Guides


📄 License

Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). Raw FDA data is in the public domain (US Government Work, 17 U.S.C. § 105). Derived packaged datasets are distributed under the Open Data Commons Attribution License (ODC-By 1.0).

Metadata

Release files for raxtik-etl 0.1.0.dev1

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-etl 0.1.0.dev1
File Size Uploaded Provenance Actions
raxtik_etl-0.1.0.dev1.tar.gz 226.0 kB With provenance Details for raxtik_etl-0.1.0.dev1.tar.gz

Built distribution (wheel)

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

Total release size: 321.9 kB

Release files / raxtik_etl-0.1.0.dev1.tar.gz

Download URL raxtik_etl-0.1.0.dev1.tar.gz
Size 226.0 kB
Tags Source
SHA-256 checksum
How to use checksums
90a8174bad79081fc1e50369006ec002df7234667a6c259e267e38cba62099c4
BLAKE2b-256 checksum
How to use checksums
b36d79d4ff3166f5aa7e0947357dedd6d9cafb7e70f93f481747dc297161771a
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 19, 2026.

Transparency log

Release files / raxtik_etl-0.1.0.dev1-py3-none-any.whl

Download URL raxtik_etl-0.1.0.dev1-py3-none-any.whl
Size 95.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04be3026a5eeb76c3b8f4edb1b21cd0360aa0b8089fadf3d85e1f5d2c815eea8
BLAKE2b-256 checksum
How to use checksums
6689cc7e5353499344031ac141befa4ea9069c799ef0800e3ab4fc6d66098cb9
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 19, 2026.

Transparency log

Security for raxtik-etl 0.1.0.dev1

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_etl-0.1.0.dev1.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 19, 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.

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