raxtik-source-faers 0.1.0.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. raxtik_source_faers-0.1.0.dev1/.all-contributorsrc +28 -0
  2. raxtik_source_faers-0.1.0.dev1/.github/renovate.json +61 -0
  3. raxtik_source_faers-0.1.0.dev1/.github/workflows/ci.yml +106 -0
  4. raxtik_source_faers-0.1.0.dev1/.github/workflows/release.yml +73 -0
  5. raxtik_source_faers-0.1.0.dev1/.gitignore +56 -0
  6. raxtik_source_faers-0.1.0.dev1/.pre-commit-config.yaml +25 -0
  7. raxtik_source_faers-0.1.0.dev1/.readthedocs.yaml +20 -0
  8. raxtik_source_faers-0.1.0.dev1/CHANGELOG.md +18 -0
  9. raxtik_source_faers-0.1.0.dev1/CONTRIBUTING.md +65 -0
  10. raxtik_source_faers-0.1.0.dev1/CONTRIBUTORS.md +21 -0
  11. raxtik_source_faers-0.1.0.dev1/ER_DIAGRAM.md +105 -0
  12. raxtik_source_faers-0.1.0.dev1/LICENSE +661 -0
  13. raxtik_source_faers-0.1.0.dev1/PKG-INFO +214 -0
  14. raxtik_source_faers-0.1.0.dev1/README.md +165 -0
  15. raxtik_source_faers-0.1.0.dev1/codecov.yml +22 -0
  16. raxtik_source_faers-0.1.0.dev1/docs/api.md +36 -0
  17. raxtik_source_faers-0.1.0.dev1/docs/architecture.md +65 -0
  18. raxtik_source_faers-0.1.0.dev1/docs/conf.py +95 -0
  19. raxtik_source_faers-0.1.0.dev1/docs/contributing.md +2 -0
  20. raxtik_source_faers-0.1.0.dev1/docs/contributors.md +2 -0
  21. raxtik_source_faers-0.1.0.dev1/docs/index.md +81 -0
  22. raxtik_source_faers-0.1.0.dev1/docs/reference_codelists.md +38 -0
  23. raxtik_source_faers-0.1.0.dev1/pyproject.toml +99 -0
  24. raxtik_source_faers-0.1.0.dev1/requirements-dev.txt +4 -0
  25. raxtik_source_faers-0.1.0.dev1/requirements-docs.txt +8 -0
  26. raxtik_source_faers-0.1.0.dev1/requirements-lint.txt +5 -0
  27. raxtik_source_faers-0.1.0.dev1/requirements-tests.txt +3 -0
  28. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/__init__.py +75 -0
  29. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/_version.py +1 -0
  30. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/adapter.py +412 -0
  31. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/builder.py +51 -0
  32. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/client.py +134 -0
  33. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/constants.py +67 -0
  34. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/fetcher.py +141 -0
  35. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/mappings/common.py +99 -0
  36. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/mappings/s1_legacy.py +292 -0
  37. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/mappings/s2_migration.py +255 -0
  38. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/mappings/s3_modern.py +256 -0
  39. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/parser.py +69 -0
  40. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/__init__.py +43 -0
  41. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/age_groups.py +76 -0
  42. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/age_units.py +76 -0
  43. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/countries.py +2828 -0
  44. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/cumulative_dose_units.py +716 -0
  45. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/dechallenge.py +54 -0
  46. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/dose_frequencies.py +263 -0
  47. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/drug_name_sources.py +32 -0
  48. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/duration_units.py +98 -0
  49. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/occupations.py +65 -0
  50. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/outcomes.py +87 -0
  51. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/rechallenge.py +54 -0
  52. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/report_sources.py +87 -0
  53. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/report_types.py +65 -0
  54. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/roles.py +99 -0
  55. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/sex.py +46 -0
  56. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/reference/weight_units.py +43 -0
  57. raxtik_source_faers-0.1.0.dev1/src/raxtik_source_faers/signatures/resolver.py +101 -0
  58. raxtik_source_faers-0.1.0.dev1/tests/fixtures/sample_faers_ascii/DEMO24Q1.txt +6 -0
  59. raxtik_source_faers-0.1.0.dev1/tests/fixtures/sample_faers_ascii/DRUG24Q1.txt +6 -0
  60. raxtik_source_faers-0.1.0.dev1/tests/fixtures/sample_faers_ascii/INDI24Q1.txt +6 -0
  61. raxtik_source_faers-0.1.0.dev1/tests/fixtures/sample_faers_ascii/OUTC24Q1.txt +5 -0
  62. raxtik_source_faers-0.1.0.dev1/tests/fixtures/sample_faers_ascii/REAC24Q1.txt +6 -0
  63. raxtik_source_faers-0.1.0.dev1/tests/test_adapter.py +263 -0
  64. raxtik_source_faers-0.1.0.dev1/tests/test_client.py +113 -0
  65. raxtik_source_faers-0.1.0.dev1/tests/test_fetcher.py +124 -0
  66. raxtik_source_faers-0.1.0.dev1/tests/test_parser.py +90 -0
  67. raxtik_source_faers-0.1.0.dev1/tests/test_signatures.py +70 -0
  68. raxtik_source_faers-0.1.0.dev1/tox.ini +43 -0
  69. raxtik_source_faers-0.1.0.dev1/typos.toml +48 -0
