ashmatics-datamodels 0.3.2__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 (70) hide show
  1. ashmatics_datamodels-0.3.2/.github/workflows/publish.yml +63 -0
  2. ashmatics_datamodels-0.3.2/.gitignore +44 -0
  3. ashmatics_datamodels-0.3.2/CLAUDE.md +235 -0
  4. ashmatics_datamodels-0.3.2/LICENSE +190 -0
  5. ashmatics_datamodels-0.3.2/PKG-INFO +134 -0
  6. ashmatics_datamodels-0.3.2/README.md +100 -0
  7. ashmatics_datamodels-0.3.2/docs/IMPL-CommonDataModel_Phase1-2025-11-21.md +201 -0
  8. ashmatics_datamodels-0.3.2/docs/IMPL-MongoDocumentSchemas-Phase2-2025-11-21.md +293 -0
  9. ashmatics_datamodels-0.3.2/docs/Plans/ENGR-DesignPlan-CompleteDataModels-2025-11-21.md +345 -0
  10. ashmatics_datamodels-0.3.2/docs/TestResults/TESTRESULTS-ASHKBAPP-47-2025-11-30.md +171 -0
  11. ashmatics_datamodels-0.3.2/docs/api/common.md +3 -0
  12. ashmatics_datamodels-0.3.2/docs/api/documents.md +3 -0
  13. ashmatics_datamodels-0.3.2/docs/api/fda.md +3 -0
  14. ashmatics_datamodels-0.3.2/docs/api/use_cases.md +3 -0
  15. ashmatics_datamodels-0.3.2/docs/contributing.md +144 -0
  16. ashmatics_datamodels-0.3.2/docs/design/migration-plan.md +172 -0
  17. ashmatics_datamodels-0.3.2/docs/design/three-tier-schema.md +315 -0
  18. ashmatics_datamodels-0.3.2/docs/examples/fda-clearances.md +291 -0
  19. ashmatics_datamodels-0.3.2/docs/examples/mongodb-documents.md +381 -0
  20. ashmatics_datamodels-0.3.2/docs/examples/use-cases.md +172 -0
  21. ashmatics_datamodels-0.3.2/docs/examples/validators.md +134 -0
  22. ashmatics_datamodels-0.3.2/docs/getting-started/concepts.md +275 -0
  23. ashmatics_datamodels-0.3.2/docs/getting-started/installation.md +105 -0
  24. ashmatics_datamodels-0.3.2/docs/getting-started/quickstart.md +237 -0
  25. ashmatics_datamodels-0.3.2/docs/index.md +93 -0
  26. ashmatics_datamodels-0.3.2/docs/modules/common.md +238 -0
  27. ashmatics_datamodels-0.3.2/docs/modules/documents.md +400 -0
  28. ashmatics_datamodels-0.3.2/docs/modules/fda.md +290 -0
  29. ashmatics_datamodels-0.3.2/docs/modules/overview.md +150 -0
  30. ashmatics_datamodels-0.3.2/docs/modules/use_cases.md +289 -0
  31. ashmatics_datamodels-0.3.2/mkdocs.yml +115 -0
  32. ashmatics_datamodels-0.3.2/pyproject.toml +95 -0
  33. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/__init__.py +38 -0
  34. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/common/__init__.py +80 -0
  35. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/common/base.py +76 -0
  36. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/common/enums.py +119 -0
  37. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/common/frameworks.py +168 -0
  38. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/common/regulators.py +152 -0
  39. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/common/validators.py +237 -0
  40. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/__init__.py +272 -0
  41. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/base.py +438 -0
  42. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/evidence.py +236 -0
  43. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/governance.py +696 -0
  44. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/governance_enums.py +151 -0
  45. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/manufacturers.py +299 -0
  46. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/models.py +431 -0
  47. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/products.py +347 -0
  48. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/regulatory.py +981 -0
  49. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/documents/use_cases.py +335 -0
  50. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/__init__.py +165 -0
  51. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/adverse_events.py +309 -0
  52. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/classifications.py +389 -0
  53. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/clearances.py +481 -0
  54. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/enums.py +186 -0
  55. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/manufacturers.py +180 -0
  56. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/products.py +228 -0
  57. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/fda/recalls.py +213 -0
  58. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/use_cases/__init__.py +57 -0
  59. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/use_cases/categories.py +116 -0
  60. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/use_cases/enums.py +137 -0
  61. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/use_cases/use_cases.py +188 -0
  62. ashmatics_datamodels-0.3.2/src/ashmatics_datamodels/utils/__init__.py +19 -0
  63. ashmatics_datamodels-0.3.2/tests/__init__.py +1 -0
  64. ashmatics_datamodels-0.3.2/tests/common/__init__.py +1 -0
  65. ashmatics_datamodels-0.3.2/tests/documents/test_governance_ASHKBAPP_47_2025_11_30.py +469 -0
  66. ashmatics_datamodels-0.3.2/tests/fda/__init__.py +1 -0
  67. ashmatics_datamodels-0.3.2/tests/fda/test_clearances.py +154 -0
  68. ashmatics_datamodels-0.3.2/tests/fda/test_manufacturers.py +172 -0
  69. ashmatics_datamodels-0.3.2/tests/test_documents.py +324 -0
  70. ashmatics_datamodels-0.3.2/tests/use_cases/__init__.py +1 -0