@@ -0,0 +1,28 @@
1
+ {
2
+ "projectName": "raxtik-source-faers",
3
+ "projectOwner": "raxtik-org",
4
+ "repoType": "github",
5
+ "repoHost": "https://github.com",
6
+ "files": [
7
+ "CONTRIBUTORS.md",
8
+ "README.md"
9
+ ],
10
+ "imageSize": 100,
11
+ "commit": false,
12
+ "contributors": [
13
+ {
14
+ "login": "prateek-dagar",
15
+ "name": "Prateek Dagar",
16
+ "avatar_url": "https://avatars.githubusercontent.com/u/107306613?v=4",
17
+ "profile": "https://github.com/prateek-dagar",
18
+ "contributions": [
19
+ "code",
20
+ "doc",
21
+ "infra",
22
+ "maintenance"
23
+ ]
24
+ }
25
+ ],
26
+ "contributorsPerLine": 7,
27
+ "linkToUsage": true
28
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "description": "Renovate configuration for raxtik-source-faers",
4
+ "extends": [
5
+ "config:recommended",
6
+ ":dependencyDashboard",
7
+ ":semanticCommits",
8
+ ":combineUpdateAutomations"
9
+ ],
10
+ "labels": [
11
+ "dependencies"
12
+ ],
13
+ "schedule": [
14
+ "before 6am on monday"
15
+ ],
16
+ "timezone": "UTC",
17
+ "prConcurrentLimit": 5,
18
+ "prHourlyLimit": 2,
19
+ "rebaseWhen": "auto",
20
+ "packageRules": [
21
+ {
22
+ "matchPackagePatterns": [
23
+ "*"
24
+ ],
25
+ "matchUpdateTypes": [
26
+ "minor",
27
+ "patch"
28
+ ],
29
+ "groupName": "all non-major dependencies",
30
+ "groupSlug": "all-minor-patch"
31
+ },
32
+ {
33
+ "description": "Pin GitHub Actions to full commit SHAs for security and immutability",
34
+ "matchManagers": [
35
+ "github-actions"
36
+ ],
37
+ "groupName": "github-actions",
38
+ "pinDigests": true
39
+ },
40
+ {
41
+ "description": "Group pre-commit hook updates",
42
+ "matchManagers": [
43
+ "pre-commit"
44
+ ],
45
+ "groupName": "pre-commit hooks"
46
+ },
47
+ {
48
+ "description": "Prevent bumping required Python version automatically",
49
+ "matchPackageNames": [
50
+ "python"
51
+ ],
52
+ "enabled": false
53
+ }
54
+ ],
55
+ "enabledManagers": [
56
+ "pep621",
57
+ "pip_requirements",
58
+ "github-actions",
59
+ "pre-commit"
60
+ ]
61
+ }
@@ -0,0 +1,106 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ env:
18
+ UV_NO_SYNC: "1"
19
+
20
+ jobs:
21
+ quality:
22
+ name: 🧑‍🏭 Quality & Types
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - name: Checkout repository
26
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27
+
28
+ - name: Set up uv & Python 3.13
29
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
30
+ with:
31
+ enable-cache: true
32
+ version: "latest"
33
+ python-version: "3.13"
34
+
35
+ - name: Run lint and type checking with tox-uv
36
+ run: uvx --with tox-uv tox run -e quality
37
+
38
+ docs:
39
+ name: 📖 Documentation
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - name: Checkout repository
43
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44
+
45
+ - name: Set up uv & Python 3.13
46
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
47
+ with:
48
+ enable-cache: true
49
+ version: "latest"
50
+ python-version: "3.13"
51
+
52
+ - name: Build documentation with tox-uv
53
+ run: uvx --with tox-uv tox run -e docs
54
+
55
+ packaging:
56
+ name: 📦 Package Build & Validation
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - name: Checkout repository
60
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
61
+
62
+ - name: Set up uv & Python 3.13
63
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
64
+ with:
65
+ enable-cache: true
66
+ version: "latest"
67
+ python-version: "3.13"
68
+
69
+ - name: Build sdist and wheels
70
+ run: uv build
71
+
72
+ - name: Validate distribution metadata
73
+ run: uvx twine check dist/*
74
+
75
+ test:
76
+ name: 🧪 test (${{ matrix.os }} - py${{ matrix.python-version }})
77
+ runs-on: ${{ matrix.os }}
78
+ needs: quality
79
+ if: "!startsWith(github.head_ref, 'all-contributors/')"
80
+ timeout-minutes: 15
81
+ strategy:
82
+ fail-fast: false
83
+ matrix:
84
+ os: [ubuntu-latest, macos-latest, windows-latest]
85
+ python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
86
+
87
+ steps:
88
+ - name: Checkout repository
89
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
90
+
91
+ - name: Set up uv & Python ${{ matrix.python-version }}
92
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
93
+ with:
94
+ enable-cache: true
95
+ version: "latest"
96
+ python-version: ${{ matrix.python-version }}
97
+
98
+ - name: Run test suite with tox-uv
99
+ run: uvx --with tox-uv tox run -e py
100
+
101
+ - name: Upload coverage to Codecov
102
+ uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5
103
+ with:
104
+ files: coverage.xml
105
+ flags: ${{ matrix.os }}-py${{ matrix.python-version }}
106
+ fail_ci_if_error: false
@@ -0,0 +1,73 @@
1
+ name: Release & Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ release:
8
+ types: [published]
9
+ workflow_dispatch:
10
+ inputs:
11
+ target:
12
+ description: 'Publish target (pypi or testpypi)'
13
+ required: true
14
+ default: 'pypi'
15
+ type: choice
16
+ options:
17
+ - pypi
18
+ - testpypi
19
+
20
+ concurrency:
21
+ group: ${{ github.workflow }}-${{ github.ref }}
22
+ cancel-in-progress: false
23
+
24
+ permissions:
25
+ contents: write # Mandatory for GitHub Release creation & asset upload
26
+ id-token: write # Mandatory for PyPI Trusted Publishing (OIDC)
27
+
28
+ jobs:
29
+ build-and-publish:
30
+ name: 🚀 Build, Validate & Publish
31
+ runs-on: ubuntu-latest
32
+
33
+ steps:
34
+ - name: Checkout repository
35
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36
+ with:
37
+ fetch-depth: 0
38
+
39
+ - name: Set up uv & Python 3.13
40
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
41
+ with:
42
+ enable-cache: true
43
+ version: "latest"
44
+ python-version: "3.13"
45
+
46
+ - name: Build sdist and wheel distributions
47
+ run: uv build
48
+
49
+ - name: Validate distribution metadata
50
+ run: uvx twine check dist/*
51
+
52
+ - name: Publish to TestPyPI
53
+ if: ${{ github.event.inputs.target == 'testpypi' }}
54
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
55
+ with:
56
+ repository-url: https://test.pypi.org/legacy/
57
+ skip-existing: true
58
+
59
+ - name: Publish to PyPI
60
+ if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release' || github.event.inputs.target == 'pypi' }}
61
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
62
+ with:
63
+ skip-existing: true
64
+
65
+ - name: Create or update GitHub Release with distribution assets
66
+ if: startsWith(github.ref, 'refs/tags/v')
67
+ uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
68
+ with:
69
+ files: dist/*
70
+ generate_release_notes: true
71
+ draft: false
72
+ prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') || contains(github.ref, 'dev') }}
73
+
@@ -0,0 +1,56 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ build/
7
+ develop-eggs/
8
+ dist/
9
+ downloads/
10
+ eggs/
11
+ .eggs/
12
+ lib/
13
+ lib64/
14
+ parts/
15
+ sdist/
16
+ var/
17
+ wheels/
18
+ *.egg-info/
19
+ .installed.cfg
20
+ *.egg
21
+ .venv/
22
+ env/
23
+ venv/
24
+ .pytest_cache/
25
+ .coverage
26
+ htmlcov/
27
+ .ruff_cache/
28
+ .mypy_cache/
29
+ .tox/
30
+ .DS_Store
31
+
32
+ # uv lock & coverage
33
+ uv.lock
34
+ coverage.xml
35
+ *.xml
36
+
37
+ # Databases & Artifacts
38
+ *.duckdb
39
+ *.duckdb.wal
40
+
41
+ # Local Python Environment & Scripts
42
+ .python-version
43
+ scripts/
44
+
45
+ # IDE & Secrets
46
+ .idea/
47
+ .vscode/
48
+ *.code-workspace
49
+ *.swp
50
+ *.swo
51
+ .env
52
+ *.env
53
+
54
+ # Documentation builds
55
+ docs/_build/
56
+ _build/
@@ -0,0 +1,25 @@
1
+ ci:
2
+ autofix_commit_msg: "chore(pr): auto fixes from pre-commit hooks"
3
+ autofix_prs: true
4
+ autoupdate_branch: ""
5
+
6
+ repos:
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v6.0.0
9
+ hooks:
10
+ - id: trailing-whitespace
11
+ - id: end-of-file-fixer
12
+ - id: check-yaml
13
+ - id: check-toml
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.17.3
17
+ hooks:
18
+ - id: ruff-check
19
+ args: [--fix, --exit-non-zero-on-fix]
20
+ - id: ruff-format
21
+
22
+ - repo: https://github.com/crate-ci/typos
23
+ rev: v1.51.1
24
+ hooks:
25
+ - id: typos
@@ -0,0 +1,20 @@
1
+ # Read the Docs configuration file (Version 2)
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-24.04
8
+ tools:
9
+ python: "3.13"
10
+
11
+ # Build documentation with Sphinx using docs/conf.py
12
+ sphinx:
13
+ configuration: docs/conf.py
14
+ fail_on_warning: false
15
+
16
+ # Python environment and dependencies
17
+ python:
18
+ install:
19
+ - requirements: requirements-docs.txt
20
+
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 0.1.0.dev1 - 2026-11-19
9
+
10
+ **Full Changelog**: https://github.com/raxtik-org/raxtik-source-faers/commits/v0.1.0.dev1
11
+
12
+ ### Added
13
+ - Official FDA FAERS/AERS data source connector, signature resolver, and canonical extractor for `raxtik-etl`.
14
+ - Fail-closed historical schema identification across S1 (2004Q1–2012Q3), S2 (2012Q4–2014Q2), and S3 (2014Q3–present) eras.
15
+ - Raw ASCII extract staging handling `$`-delimited records, embedded newlines, and legacy column header aliases.
16
+ - Embedded clinical reference codelists for administration routes, dosage formulations, and reporter occupations.
17
+ - Specialized `FAERS` client registered via Python entry points inheriting from `BaseDataset`.
18
+ - Standalone documentation site on ReadTheDocs with interactive Mermaid diagrams.
@@ -0,0 +1,65 @@
1
+ # Contributing to raxtik-source-faers
2
+
3
+ Thank you for your interest in contributing to **raxtik-source-faers**! We welcome bug reports, feature suggestions, documentation improvements, and code contributions.
4
+
5
+ ---
6
+
7
+ ## 🛠️ Development Setup
8
+
9
+ The project uses modular requirement files matching the Watchdog architecture:
10
+ * `requirements-lint.txt` - Code style, spelling, and static typing (Ruff, Typos, Pyrefly)
11
+ * `requirements-docs.txt` - Sphinx documentation and Read the Docs dependencies
12
+ * `requirements-tests.txt` - Automated testing and test coverage
13
+ * `requirements-dev.txt` - All development dependencies combined
14
+
15
+ ```bash
16
+ # Clone the repository
17
+ git clone https://github.com/raxtik-org/raxtik-source-faers.git
18
+ cd raxtik-source-faers
19
+
20
+ # Create virtualenv and install full development suite
21
+ uv venv --python 3.13
22
+ source .venv/bin/activate
23
+ uv pip install -e ../raxtik-etl -e ".[dev,docs]" -r requirements-dev.txt
24
+ ```
25
+
26
+ ---
27
+
28
+ ## 🧪 Testing
29
+
30
+ Run the full automated test suite with `pytest`:
31
+
32
+ ```bash
33
+ uv run pytest tests/ -v
34
+ ```
35
+
36
+ Or run via `tox`:
37
+ ```bash
38
+ tox -e py313
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 🧹 Code Quality & Formatting
44
+
45
+ ```bash
46
+ # Lint and format with Ruff
47
+ uv run ruff check --fix .
48
+ uv run ruff format .
49
+
50
+ # Check for spelling errors with Typos
51
+ uv run typos
52
+
53
+ # Run Pyrefly static type checking
54
+ uv run pyrefly check src/raxtik_source_faers
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 📚 Building Documentation
60
+
61
+ Documentation is built with Sphinx:
62
+
63
+ ```bash
64
+ uv run --extra docs sphinx-build -b html docs docs/_build/html
65
+ ```
@@ -0,0 +1,21 @@
1
+ # Contributors
2
+
3
+ Thanks goes to these wonderful people:
4
+
5
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
6
+ <!-- prettier-ignore-start -->
7
+ <!-- markdownlint-disable -->
8
+ <table>
9
+ <tbody>
10
+ <tr>
11
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/prateek-dagar"><img src="https://avatars.githubusercontent.com/u/107306613?v=4" width="100px;" alt="Prateek Dagar"/><br /><sub><b>Prateek Dagar</b></sub></a><br /><a href="https://github.com/raxtik-org/raxtik-source-faers/commits?author=prateek-dagar" title="Code">💻</a> <a href="https://github.com/raxtik-org/raxtik-source-faers/commits?author=prateek-dagar" title="Documentation">📖</a> <a href="#infra-prateek-dagar" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-prateek-dagar" title="Maintenance">🚧</a></td>
12
+ </tr>
13
+ </tbody>
14
+ </table>
15
+
16
+ <!-- markdownlint-restore -->
17
+ <!-- prettier-ignore-end -->
18
+
19
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
20
+
21
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
@@ -0,0 +1,105 @@
1
+ # Canonical Entity-Relationship (ER) Diagram
2
+
3
+ Visual representation of the **7 canonical pharmacovigilance fact tables**, composite keys, and entity relationships projected by `raxtik-source-faers`.
4
+
5
+ ---
6
+
7
+ ## 🏛️ Visual Schema Model
8
+
9
+ ```mermaid
10
+ erDiagram
11
+ demo ||--o{ drug : "primary_id"
12
+ demo ||--o{ reac : "primary_id"
13
+ demo ||--o{ outc : "primary_id"
14
+ demo ||--o{ rpsr : "primary_id"
15
+ drug ||--o{ indi : "primary_id, drug_seq"
16
+ drug ||--o{ ther : "primary_id, drug_seq"
17
+
18
+ demo {
19
+ BIGINT primary_id PK "Unique submission report ID"
20
+ BIGINT case_id "Unique patient case identifier"
21
+ INTEGER case_version "Report version number"
22
+ VARCHAR event_country "Country where reaction occurred"
23
+ VARCHAR reporter_country_code "ISO 3166-1 alpha-2"
24
+ DATE fda_date "Receipt date at FDA"
25
+ VARCHAR age_group_code "ICH life stage classification"
26
+ DOUBLE standard_age_years "Normalized age in decimal years"
27
+ VARCHAR standard_sex_label "Male / Female / Unknown"
28
+ DOUBLE standard_weight_kg "Normalized patient weight in kg"
29
+ VARCHAR reporter_occupation_label "Physician, Pharmacist, Consumer..."
30
+ VARCHAR report_type_label "Expedited 15-day, Periodic, Direct..."
31
+ }
32
+
33
+ drug {
34
+ BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
35
+ INTEGER drug_seq PK "Exposure sequence per report (Composite PK Part 2)"
36
+ VARCHAR role_code "Role: PS, SS, C, I"
37
+ VARCHAR standard_role_label "Primary Suspect, Concomitant..."
38
+ VARCHAR reported_drug_name "Reported medicinal trade/brand name"
39
+ VARCHAR active_ingredient "Normalized generic active substance"
40
+ VARCHAR route "Administration route (Oral, IV...)"
41
+ VARCHAR dose_form "Dosage formulation (Tablet, Solution...)"
42
+ DOUBLE cumulative_dose "Normalized cumulative amount"
43
+ VARCHAR cumulative_dose_unit_label "Metric dose unit (mg, mL...)"
44
+ }
45
+
46
+ reac {
47
+ BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
48
+ VARCHAR reported_reaction_term PK "MedDRA Preferred Term (Composite PK Part 2)"
49
+ BIGINT reaction_seq "Reaction sequence ordinal"
50
+ VARCHAR drug_reaction_action "Action taken with drug"
51
+ }
52
+
53
+ outc {
54
+ BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
55
+ VARCHAR outc_code PK "Seriousness criterion: DE, HO, LT, DS, CA, RI, OT (Composite PK Part 2)"
56
+ VARCHAR standard_outc_label "Death, Hospitalization, Life-threatening..."
57
+ BOOLEAN is_death "Flag for fatal outcome (DE)"
58
+ BOOLEAN is_serious "Flag for serious adverse event"
59
+ }
60
+
61
+ indi {
62
+ BIGINT primary_id PK,FK "Composite PK Part 1 / References drug(primary_id, drug_seq)"
63
+ INTEGER indi_drug_seq PK,FK "Composite PK Part 2 / References drug(primary_id, drug_seq)"
64
+ VARCHAR reported_indication_term PK "MedDRA Indication Term (Composite PK Part 3)"
65
+ VARCHAR reported_indication "Reported condition / disease treated"
66
+ }
67
+
68
+ ther {
69
+ BIGINT primary_id PK,FK "Composite PK Part 1 / References drug(primary_id, drug_seq)"
70
+ INTEGER dsg_drug_seq PK,FK "Composite PK Part 2 / References drug(primary_id, drug_seq)"
71
+ DATE start_date "Therapy initiation date"
72
+ DATE end_date "Therapy cessation date"
73
+ DOUBLE duration_days "Standardized duration in days"
74
+ }
75
+
76
+ rpsr {
77
+ BIGINT primary_id PK,FK "References demo.primary_id (Composite PK Part 1)"
78
+ VARCHAR rpsr_code PK "Report source classification code (Composite PK Part 2)"
79
+ VARCHAR standard_rpsr_label "Health Professional, Study, Consumer..."
80
+ }
81
+ ```
82
+
83
+ ---
84
+
85
+ ## 🔑 Composite Primary Keys & Relational Cardinality
86
+
87
+ | Table | Entity / Domain | Primary Key (Composite) | Foreign Key Relationship | Cardinality | Description |
88
+ | :--- | :--- | :--- | :--- | :--- | :--- |
89
+ | **`demo`** | Case Submissions & Demographics | `primary_id` | *(Root submission table)* | Root | Demographic data, reporting sources, and FDA receipt dates. |
90
+ | **`drug`** | Drug Exposures & Regimens | `(primary_id, drug_seq)` | `primary_id` → `demo.primary_id` | 1 : N | Reported medicinal products, active ingredients, dosage forms, and suspect roles. |
91
+ | **`reac`** | Adverse Reactions | `(primary_id, reported_reaction_term)` | `primary_id` → `demo.primary_id` | 1 : N | Adverse events coded with MedDRA Preferred Terms (`reported_reaction_term`). |
92
+ | **`outc`** | Patient Outcomes | `(primary_id, outc_code)` | `primary_id` → `demo.primary_id` | 1 : N | Clinical seriousness criteria (`DE`, `HO`, `LT`, `DS`, `CA`, `RI`, `OT`). |
93
+ | **`indi`** | Therapy Indications | `(primary_id, indi_drug_seq, reported_indication_term)` | `(primary_id, indi_drug_seq)` → `drug(primary_id, drug_seq)` | 1 : N | Medical conditions and clinical indications for which each drug was prescribed. |
94
+ | **`ther`** | Therapy Timelines | `(primary_id, dsg_drug_seq)` | `(primary_id, dsg_drug_seq)` → `drug(primary_id, drug_seq)` | 1 : N | Start dates, end dates, and standardized therapy durations in days. |
95
+ | **`rpsr`** | Report Sources | `(primary_id, rpsr_code)` | `primary_id` → `demo.primary_id` | 1 : N | Reporting source categories (Physician, Pharmacist, Consumer, Study). |
96
+ | **`cases`** | Authoritative Deduplicated View | `case_id` | Derived from `demo` | 1 : 1 | Precomputed view resolving multi-version follow-ups to latest report version. |
97
+
98
+ ---
99
+
100
+ ## 📖 Related Documentation
101
+
102
+ - **[Architecture & Engine Design](https://raxtik-etl.readthedocs.io/en/latest/architecture.html)**
103
+ - **[raxtik-source-faers Documentation](https://raxtik-source-faers.readthedocs.io/en/latest/)**
104
+ - **[Canonical Data Model Specification](https://raxtik-etl.readthedocs.io/en/latest/schema/canonical_data_model.html)**
105
+