@@ -0,0 +1,63 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+ inputs:
8
+ target:
9
+ description: Publishing target
10
+ type: choice
11
+ options: [pypi, testpypi]
12
+ default: testpypi
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ build:
19
+ name: Build sdist + wheel
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.11"
27
+
28
+ - name: Install build tooling
29
+ run: python -m pip install --upgrade build
30
+
31
+ - name: Build distribution
32
+ run: python -m build
33
+
34
+ - name: Upload distribution artifact
35
+ uses: actions/upload-artifact@v4
36
+ with:
37
+ name: dist
38
+ path: dist/
39
+
40
+ publish:
41
+ name: Publish to ${{ inputs.target || 'pypi' }}
42
+ needs: build
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: ${{ inputs.target || 'pypi' }}
46
+ permissions:
47
+ id-token: write
48
+ steps:
49
+ - name: Download distribution artifact
50
+ uses: actions/download-artifact@v4
51
+ with:
52
+ name: dist
53
+ path: dist/
54
+
55
+ - name: Publish to PyPI
56
+ if: (inputs.target || 'pypi') == 'pypi'
57
+ uses: pypa/gh-action-pypi-publish@release/v1
58
+
59
+ - name: Publish to TestPyPI
60
+ if: inputs.target == 'testpypi'
61
+ uses: pypa/gh-action-pypi-publish@release/v1
62
+ with:
63
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,44 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ *.egg
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ ENV/
16
+
17
+ # uv
18
+ uv.lock
19
+
20
+ # Testing
21
+ .pytest_cache/
22
+ .coverage
23
+ htmlcov/
24
+ .tox/
25
+
26
+ # IDE
27
+ .idea/
28
+ .vscode/
29
+ *.swp
30
+ *.swo
31
+ *~
32
+
33
+ # mypy
34
+ .mypy_cache/
35
+
36
+ # ruff
37
+ .ruff_cache/
38
+
39
+ # OS
40
+ .DS_Store
41
+ Thumbs.db
42
+
43
+ # Documentation
44
+ site/
@@ -0,0 +1,235 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This is **ashmatics-core-datamodels**, a canonical Pydantic data models library for the AshMatics healthcare ecosystem. It serves as the single source of truth for data contracts across:
8
+ - Ashmatics Knowledge Base (KB)
9
+ - ashmatics-tools SDK
10
+ - ashmatics-knowledgebase-tools (ingestion pipelines)
11
+ - AI Watch applications
12
+
13
+ Version: 0.2.0 (Phase 1 complete, Phase 2 in progress)
14
+
15
+ ## Development Commands
16
+
17
+ ### Environment Setup
18
+ ```bash
19
+ # Python 3.11+ required
20
+ python -m venv .venv
21
+ source .venv/bin/activate # or `.venv\Scripts\activate` on Windows
22
+ pip install -e ".[dev]"
23
+ ```
24
+
25
+ ### Testing
26
+ ```bash
27
+ # Run all tests
28
+ pytest
29
+
30
+ # Run with coverage
31
+ pytest --cov=src/ashmatics_datamodels --cov-report=term-missing
32
+
33
+ # Run specific test file
34
+ pytest tests/fda/test_clearances.py
35
+
36
+ # Run specific test
37
+ pytest tests/fda/test_clearances.py::TestFDA510kClearance::test_k_number_validation
38
+ ```
39
+
40
+ ### Linting and Type Checking
41
+ ```bash
42
+ # Lint with ruff
43
+ ruff check src/
44
+
45
+ # Format code
46
+ ruff format src/ tests/
47
+
48
+ # Type check with mypy
49
+ mypy src/
50
+ ```
51
+
52
+ ### Building the Package
53
+ ```bash
54
+ # Build wheel
55
+ pip install build
56
+ python -m build
57
+
58
+ # Install locally in editable mode
59
+ pip install -e .
60
+ ```
61
+
62
+ ### Documentation
63
+ ```bash
64
+ # Install documentation dependencies
65
+ uv pip install -e ".[docs]"
66
+
67
+ # Serve docs locally (auto-reload on changes)
68
+ uv run mkdocs serve
69
+ # Open http://127.0.0.1:8000
70
+
71
+ # Build static documentation site
72
+ uv run mkdocs build
73
+ # Output in site/
74
+ ```
75
+
76
+ ## Architecture
77
+
78
+ ### Module Organization
79
+
80
+ The library follows a domain-driven structure:
81
+
82
+ - **common/** - Cross-jurisdictional base models, validators, enums
83
+ - `base.py`: `AshMaticsBaseModel`, `TimestampedModel`, `AuditedModel`
84
+ - `validators.py`: Shared validators (ISO dates, country codes, FDA identifiers)
85
+ - `enums.py`: Global enums (`AuthorizationStatus`, `RegulatoryStatus`, `RiskCategory`)
86
+ - `regulators.py`: Multi-jurisdiction regulator schemas
87
+ - `frameworks.py`: Regulatory framework schemas (FDA, EMA, etc.)
88
+
89
+ - **fda/** - FDA-specific schemas aligned with OpenFDA API
90
+ - `manufacturers.py`: FDA manufacturer schemas
91
+ - `clearances.py`: 510(k), PMA, De Novo clearance schemas
92
+ - `classifications.py`: Product codes, device classifications
93
+ - `products.py`: Product and regulatory status schemas
94
+ - `recalls.py`: FDA recall schemas
95
+ - `adverse_events.py`: MAUDE adverse event schemas
96
+
97
+ - **use_cases/** - Clinical AI use case taxonomy
98
+ - `categories.py`: Use case category hierarchy
99
+ - `use_cases.py`: Use case schemas with evidence links
100
+
101
+ - **documents/** - MongoDB three-tier document structure
102
+ - `base.py`: Base classes for all `kb_*` collections
103
+ - `evidence.py`: Evidence/publication documents
104
+ - `regulatory.py`: Regulatory document schemas (510k summaries)
105
+ - `models.py`: AI model card documents
106
+ - `products.py`: Product profile cards
107
+ - `manufacturers.py`: Manufacturer profile cards
108
+ - `use_cases.py`: Clinical use case documents
109
+
110
+ - **utils/** - Parsing and normalization utilities (future)
111
+
112
+ ### Three-Tier MongoDB Document Pattern
113
+
114
+ All `kb_*` collection documents follow this standardized structure:
115
+
116
+ **Tier 1: metadata_object** - Artifact/file metadata (provenance, versioning, storage)
117
+ **Tier 2: metadata_content** - Content classification metadata (search, filtering)
118
+ **Tier 3: content** - Actual document body (sections, figures, tables, references)
119
+
120
+ Example:
121
+ ```python
122
+ from ashmatics_datamodels.documents import EvidenceDocument, EvidenceMetadataContent
123
+
124
+ doc = EvidenceDocument(
125
+ _id="evidence-123",
126
+ metadata_object=MetadataObjectBase( # Tier 1
127
+ storage_location="s3://kb/papers/file.pdf",
128
+ processing_pipeline="grobid_v0.7.2"
129
+ ),
130
+ metadata_content=EvidenceMetadataContent( # Tier 2
131
+ document_type=DocumentType.EVIDENCE_DOC,
132
+ title="AI in Radiology",
133
+ clinical_domain="radiology"
134
+ ),
135
+ content=ContentBase( # Tier 3
136
+ sections={"1_intro": SectionBase(title="Introduction", order=1)}
137
+ )
138
+ )
139
+ ```
140
+
141
+ See `src/ashmatics_datamodels/documents/base.py` for full implementation.
142
+
143
+ ### Validation Philosophy
144
+
145
+ - **Strict validation**: Validators raise `ValueError` on invalid input (prefer fail-fast)
146
+ - **Normalization**: Auto-uppercase codes (K numbers, product codes, country codes)
147
+ - **Format checking**: Regex validation for FDA identifiers (K######, P######, product codes)
148
+ - **Type safety**: Full Pydantic v2 type hints for IDE support
149
+
150
+ Example validators:
151
+ - `validate_k_number_format()`: Validates K######/BK######/DEN###### format
152
+ - `validate_product_code()`: Validates 3-letter FDA product codes
153
+ - `validate_iso_date()`: Parses YYYY-MM-DD or MM/DD/YYYY dates
154
+
155
+ ### OpenFDA Alignment
156
+
157
+ FDA schemas mirror OpenFDA API response structures for easy data ingestion:
158
+ - Field names match OpenFDA JSON keys
159
+ - Enums align with OpenFDA terminology
160
+ - Date formats support both ISO 8601 and US formats
161
+
162
+ ## Key Design Patterns
163
+
164
+ ### Base Model Inheritance
165
+ All models inherit from `AshMaticsBaseModel` which provides:
166
+ - `model_config = ConfigDict(use_enum_values=True, validate_assignment=True)`
167
+ - Common serialization/deserialization behavior
168
+ - Consistent JSON export with `model_dump(by_alias=True)`
169
+
170
+ ### Timestamped Models
171
+ Use `TimestampedModel` for models requiring automatic timestamp tracking:
172
+ ```python
173
+ class MyModel(TimestampedModel):
174
+ name: str
175
+ # created_at and updated_at auto-generated
176
+ ```
177
+
178
+ ### Document Summaries
179
+ Each document type has a corresponding summary schema for list views:
180
+ ```python
181
+ summary = EvidenceSummary.from_document(full_document)
182
+ # Flattens three-tier structure for efficient API responses
183
+ ```
184
+
185
+ ## Migration Status (Phase Tracking)
186
+
187
+ **Phase 1 (v0.1.0)** ✅ COMPLETE:
188
+ - FDA core schemas (manufacturers, clearances, classifications, products)
189
+ - Use case base schemas
190
+ - Common validators and enums
191
+ - Regulators and frameworks
192
+
193
+ **Phase 2 (v0.2.0)** 🚧 IN PROGRESS:
194
+ - MongoDB document schemas (three-tier structure)
195
+ - Evidence and regulatory documents
196
+ - Model cards, product cards, manufacturer cards
197
+
198
+ **Future Phases**:
199
+ - Phase 3: Ontology consolidation (terms, valuesets from ashmatics-tools)
200
+ - Phase 4: Evidence quality metrics
201
+ - Phase 5: Multi-jurisdiction (EMA, PMDA)
202
+
203
+ See `docs/Plans/ENGR-DesignPlan-CompleteDataModels-2025-11-21.md` for full migration plan.
204
+
205
+ ## Important Constraints
206
+
207
+ 1. **No ORM coupling**: These are pure Pydantic models, no SQLAlchemy/Beanie dependencies
208
+ 2. **No business logic**: Models define structure and validation only
209
+ 3. **Database agnostic**: Work with any backend (MongoDB, PostgreSQL, etc.)
210
+ 4. **No auto-generated IDs**: Applications manage ID generation
211
+ 5. **Apache 2.0 licensing**: All files must include license header
212
+
213
+ ## Testing Standards
214
+
215
+ - Test files mirror source structure: `tests/fda/test_clearances.py` → `src/ashmatics_datamodels/fda/clearances.py`
216
+ - Use pytest fixtures for common test data
217
+ - Test validation edge cases (invalid K numbers, out-of-range dates)
218
+ - Test JSON serialization roundtrips
219
+ - Test summary generation from full documents
220
+
221
+ ## Consumer Applications
222
+
223
+ When making changes, consider impact on:
224
+ - **KB FastAPI**: Uses these schemas for request/response validation
225
+ - **ashmatics-knowledgebase-tools**: DocLing pipelines validate against these before API calls
226
+ - **ashmatics-tools**: Will consolidate ontology schemas here
227
+
228
+ ## Version Bumping
229
+
230
+ Follow semantic versioning:
231
+ - Patch (0.X.Y): Bug fixes, clarifications
232
+ - Minor (0.X.0): New schemas, backward-compatible additions
233
+ - Major (X.0.0): Breaking changes to existing schemas
234
+
235
+ Update both `pyproject.toml` version and `src/ashmatics_datamodels/__init__.py` `__version__`.
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Asher Informatics PBC
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: ashmatics-datamodels
3
+ Version: 0.3.2
4
+ Summary: Canonical Pydantic data models for AshMatics healthcare applications - FDA vocabulary, regulatory schemas, and clinical AI use cases
5
+ Project-URL: Homepage, https://github.com/AshMatics/ashmatics-datamodels
6
+ Project-URL: Documentation, https://github.com/AshMatics/ashmatics-datamodels#readme
7
+ Project-URL: Repository, https://github.com/AshMatics/ashmatics-datamodels
8
+ Project-URL: Bug Tracker, https://github.com/AshMatics/ashmatics-datamodels/issues
9
+ Author-email: Asher Informatics PBC <info@asherinformatics.com>
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: 510k,clinical-ai,fda,healthcare,medical-devices,openfda,pydantic,regulatory
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Healthcare Industry
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: mypy>=1.7.0; extra == 'dev'
25
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
26
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
27
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
28
+ Provides-Extra: docs
29
+ Requires-Dist: mkdocs-material>=9.4.0; extra == 'docs'
30
+ Requires-Dist: mkdocs>=1.5.0; extra == 'docs'
31
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == 'docs'
32
+ Requires-Dist: pymdown-extensions>=10.0.0; extra == 'docs'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # AshMatics Core DataModels
36
+
37
+ **Version: 0.3.1**
38
+
39
+ Canonical Pydantic data models for AshMatics healthcare applications.
40
+
41
+ ## Changelog
42
+
43
+ ### v0.3.1 (2026-01-25) — ASHKBAPP-66
44
+ - Added `PROCESS_DOCUMENTATION` to `GovernanceCategory` enum
45
+ - This is a core CAI framework category required for MCP service compatibility
46
+
47
+ ## Overview
48
+
49
+ This library provides the **single source of truth** for data contracts across the AshMatics ecosystem:
50
+ - Knowledge Base (KB)
51
+ - CoreApp
52
+ - ashmatics-tools SDK
53
+ - AI Watch applications
54
+
55
+ ## Features
56
+
57
+ - **FDA Vocabulary**: OpenFDA-aligned schemas for manufacturers, clearances, classifications, recalls, adverse events
58
+ - **MongoDB Document Schemas**: Three-tier structure for all `kb_*` collections (evidence, regulatory, model cards, products, manufacturers, use cases)
59
+ - **Governance Document Models**: Clinical AI Governance Framework artifacts (policies, SOPs, work products, process documentation)
60
+ - **Use Case Taxonomy**: Clinical AI use case categorization
61
+ - **Rich Validation**: Built-in validators for regulatory identifiers (K numbers, product codes)
62
+ - **Database Agnostic**: Pure Pydantic models, no ORM coupling
63
+ - **Type Safe**: Full type hints with mypy support
64
+
65
+ ## Installation
66
+
67
+ ```bash
68
+ # From git (recommended for now)
69
+ pip install git+https://github.com/AsherInformatics/ashmatics-core-datamodels.git
70
+
71
+ # Or add to pyproject.toml
72
+ # dependencies = [
73
+ # "ashmatics-datamodels @ git+https://github.com/AsherInformatics/ashmatics-core-datamodels.git",
74
+ # ]
75
+ ```
76
+
77
+ ## Quick Start
78
+
79
+ ```python
80
+ from ashmatics_datamodels.fda import (
81
+ FDA_ManufacturerBase,
82
+ FDA_510kClearance,
83
+ FDA_DeviceClass,
84
+ ClearanceType,
85
+ )
86
+
87
+ # Create a manufacturer
88
+ manufacturer = FDA_ManufacturerBase(
89
+ manufacturer_name="Medical AI Corp",
90
+ applicant="Medical AI Corp",
91
+ )
92
+
93
+ # Create a 510(k) clearance with validation
94
+ clearance = FDA_510kClearance(
95
+ k_number="K240001", # Validated format
96
+ clearance_date="2024-08-15",
97
+ device_name="AI-Chest Scanner",
98
+ device_class=FDA_DeviceClass.CLASS_2,
99
+ )
100
+ ```
101
+
102
+ ## Package Structure
103
+
104
+ ```
105
+ ashmatics_datamodels/
106
+ ├── common/ # Base models, validators, regulators, frameworks
107
+ ├── fda/ # FDA vocabulary (manufacturers, clearances, classifications, recalls, adverse events)
108
+ ├── documents/ # MongoDB document schemas (three-tier structure)
109
+ ├── use_cases/ # Clinical AI use case taxonomy
110
+ └── utils/ # Parsing and normalization utilities
111
+ ```
112
+
113
+ ## Documentation
114
+
115
+ 📚 **[Full Documentation](https://asherinformatics.github.io/ashmatics-core-datamodels/)** (when published)
116
+
117
+ Or build locally:
118
+ ```bash
119
+ uv pip install -e ".[docs]"
120
+ uv run mkdocs serve
121
+ ```
122
+
123
+ ### Design Documents
124
+ - [Phase 1: FDA & Common Schemas](docs/IMPL-CommonDataModel_Phase1-2025-11-21.md)
125
+ - [Phase 2: MongoDB Document Schemas](docs/IMPL-MongoDocumentSchemas-Phase2-2025-11-21.md)
126
+ - [Complete Migration Plan](docs/Plans/ENGR-DesignPlan-CompleteDataModels-2025-11-21.md)
127
+
128
+ ## License
129
+
130
+ Apache 2.0 - See [LICENSE](LICENSE) for details.
131
+
132
+ ## Contributing
133
+
134
+ This is an internal Asher Informatics library. For questions, contact info@asherinformatics.com.