aw-spec-cli 0.1.0 → 0.1.2

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 (173) hide show
  1. package/assets/.agents/skills/aw-spec-addcomponent/SKILL.md +129 -0
  2. package/assets/.agents/skills/aw-spec-agent-context-update/SKILL.md +31 -0
  3. package/assets/.agents/skills/aw-spec-analyze/SKILL.md +296 -0
  4. package/assets/.agents/skills/aw-spec-checklist/SKILL.md +374 -0
  5. package/assets/.agents/skills/aw-spec-clarify/SKILL.md +320 -0
  6. package/assets/.agents/skills/aw-spec-constitution/SKILL.md +194 -0
  7. package/assets/.agents/skills/aw-spec-fast-implement/SKILL.md +268 -0
  8. package/assets/.agents/skills/aw-spec-foundation/SKILL.md +358 -0
  9. package/assets/.agents/skills/aw-spec-implement/SKILL.md +279 -0
  10. package/assets/.agents/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
  11. package/assets/.agents/skills/aw-spec-plan/SKILL.md +221 -0
  12. package/assets/.agents/skills/aw-spec-select-domain/SKILL.md +73 -0
  13. package/assets/.agents/skills/aw-spec-specify/SKILL.md +382 -0
  14. package/assets/.agents/skills/aw-spec-tasks/SKILL.md +259 -0
  15. package/assets/.agents/skills/aw-spec-taskstoissues/SKILL.md +107 -0
  16. package/assets/.aw-spec/domain.json +3 -0
  17. package/assets/.aw-spec/extensions/.registry +19 -0
  18. package/assets/.aw-spec/extensions/agent-context/README.md +57 -0
  19. package/assets/.aw-spec/extensions/agent-context/agent-context-config.yml +4 -0
  20. package/assets/.aw-spec/extensions/agent-context/commands/aw-spec.agent-context.update.md +26 -0
  21. package/assets/.aw-spec/extensions/agent-context/extension.yml +34 -0
  22. package/assets/.aw-spec/extensions/agent-context/scripts/bash/update-agent-context.sh +201 -0
  23. package/assets/.aw-spec/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +237 -0
  24. package/assets/.aw-spec/extensions.yml +23 -0
  25. package/assets/.aw-spec/feature.json +3 -0
  26. package/assets/.aw-spec/init-options.json +9 -0
  27. package/assets/.aw-spec/integration.json +15 -0
  28. package/assets/.aw-spec/integrations/aw-spec.manifest.json +17 -0
  29. package/assets/.aw-spec/integrations/claude.manifest.json +17 -0
  30. package/assets/.aw-spec/memory/constitution.md +50 -0
  31. package/assets/.aw-spec/scripts/bash/check-prerequisites.sh +189 -0
  32. package/assets/.aw-spec/scripts/bash/common.sh +582 -0
  33. package/assets/.aw-spec/scripts/bash/create-new-feature.sh +299 -0
  34. package/assets/.aw-spec/scripts/bash/setup-plan.sh +84 -0
  35. package/assets/.aw-spec/scripts/bash/setup-tasks.sh +91 -0
  36. package/assets/.aw-spec/templates/checklist-template.md +40 -0
  37. package/assets/.aw-spec/templates/constitution-template.md +57 -0
  38. package/assets/.aw-spec/templates/plan-template.md +113 -0
  39. package/assets/.aw-spec/templates/spec-template.md +131 -0
  40. package/assets/.aw-spec/templates/tasks-template.md +252 -0
  41. package/assets/.aw-spec/workflows/aw-spec/workflow.yml +77 -0
  42. package/assets/.aw-spec/workflows/workflow-registry.json +13 -0
  43. package/assets/.claude/skills/aw-spec-addcomponent/SKILL.md +129 -0
  44. package/assets/.claude/skills/aw-spec-agent-context-update/SKILL.md +31 -0
  45. package/assets/.claude/skills/aw-spec-analyze/SKILL.md +296 -0
  46. package/assets/.claude/skills/aw-spec-checklist/SKILL.md +374 -0
  47. package/assets/.claude/skills/aw-spec-clarify/SKILL.md +320 -0
  48. package/assets/.claude/skills/aw-spec-constitution/SKILL.md +194 -0
  49. package/assets/.claude/skills/aw-spec-fast-implement/SKILL.md +268 -0
  50. package/assets/.claude/skills/aw-spec-foundation/SKILL.md +358 -0
  51. package/assets/.claude/skills/aw-spec-implement/SKILL.md +279 -0
  52. package/assets/.claude/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
  53. package/assets/.claude/skills/aw-spec-plan/SKILL.md +221 -0
  54. package/assets/.claude/skills/aw-spec-select-domain/SKILL.md +73 -0
  55. package/assets/.claude/skills/aw-spec-specify/SKILL.md +382 -0
  56. package/assets/.claude/skills/aw-spec-tasks/SKILL.md +259 -0
  57. package/assets/.claude/skills/aw-spec-taskstoissues/SKILL.md +107 -0
  58. package/assets/.kilocode/rules/specify-rules.md +4 -0
  59. package/assets/.kilocode/workflows/aw-spec-addcomponent.md +129 -0
  60. package/assets/.kilocode/workflows/aw-spec-agent-context.update.md +31 -0
  61. package/assets/.kilocode/workflows/aw-spec-analyze.md +296 -0
  62. package/assets/.kilocode/workflows/aw-spec-checklist.md +374 -0
  63. package/assets/.kilocode/workflows/aw-spec-clarify.md +320 -0
  64. package/assets/.kilocode/workflows/aw-spec-constitution.md +194 -0
  65. package/assets/.kilocode/workflows/aw-spec-fast-implement.md +263 -0
  66. package/assets/.kilocode/workflows/aw-spec-foundation.md +358 -0
  67. package/assets/.kilocode/workflows/aw-spec-implement.md +279 -0
  68. package/assets/.kilocode/workflows/aw-spec-minimal-implementation.md +204 -0
  69. package/assets/.kilocode/workflows/aw-spec-plan.md +221 -0
  70. package/assets/.kilocode/workflows/aw-spec-select-domain.md +73 -0
  71. package/assets/.kilocode/workflows/aw-spec-specify.md +382 -0
  72. package/assets/.kilocode/workflows/aw-spec-tasks.md +259 -0
  73. package/assets/.kilocode/workflows/aw-spec-taskstoissues.md +107 -0
  74. package/assets/docs/README.md +106 -0
  75. package/assets/docs/VerticalSlice/PACKAGING.md +185 -0
  76. package/assets/docs/VerticalSlice/VerticalSlice.pack.txt +2833 -0
  77. package/assets/docs/VerticalSlice/pack-foundation.ps1 +145 -0
  78. package/assets/docs/VerticalSlice/pack-foundation.sh +196 -0
  79. package/assets/docs/VerticalSlice/unpack-foundation.ps1 +126 -0
  80. package/assets/docs/VerticalSlice/unpack-foundation.sh +217 -0
  81. package/assets/docs/architecture/clean-architecture.md +71 -0
  82. package/assets/docs/architecture/cqrs.md +141 -0
  83. package/assets/docs/architecture/eventing.md +83 -0
  84. package/assets/docs/architecture/folder-structure.md +61 -0
  85. package/assets/docs/architecture/modular-monolith.md +47 -0
  86. package/assets/docs/architecture/persistence.md +269 -0
  87. package/assets/docs/architecture/testing.md +55 -0
  88. package/assets/docs/architecture/vertical-slices.md +201 -0
  89. package/assets/docs/command.txt +295 -0
  90. package/assets/docs/components/Email/README.md +112 -0
  91. package/assets/docs/components/Email/integration.md +260 -0
  92. package/assets/docs/components/Jobs/README.md +113 -0
  93. package/assets/docs/components/Jobs/integration.md +245 -0
  94. package/assets/docs/components/QrGenerator/README.md +78 -0
  95. package/assets/docs/components/QrGenerator/integration.md +185 -0
  96. package/assets/docs/components/README.md +57 -0
  97. package/assets/docs/domain/domain-driven-design.md +212 -0
  98. package/assets/docs/domainspecs/healthcare/ai-rules.domain.md +34 -0
  99. package/assets/docs/domainspecs/healthcare/api-versioning.domain.md +17 -0
  100. package/assets/docs/domainspecs/healthcare/auditing.domain.md +29 -0
  101. package/assets/docs/domainspecs/healthcare/authorization.domain.md +26 -0
  102. package/assets/docs/domainspecs/healthcare/clinical-terms.md +20 -0
  103. package/assets/docs/domainspecs/healthcare/coding-standards.domain.md +26 -0
  104. package/assets/docs/domainspecs/healthcare/comandrulemap.md +119 -0
  105. package/assets/docs/domainspecs/healthcare/consent.md +19 -0
  106. package/assets/docs/domainspecs/healthcare/cqrs.domain.md +12 -0
  107. package/assets/docs/domainspecs/healthcare/data-classification.domain.md +28 -0
  108. package/assets/docs/domainspecs/healthcare/dependency-policy.domain.md +11 -0
  109. package/assets/docs/domainspecs/healthcare/dicom.md +15 -0
  110. package/assets/docs/domainspecs/healthcare/domain-driven-design.domain.md +28 -0
  111. package/assets/docs/domainspecs/healthcare/domain-requirements.md +55 -0
  112. package/assets/docs/domainspecs/healthcare/eventing.domain.md +18 -0
  113. package/assets/docs/domainspecs/healthcare/fhir.md +36 -0
  114. package/assets/docs/domainspecs/healthcare/folder-structure.domain.md +23 -0
  115. package/assets/docs/domainspecs/healthcare/hipaa.md +34 -0
  116. package/assets/docs/domainspecs/healthcare/hl7.md +15 -0
  117. package/assets/docs/domainspecs/healthcare/integration-terms.md +21 -0
  118. package/assets/docs/domainspecs/healthcare/persistence.domain.md +20 -0
  119. package/assets/docs/domainspecs/healthcare/terminology.md +30 -0
  120. package/assets/docs/domainspecs/healthcare/testing.domain.md +15 -0
  121. package/assets/docs/domainspecs/healthcare/vertical-slices.domain.md +18 -0
  122. package/assets/docs/domainspecs/healthcare/zero-trust.domain.md +12 -0
  123. package/assets/docs/domainspecs/pharma/ai-rules.domain.md +32 -0
  124. package/assets/docs/domainspecs/pharma/api-versioning.domain.md +20 -0
  125. package/assets/docs/domainspecs/pharma/atc.md +22 -0
  126. package/assets/docs/domainspecs/pharma/auditing.domain.md +26 -0
  127. package/assets/docs/domainspecs/pharma/authorization.domain.md +25 -0
  128. package/assets/docs/domainspecs/pharma/coding-standards.domain.md +28 -0
  129. package/assets/docs/domainspecs/pharma/comandrulemap.md +136 -0
  130. package/assets/docs/domainspecs/pharma/cqrs.domain.md +16 -0
  131. package/assets/docs/domainspecs/pharma/data-classification.domain.md +24 -0
  132. package/assets/docs/domainspecs/pharma/data-provenance.md +21 -0
  133. package/assets/docs/domainspecs/pharma/dependency-policy.domain.md +11 -0
  134. package/assets/docs/domainspecs/pharma/domain-driven-design.domain.md +36 -0
  135. package/assets/docs/domainspecs/pharma/domain-requirements.md +99 -0
  136. package/assets/docs/domainspecs/pharma/eventing.domain.md +18 -0
  137. package/assets/docs/domainspecs/pharma/fhir.md +31 -0
  138. package/assets/docs/domainspecs/pharma/folder-structure.domain.md +24 -0
  139. package/assets/docs/domainspecs/pharma/hl7.md +17 -0
  140. package/assets/docs/domainspecs/pharma/idmp.md +26 -0
  141. package/assets/docs/domainspecs/pharma/integration-terms.md +21 -0
  142. package/assets/docs/domainspecs/pharma/ndc.md +28 -0
  143. package/assets/docs/domainspecs/pharma/persistence.domain.md +23 -0
  144. package/assets/docs/domainspecs/pharma/pharma-terms.md +27 -0
  145. package/assets/docs/domainspecs/pharma/product-lifecycle.domain.md +30 -0
  146. package/assets/docs/domainspecs/pharma/regulatory-compliance.md +19 -0
  147. package/assets/docs/domainspecs/pharma/terminology.md +32 -0
  148. package/assets/docs/domainspecs/pharma/testing.domain.md +19 -0
  149. package/assets/docs/domainspecs/pharma/vertical-slices.domain.md +17 -0
  150. package/assets/docs/domainspecs/pharma/zero-trust.domain.md +12 -0
  151. package/assets/docs/glossary/ai-rules.md +59 -0
  152. package/assets/docs/governance/api-versioning.md +99 -0
  153. package/assets/docs/governance/coding-standards.md +87 -0
  154. package/assets/docs/governance/dependency-policy.md +40 -0
  155. package/assets/docs/interop/ihe-conformance.md +31 -0
  156. package/assets/docs/pharma-constitution.my-ref.md +86 -0
  157. package/assets/docs/requirement-spec.txt +15 -0
  158. package/assets/docs/security/auditing.md +117 -0
  159. package/assets/docs/security/authorization-matrix.md +14 -0
  160. package/assets/docs/security/authorization.md +87 -0
  161. package/assets/docs/security/data-classification.md +38 -0
  162. package/assets/docs/security/zero-trust.md +76 -0
  163. package/assets/docs/technology-constitution.md +172 -0
  164. package/dist/commands/init.d.ts.map +1 -1
  165. package/dist/commands/init.js +3 -2
  166. package/dist/commands/init.js.map +1 -1
  167. package/dist/utils/copy-assets.d.ts +8 -1
  168. package/dist/utils/copy-assets.d.ts.map +1 -1
  169. package/dist/utils/copy-assets.js +1 -0
  170. package/dist/utils/copy-assets.js.map +1 -1
  171. package/dist/utils/paths.js +1 -1
  172. package/dist/utils/paths.js.map +1 -1
  173. package/package.json +1 -1
@@ -0,0 +1,16 @@
1
+ # CQRS — Pharma Domain Addenda
2
+
3
+ > Technology base: [[cqrs]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Pipeline
6
+ - Append a **product-audit behavior** to the mediator pipeline: every create/modify/retire/re-identify/reclassify command on `MedicinalProduct` MUST emit an immutable audit record (User, Timestamp, Action, Previous Value, New Value). See [[auditing.domain]], [[regulatory-compliance]].
7
+
8
+ ## Commands & queries
9
+ - Registration, lifecycle transitions, ingredient/packaging edits, identifier & classification changes = **commands**; each publishes its domain event (see [[eventing.domain]], [[product-lifecycle.domain]]).
10
+ - Product lookup, version history, FHIR projections = **queries** via `IReadRepository<MedicinalProduct>` + a `Specification` (see [[persistence.domain]]).
11
+
12
+ ## Error codes
13
+ `medicinal-product.not_found` · `ndc.duplicate` · `ndc.invalid_format` · `dosage-form.invalid` · `route.invalid` · `atc.invalid_code` · `lifecycle.invalid_transition` · `concurrency.conflict`.
14
+
15
+ ## Related
16
+ - [[cqrs]] · [[auditing.domain]] · [[eventing.domain]] · [[product-lifecycle.domain]] · [[persistence.domain]] · [[domain-driven-design.domain]] · [[regulatory-compliance]]
@@ -0,0 +1,24 @@
1
+ # Data Classification — Pharma Domain Addenda
2
+
3
+ > Technology base: [[data-classification]]. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-implement`.
4
+
5
+ > No PHI — the model is commercial confidentiality, regulatory integrity, and source trust.
6
+
7
+ ## Categories
8
+ | Class | Extra rules |
9
+ |---|---|
10
+ | **Public / Published** (NDC-directory disclosure level) | Projectable via the public FHIR surface once `MarketingStatus` is active |
11
+ | **Commercially-Sensitive** (pre-market formulations, proprietary strengths, unpublished products) | Access-restricted; **MUST NOT** be on the public FHIR surface until marketing status permits |
12
+ | **Regulatory-Submission** (MA dossier refs, regulator keys) | Restricted; audited access (see [[auditing.domain]]) |
13
+ | **Externally-Sourced** (FDA NDC / RxNorm / WHO ATC / partner feeds) | Carries a `ProvenanceRecord`; still validated (see [[data-provenance]]) |
14
+
15
+ ## Data integrity (GxP / ALCOA+)
16
+ - GxP records satisfy **ALCOA+** (Attributable, Legible, Contemporaneous, Original, Accurate + Complete, Consistent, Enduring, Available), enforced via immutable audit, provenance, version history (see [[auditing.domain]], [[data-provenance]], [[persistence.domain]], [[regulatory-compliance]]).
17
+
18
+ ## Exposure & logging
19
+ - `Draft`/`Under Review` or non-public `MarketingStatus` products MUST NOT be published on the public FHIR/REST surface (see [[product-lifecycle.domain]], [[fhir]]).
20
+ - Externally-sourced values are never published without passing validation (see [[ndc]], [[atc]], [[terminology]]).
21
+ - Commercially-sensitive pre-market details MUST NOT appear in logs/metrics/traces — log the product ID only (see [[coding-standards.domain]]).
22
+
23
+ ## Related
24
+ - [[data-classification]] · [[data-provenance]] · [[auditing.domain]] · [[persistence.domain]] · [[regulatory-compliance]] · [[product-lifecycle.domain]] · [[authorization.domain]] · [[coding-standards.domain]] · [[ndc]] · [[atc]] · [[fhir]]
@@ -0,0 +1,21 @@
1
+ # Data Provenance Standards — Pharma
2
+
3
+ > NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## First-class concern
6
+ - Any product attribute imported from an external source (FDA NDC directory, RxNorm, WHO ATC, an MAH submission, a partner feed) SHALL carry a **`ProvenanceRecord`** (Provenance module).
7
+ - Provenance is captured at ingestion through the Interop adapters — never back-filled by guessing (see [[hl7]], [[fhir]], [[ai-rules.domain]]).
8
+
9
+ ## Record (minimum)
10
+ ```
11
+ { source, sourceSystem, sourceVersion, method, agent, timestamp, importedFields[], correlationId }
12
+ ```
13
+ - **sourceVersion** = originating authority's release/version (e.g. terminology edition; see [[terminology]], [[atc]]); **method** = automated import / manual entry / API sync; **agent** = responsible principal.
14
+
15
+ ## Integrity
16
+ - Complements audit (who/when/what; see [[auditing.domain]]) and version history (see [[persistence.domain]]).
17
+ - Provenance does **not** exempt an NDC/ATC/UNII value from validation (see [[ndc]], [[atc]], [[terminology]]).
18
+ - MAY project to the FHIR `Provenance` resource (see [[fhir]]).
19
+
20
+ ## Related
21
+ - [[auditing.domain]] · [[persistence.domain]] · [[terminology]] · [[ndc]] · [[atc]] · [[fhir]] · [[regulatory-compliance]] · [[ai-rules.domain]]
@@ -0,0 +1,11 @@
1
+ # Dependency Policy — Pharma Domain Addenda
2
+
3
+ > Technology base: [[dependency-policy]]. Commands: `/aw-spec-plan`, `/aw-spec-implement`.
4
+
5
+ ## Reviews & libraries
6
+ - Every new dependency gets a **regulatory-suitability** review beyond the generic license/supply-chain check — reject packages that phone home or ship analytics by default (leak risk for commercially-sensitive pre-market data) (see [[data-classification.domain]]).
7
+ - FHIR: the **official FHIR .NET SDK**, version-matched to the endpoint (R4/R5; see [[fhir]]).
8
+ - Terminology integrations (RxNorm/SNOMED/UNII/ATC/NDC) go through the Terminology module; client libraries added **only** on explicit developer request — no AI-introduced terminology/interop dependencies (see [[terminology]], [[hl7]], [[ai-rules.domain]]).
9
+
10
+ ## Related
11
+ - [[dependency-policy]] · [[fhir]] · [[hl7]] · [[terminology]] · [[data-classification.domain]] · [[ai-rules.domain]]
@@ -0,0 +1,36 @@
1
+ # Domain-Driven Design — Medicinal Product Domain Model
2
+
3
+ > Technology base: [[domain-driven-design]]. NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Modeling
6
+ - Use the pharma/regulatory ubiquitous language (see [[pharma-terms]]), aligned to ISO IDMP concepts (see [[idmp]]).
7
+ - FHIR- and IDMP-aligned, but **FHIR resources are projections, not the system of record** (see [[fhir]]); the aggregate is authoritative.
8
+ - Coded concepts use industry terminologies, never free text (see [[terminology]]); coded VOs follow the FHIR pattern (`Codeable`, `Coding`, `Quantity`, `Ratio`, `Identifier`).
9
+
10
+ ## Aggregate Root
11
+ - **`MedicinalProduct` is the Aggregate Root.** All product data (ingredients, packaging, marketing authorization, identifiers, classification, lifecycle state) is reached/modified **through** it; no external code mutates a contained entity directly. Invariants are enforced atomically; state changes raise domain events (see [[eventing.domain]]).
12
+
13
+ ## Value Objects (immutable, equality by value)
14
+ `NdcCode` · `ProductName` · `GenericName` · `Strength` · `DosageForm` · `RouteOfAdministration` · `AtcCode` · `MarketingStatus` · `PackageIdentifier`
15
+ - `NdcCode`/`PackageIdentifier` — segmented, format-validated, unique (see [[ndc]]).
16
+ - `Strength` — numerator/denominator `Quantity` with UCUM units; `DosageForm`/`RouteOfAdministration`/`AtcCode` — coded against configured value sets (see [[terminology]], [[atc]]).
17
+
18
+ ## Entities (identity within the aggregate)
19
+ - **`ActiveIngredient`** — Name, UNII, Strength, Strength Unit. **>= 1 required.**
20
+ - **`PackagingConfiguration`** — Package NDC, Description, Quantity, Unit of Measure. **>= 1 required.**
21
+ - **`MarketingAuthorization`** — authorization granted to the MAH by a regulator (see [[idmp]]).
22
+
23
+ ## Invariants
24
+ - **MedicinalProduct** — NDC unique + format-valid (invalid blocks persistence); >= 1 ActiveIngredient + >= 1 PackagingConfiguration; all required attributes enforced at registration; dosage form/route must be valid coded values; lifecycle transitions must be valid (see [[product-lifecycle.domain]]); identifier/classification changes are audit-mandatory + emit events (see [[auditing.domain]], [[eventing.domain]]).
25
+ - **PackagingConfiguration** — Package NDC unique within and across products (see [[ndc]]).
26
+ - **ActiveIngredient** — Strength + Strength Unit required; UNII validated where supplied (see [[terminology]]).
27
+ - **AuditRecord** — append-only; no update/delete (see [[auditing.domain]]).
28
+
29
+ ## Validation summary
30
+ NDC format; required attributes; duplicate identifiers; invalid dosage forms; invalid routes; invalid lifecycle transitions (see [[ndc]], [[terminology]], [[product-lifecycle.domain]]).
31
+
32
+ ## AI guidance
33
+ See [[ai-rules.domain]] — confirm signatures, use the official FHIR SDK, never invent NDC/UNII/RxNorm/SNOMED/ATC codes, keep FHIR as projections.
34
+
35
+ ## Related
36
+ - [[domain-driven-design]] · [[product-lifecycle.domain]] · [[ndc]] · [[idmp]] · [[atc]] · [[terminology]] · [[fhir]] · [[eventing.domain]] · [[auditing.domain]] · [[persistence.domain]] · [[pharma-terms]] · [[ai-rules.domain]]
@@ -0,0 +1,99 @@
1
+ # DOMAIN REQUIREMENTS (project-specific)
2
+
3
+ > Project-specific input, **updated independently per project**. The engineering constitution
4
+ > stays domain-agnostic and supreme; this file holds the per-project enumeration and headline
5
+ > profiles for the **Medicinal Product Registration** domain. Detailed domain *rules* are
6
+ > expanded in the sibling files in this folder.
7
+ >
8
+ > Replace `<SampleProjectName>` and the bounded-context list below for a new project.
9
+
10
+ =====================================================================
11
+ [DOMAIN: Bounded Contexts / Modules]
12
+ =====================================================================
13
+ - ProductRegistry — aggregate root: **MedicinalProduct**; owns ActiveIngredient,
14
+ PackagingConfiguration, MarketingAuthorization entities and the product value objects
15
+ (NdcCode, ProductName, GenericName, Strength, DosageForm, RouteOfAdministration, AtcCode,
16
+ MarketingStatus, PackageIdentifier). See [[domain-driven-design.domain]].
17
+ - Substances — aggregates: Substance, ActiveMoiety; UNII-keyed ingredient identity
18
+ (see [[terminology]]).
19
+ - Organizations — aggregates: Organization, MarketingAuthorizationHolder, Manufacturer,
20
+ Labeler. Maps to FHIR `Organization` (see [[fhir]]).
21
+ - Classification — aggregates: AtcClassification, ProductClassification; ATC code sets and
22
+ SNOMED CT classification references (see [[atc]], [[terminology]]).
23
+ - Terminology — aggregates: CodeSystem, ValueSet, ConceptMap (project-managed subsets;
24
+ expansions cached from external terminology services). Backs NDC/ATC/UNII/SNOMED/RxNorm
25
+ validation (see [[terminology]]).
26
+ - Lifecycle — the MedicinalProduct state machine (Draft → Under Review → Approved → Active →
27
+ Discontinued → Withdrawn) and its transition guards (see [[product-lifecycle.domain]]).
28
+ - Interoperability — aggregates: FhirProjection, IntegrationEndpoint; FHIR Medication /
29
+ MedicationKnowledge / Substance / Organization projections and HL7 readiness
30
+ (see [[fhir]], [[hl7]]).
31
+ - Provenance — aggregate: ProvenanceRecord for externally sourced product data
32
+ (see [[data-provenance]]).
33
+ - Auditing — aggregate: AuditRecord (append-only). Captures creation, modification,
34
+ retirement, identifier and classification changes (see [[auditing.domain]]).
35
+
36
+ =====================================================================
37
+ [DOMAIN: subsection pointers]
38
+ =====================================================================
39
+ [DOMAIN: Standards — NDC] -> docs/domainspecs/pharma/ndc.md
40
+ [DOMAIN: Standards — ISO IDMP] -> docs/domainspecs/pharma/idmp.md
41
+ [DOMAIN: Standards — ATC] -> docs/domainspecs/pharma/atc.md
42
+ [DOMAIN: Standards — Terminology] -> docs/domainspecs/pharma/terminology.md
43
+ [DOMAIN: Interop — FHIR] -> docs/domainspecs/pharma/fhir.md
44
+ [DOMAIN: Interop — HL7] -> docs/domainspecs/pharma/hl7.md
45
+ [DOMAIN: Aggregates and Business Invariants] -> docs/domainspecs/pharma/domain-driven-design.domain.md
46
+ [DOMAIN: Product Lifecycle] -> docs/domainspecs/pharma/product-lifecycle.domain.md
47
+ [DOMAIN: Regulatory / Compliance] -> docs/domainspecs/pharma/regulatory-compliance.md
48
+ [DOMAIN: Data Provenance] -> docs/domainspecs/pharma/data-provenance.md
49
+ [DOMAIN: Audit Profile] -> docs/domainspecs/pharma/auditing.domain.md
50
+ [DOMAIN: Persistence / Versioning Profile] -> docs/domainspecs/pharma/persistence.domain.md
51
+ [DOMAIN: Eventing Profile] -> docs/domainspecs/pharma/eventing.domain.md
52
+ [DOMAIN: Testing Profile] -> docs/domainspecs/pharma/testing.domain.md
53
+ [DOMAIN: Security Profile] -> docs/domainspecs/pharma/authorization.domain.md, docs/domainspecs/pharma/data-classification.domain.md, docs/domainspecs/pharma/zero-trust.domain.md
54
+ [DOMAIN: Coding Standards Profile] -> docs/domainspecs/pharma/coding-standards.domain.md
55
+ [DOMAIN: CQRS / Vertical Slices Profile] -> docs/domainspecs/pharma/cqrs.domain.md, docs/domainspecs/pharma/vertical-slices.domain.md
56
+ [DOMAIN: Folder Structure Profile] -> docs/domainspecs/pharma/folder-structure.domain.md
57
+ [DOMAIN: API Versioning Profile] -> docs/domainspecs/pharma/api-versioning.domain.md
58
+ [DOMAIN: Dependency Policy Profile] -> docs/domainspecs/pharma/dependency-policy.domain.md
59
+ [DOMAIN: Integration Terms] -> docs/domainspecs/pharma/integration-terms.md
60
+ [DOMAIN: AI Policy Addenda] -> docs/domainspecs/pharma/ai-rules.domain.md
61
+ [DOMAIN: Ubiquitous Language] -> docs/domainspecs/pharma/pharma-terms.md
62
+ [DOMAIN: Platform Topology] -> below
63
+
64
+ =====================================================================
65
+ [DOMAIN: Platform Topology]
66
+ =====================================================================
67
+ - Target runtime: Kubernetes (AKS, EKS, or on-prem). Single-region by default; multi-region
68
+ active/passive for DR.
69
+ - External dependencies (Aspire resources): PostgreSQL (primary product registry), Redis
70
+ (cache for terminology expansions + read models), a message broker (Azure Service Bus,
71
+ AWS SQS/SNS, or RabbitMQ) for CloudEvents, an OTel collector, the configured IdP, an external
72
+ Terminology Service (NDC/RxNorm/SNOMED/UNII/ATC value-set expansion, optional), a FHIR
73
+ validator container, and an object store (S3/Blob) for imported source documents / labels.
74
+ - Scale targets: P95 read latency < 200 ms at 200 RPS per module; FHIR search P95 < 500 ms.
75
+ - Disaster recovery: RPO <= 15 minutes, RTO <= 4 hours; daily encrypted backups with 35-day
76
+ retention plus monthly archive. Product registry and audit history are retention-protected
77
+ (see [[persistence.domain]], [[auditing.domain]]).
78
+
79
+ =====================================================================
80
+ [DOMAIN: Governance Overrides]
81
+ =====================================================================
82
+ - Principal Engineers (approvers): TBD — fill at ratification.
83
+ - Regulatory / Compliance Officer (mandatory approver for any identifier, classification, or
84
+ lifecycle-rule change): TBD.
85
+ - Domain Owners (per module): TBD — assign one regulatory and one technical owner per bounded
86
+ context.
87
+ - Quarterly review cadence: first business week of each quarter; an additional review after
88
+ every relevant regulatory or terminology-release update (e.g. WHO ATC annual update, FDA NDC
89
+ directory changes).
90
+ - Exception process: a time-boxed waiver via a Waiver Request issue, approved by a Principal
91
+ Engineer + the Compliance Officer, with a mandatory expiry <= 90 days and a remediation plan
92
+ recorded in the issue.
93
+
94
+ ## Related
95
+
96
+ - [[domain-driven-design.domain]] · [[product-lifecycle.domain]] · [[ndc]] · [[idmp]] ·
97
+ [[atc]] · [[terminology]] · [[fhir]] · [[hl7]] · [[regulatory-compliance]] ·
98
+ [[data-provenance]] · [[auditing.domain]] · [[persistence.domain]] · [[ai-rules.domain]] ·
99
+ [[pharma-terms]]
@@ -0,0 +1,18 @@
1
+ # Eventing — Pharma Domain Addenda
2
+
3
+ > Technology base: [[eventing]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Domain events
6
+ - `MedicinalProduct` raises domain events on every significant state change — the integration seam to downstream consumers (prescribing, dispensing, manufacturing, pharmacovigilance, clinical).
7
+ - Events publish from the aggregate boundary, never by an external feed writing aggregates directly (see [[hl7]], [[domain-driven-design.domain]]).
8
+
9
+ ## Canonical events
10
+ `MedicinalProductRegistered` (Draft) · `…SubmittedForReview`/`Approved`/`Activated`/`Discontinued`/`Withdrawn` (lifecycle, see [[product-lifecycle.domain]]) · `ProductIdentifierChanged` (NDC, see [[ndc]]) · `ProductClassificationChanged` (ATC, see [[atc]]) · `ActiveIngredientChanged`/`PackagingConfigurationChanged` · `MarketingStatusChanged`. Each = an audit-mandatory operation (see [[auditing.domain]]).
11
+
12
+ ## Delivery
13
+ - Outbox pattern: events persisted transactionally with the aggregate change, published to CloudEvents. Consumers integrate via FHIR / REST / event stream — **direct DB access FORBIDDEN** (see [[fhir]]).
14
+ - Payloads carry coded values via standard terminologies, never free text (see [[terminology]], [[ndc]], [[atc]]).
15
+ - Each event carries a `correlationId` tying command → audit record → version snapshot (see [[auditing.domain]], [[persistence.domain]], [[regulatory-compliance]]).
16
+
17
+ ## Related
18
+ - [[eventing]] · [[domain-driven-design.domain]] · [[product-lifecycle.domain]] · [[auditing.domain]] · [[persistence.domain]] · [[fhir]] · [[hl7]] · [[ndc]] · [[atc]] · [[terminology]]
@@ -0,0 +1,31 @@
1
+ # FHIR Standards — Pharma
2
+
3
+ > NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Architecture & projectors
6
+ - **R4 default**; R5 **additive** under `/fhir/R5/...`. FHIR is the canonical interop contract; it + any internal REST serve from the **same authoritative aggregates** — no duplicate write paths.
7
+ - **FHIR resources are PROJECTIONS, NOT the system of record** — `MedicinalProduct` is authoritative (see [[domain-driven-design.domain]]).
8
+ - Mapping in `{Module}/Interop/Fhir/<Resource>Projector.cs`, hand-written + round-trip tested (see [[testing.domain]]). A second FHIR write path bypassing the aggregate is FORBIDDEN; FHIR representations MUST NOT replace internal DTOs.
9
+
10
+ ## Resource mappings
11
+ | Domain concept | FHIR resource |
12
+ |---|---|
13
+ | `MedicinalProduct` (dispensable identity) | **Medication** |
14
+ | `MedicinalProduct` (classification/packaging/regulatory) | **MedicationKnowledge** |
15
+ | `Substance` / `ActiveIngredient` | **Substance** |
16
+ | `MarketingAuthorizationHolder` / `Manufacturer` / `Labeler` | **Organization** |
17
+
18
+ - Identifiers → FHIR `Identifier` (`NdcCode` with NDC system URI; IDMP MPID/PhPID where adopted; see [[ndc]], [[idmp]]).
19
+ - Names → `Medication.code` + name elements; coded fields → `CodeableConcept`/`Coding` (see [[terminology]]); ATC codings carry the ATC system URI (see [[atc]]).
20
+ - `Strength` → `Medication.ingredient.strength` (`Ratio` of `Quantity`); `DosageForm` → `Medication.form`; route + packaging → `MedicationKnowledge`.
21
+
22
+ ## Conformance
23
+ - FHIR types from the **official FHIR .NET SDK**, version-matched (R4/R5) (see [[ai-rules.domain]]).
24
+ - Declare profiles/extensions/value-sets in `StructureDefinition` resources; FHIR validator passes for every modified resource/profile/example (CI gate).
25
+ - Publish `CapabilityStatement` at `/fhir/metadata` (diff reviewed); `/metadata` + `/.well-known` may be `AllowAnonymous()`.
26
+
27
+ ## Bundle / search / concurrency
28
+ - Bundle/searchset semantics (`_count`, `_offset`/`_page`, `_total`); errors via `OperationOutcome` (HTTP 422); `If-Match` → FHIR **weak** ETag at the projection boundary (see [[persistence.domain]]).
29
+
30
+ ## Related
31
+ - [[domain-driven-design.domain]] · [[terminology]] · [[ndc]] · [[idmp]] · [[atc]] · [[hl7]] · [[integration-terms]] · [[persistence.domain]] · [[testing.domain]] · [[ai-rules.domain]]
@@ -0,0 +1,24 @@
1
+ # Folder Structure — Pharma Domain Addenda
2
+
3
+ > Technology base: [[folder-structure]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`. Replace `<SampleProjectName>`.
4
+
5
+ ## Additions to the base layout
6
+ ```
7
+ src/<SampleProjectName>.Service/
8
+ Infrastructure/Security/ auth handlers, scope evaluators, change-authority checks
9
+ Infrastructure/Auditing/ immutable product-audit emitter (FHIR AuditEvent shape)
10
+ ProductRegistry/Domain/<ValueObject>.cs NdcCode, AtcCode, Strength, DosageForm, ...
11
+ ProductRegistry/Domain/MedicinalProduct.cs aggregate root (see [[domain-driven-design.domain]])
12
+ ProductRegistry/Interop/Fhir/ Medication/MedicationKnowledge/Substance/Organization projectors (see [[fhir]])
13
+ ProductRegistry/Interop/Hl7v2/ inbound parsers + outbound emitters (when needed) (see [[hl7]])
14
+ Terminology/ CodeSystem/ValueSet/ConceptMap + seed (NDC/RxNorm/SNOMED/UNII/ATC) (see [[terminology]])
15
+ Provenance/ ProvenanceRecord store for external data (see [[data-provenance]])
16
+ tests/<SampleProjectName>.InteropTests/ FHIR-validator conformance (see [[testing.domain]])
17
+ tests/<SampleProjectName>.TestFixtures/ synthetic/test NDC + terminology sentinels (see [[testing.domain]])
18
+ docs/interop/fhir-implementation-guide/ · docs/regulatory/compliance-controls.md
19
+ ```
20
+ - `Interop/` adapters translate to/from internal commands + projections (see [[vertical-slices.domain]]).
21
+ - Coded VOs follow the FHIR pattern (see [[terminology]], [[coding-standards.domain]]); version history + audit store are retention-protected (see [[persistence.domain]], [[auditing.domain]]).
22
+
23
+ ## Related
24
+ - [[folder-structure]] · [[fhir]] · [[hl7]] · [[terminology]] · [[data-provenance]] · [[testing.domain]] · [[vertical-slices.domain]] · [[domain-driven-design.domain]]
@@ -0,0 +1,17 @@
1
+ # HL7 Integration Readiness — Pharma
2
+
3
+ > Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Principle
6
+ - The solution SHALL support **future integration with HL7-based systems**. The registry is the authoritative product source; HL7 surfaces are **adapters, not a parallel model**. FHIR is the primary contract (see [[fhir]]); HL7 v2 adapters are added where a downstream system (prescribing/dispensing/manufacturing/pharmacovigilance) needs them.
7
+
8
+ ## Adapter patterns
9
+ - Inbound/outbound adapters live in `{Module}/Interop/Hl7v2/`; translate via `IMediator` — **MUST NOT** write aggregates directly (see [[eventing.domain]], [[domain-driven-design.domain]]). Bypassing them from an external feed is an AI refusal condition (see [[ai-rules.domain]]).
10
+ - The egress adapter converts domain events (e.g. `MedicinalProductActivated`, `ClassificationChanged`) to outbound messages; conformance tested against an internal corpus (see [[testing.domain]]).
11
+ - Codes in HL7 messages use standard terminologies (NDC, RxNorm, UNII, ATC) — never free text (see [[terminology]], [[ndc]], [[atc]]).
12
+
13
+ ## Future surfaces
14
+ - Pharmacovigilance (ICH E2B/ICSR), manufacturing, dispensing integrations are **additive** — consume via FHIR / REST / CloudEvents; **direct DB access FORBIDDEN** (see [[eventing.domain]]).
15
+
16
+ ## Related
17
+ - [[fhir]] · [[eventing.domain]] · [[terminology]] · [[ndc]] · [[atc]] · [[integration-terms]] · [[domain-driven-design.domain]] · [[testing.domain]] · [[ai-rules.domain]]
@@ -0,0 +1,26 @@
1
+ # ISO IDMP — Identification of Medicinal Products
2
+
3
+ > NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Alignment principle
6
+ - The model SHALL align with the ISO IDMP suite (**ISO 11615/11616/11238/11239/11240**) **where applicable** — IDMP shapes the ubiquitous language + aggregate boundaries; it is **not** a wire format and does not replace the internal model (see [[domain-driven-design.domain]]).
7
+ - Even where IDMP messages aren't yet exchanged, preserve the IDMP concept boundaries so future exchange is additive, not a rewrite.
8
+
9
+ ## Required concepts → model home
10
+ | IDMP concept | Model home |
11
+ |---|---|
12
+ | **Medicinal Product** | `MedicinalProduct` aggregate root |
13
+ | **Manufactured Item** | manufactured dose-form item (within the aggregate or a related entity) |
14
+ | **Pharmaceutical Product** | administrable product = `DosageForm` + `Strength` + `RouteOfAdministration` |
15
+ | **Substance** | `Substance` aggregate, UNII-identified (see [[terminology]]); referenced by `ActiveIngredient` |
16
+ | **Marketing Authorization Holder** | `MarketingAuthorizationHolder` → FHIR `Organization` (see [[fhir]]) |
17
+ | **Packaging** | `PackagingConfiguration` (Package NDC, description, quantity, UoM) (see [[ndc]]) |
18
+ | **Strength** | `Strength` VO (numerator/denominator `Quantity`, UCUM) |
19
+ | **Route of Administration** | `RouteOfAdministration` VO (coded) |
20
+
21
+ ## Identifiers & terminology
22
+ - IDMP identifiers (**MPID**, **PhPID**) SHALL be representable as FHIR `Identifier`-shaped VOs when adopted; they coexist with NDC, not replace it (see [[ndc]]).
23
+ - IDMP controlled vocabularies (dose form, route, units, packaging) bind to the Terminology module's code systems, never free text (see [[terminology]], [[atc]]).
24
+
25
+ ## Related
26
+ - [[domain-driven-design.domain]] · [[ndc]] · [[terminology]] · [[atc]] · [[fhir]] · [[pharma-terms]]
@@ -0,0 +1,21 @@
1
+ # Glossary — Integration Terms (Pharma)
2
+
3
+ > Ubiquitous language for pharma interoperability standards + identifiers. Commands: `/aw-spec-specify`, `/aw-spec-clarify`, `/aw-spec-plan`. See [[pharma-terms]] (aggregates) + [[terminology]] (coding).
4
+
5
+ | Term | Definition |
6
+ |---|---|
7
+ | **NDC** | US FDA product/package identifier (Labeler + Product + Package); the `NdcCode` VO; format-validated, unique (see [[ndc]]). |
8
+ | **ISO IDMP** | Identification of Medicinal Products (ISO 11615/11616/11238/11239/11240); conceptual alignment; may carry MPID/PhPID (see [[idmp]]). |
9
+ | **UNII** | FDA substance identity for ingredients/moieties; maps to FHIR `Substance.code` (see [[terminology]]). |
10
+ | **RxNorm** | Normalized clinical-drug naming (US); optional product identifier (see [[terminology]]). |
11
+ | **WHO ATC** | Therapeutic class codes; multiple per product, validated against configured sets (see [[atc]]). |
12
+ | **SNOMED CT** | Terminology for dosage forms, routes, product classification (see [[terminology]]). |
13
+ | **UCUM** | Units for strength + package quantity (see [[terminology]]). |
14
+ | **FHIR** | Canonical external contract (R4 default, R5 additive); projects to `Medication`/`MedicationKnowledge`/`Substance`/`Organization` over aggregates (see [[fhir]]). |
15
+ | **HL7** | **HL7 v2.x** legacy messaging via adapters where a consumer needs it; **HL7 FHIR** is the primary contract (see [[hl7]], [[fhir]]). |
16
+ | **Provenance** | Source metadata for externally sourced data; may project to FHIR `Provenance` (see [[data-provenance]]). |
17
+ | **CloudEvents** | CNCF durable async event-stream spec; carries product domain events (see [[eventing.domain]]). |
18
+ | **OpenAPI / CapabilityStatement** | Versioned machine-readable contracts for REST / FHIR (see [[api-versioning.domain]]). |
19
+
20
+ ## Related
21
+ - [[pharma-terms]] · [[terminology]] · [[ndc]] · [[idmp]] · [[atc]] · [[fhir]] · [[hl7]] · [[data-provenance]] · [[eventing.domain]] · [[api-versioning.domain]]
@@ -0,0 +1,28 @@
1
+ # NDC — National Drug Code Standards
2
+
3
+ > NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Value Object
6
+ - **NDC SHALL be a Value Object** (`NdcCode`) — immutable, equality by value (see [[domain-driven-design.domain]]).
7
+ - Product-level NDC lives on `MedicinalProduct`; package-level (`PackageIdentifier` / Package NDC) on each `PackagingConfiguration`.
8
+ - Free-text storage of an NDC is a Forbidden Pattern.
9
+
10
+ ## Segments & format
11
+ - Three segments: **Labeler Code**, **Product Code**, **Package Code** — retain each segment discretely **plus** the canonical formatted string (boundaries MUST NOT be lost to a concatenated string).
12
+ - Common configurations (5-4-2, 5-3-2, 4-4-2 10-digit + the 11-digit normalized form) SHALL be representable as **data, not compiled constants**.
13
+ - The Labeler Code is FDA-assigned to the **Labeler** organization; the registry does not mint Labeler Codes (see [[domain-requirements]]).
14
+
15
+ ## Uniqueness
16
+ - **NDC uniqueness SHALL be enforced** — a product NDC maps to <=1 active `MedicinalProduct`; a Package NDC to <=1 `PackagingConfiguration`.
17
+ - Duplicate detection runs at registration + any identifier change; enforced at the aggregate boundary **and** a persistence-level unique constraint (see [[persistence.domain]], [[auditing.domain]]).
18
+
19
+ ## Validation
20
+ - **NDC validation rules SHALL be configurable** (segment lengths, allowed configurations, check rules = value-set data).
21
+ - Runs on registration, identifier change, and external import (see [[data-provenance]]); an invalid NDC raises a domain error — the Domain MUST NOT persist it.
22
+ - Never invent NDC values or Labeler Codes — validate external codes against the configured rules + FDA NDC directory via the Terminology module (see [[terminology]], [[ai-rules.domain]]).
23
+
24
+ ## FHIR mapping
25
+ - `NdcCode` → FHIR `Identifier` (NDC system URI); also participates in `Medication.code` as a `CodeableConcept` coding (see [[fhir]]).
26
+
27
+ ## Related
28
+ - [[domain-driven-design.domain]] · [[idmp]] · [[terminology]] · [[fhir]] · [[data-provenance]] · [[persistence.domain]] · [[auditing.domain]] · [[ai-rules.domain]]
@@ -0,0 +1,23 @@
1
+ # Persistence — Pharma Domain Addenda
2
+
3
+ > Technology base: [[persistence]]. NON-NEGOTIABLE. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Version history
6
+ - Maintain a **version history** of product information: each approved change produces a new, immutable **`ProductVersion`** snapshot.
7
+ - **Historical versions remain queryable** — a read model exposes prior versions by product + effective time; superseded versions are never overwritten or purged. Snapshots complement audit (who/what/when; see [[auditing.domain]]) and provenance (source; see [[data-provenance]]).
8
+
9
+ ## Retention-protected data
10
+ - Hard delete FORBIDDEN for `MedicinalProduct` and all product history — delete logically via `MarkAsDeleted(...)` / lifecycle retirement.
11
+ - **Product retirement** (Discontinued/Withdrawn) is a state change, not a delete (see [[product-lifecycle.domain]]).
12
+ - `AuditRecord` is **append-only** — no delete (see [[auditing.domain]]).
13
+ - Retention: registry + version history per regulatory policy (registration lifetime + statutory tail); `AuditRecord` per [[auditing.domain]]; daily encrypted backups.
14
+
15
+ ## Constraints & concurrency
16
+ - Persistence-level **unique constraints** on NDC and Package NDC, beyond the aggregate check (see [[ndc]], [[domain-driven-design.domain]]).
17
+ - Optimistic concurrency token → FHIR **weak** ETag at the projection boundary (see [[fhir]]).
18
+
19
+ ## Dev data
20
+ - Fixtures use synthetic data + **synthetic/clearly-marked test NDCs** — never real identifiers that could collide with the FDA NDC directory (see [[ndc]], [[testing.domain]]).
21
+
22
+ ## Related
23
+ - [[persistence]] · [[auditing.domain]] · [[data-provenance]] · [[product-lifecycle.domain]] · [[ndc]] · [[fhir]] · [[domain-driven-design.domain]] · [[testing.domain]]
@@ -0,0 +1,27 @@
1
+ # Glossary — Pharmaceutical Terms
2
+
3
+ > Ubiquitous language for the medicinal product registry. Commands: `/aw-spec-specify`, `/aw-spec-clarify`, `/aw-spec-plan`. See [[domain-driven-design.domain]] (modeling), [[terminology]] (coding), [[integration-terms]] (interop).
4
+
5
+ | Term | Definition |
6
+ |---|---|
7
+ | **MedicinalProduct** | The **Aggregate Root** — authoritative record of a registered medicine (ProductRegistry); owns ingredients, packaging, marketing authorization; aligned to IDMP *Medicinal Product* (see [[idmp]], [[domain-driven-design.domain]]). |
8
+ | **NDC** | US FDA product identifier (Labeler + Product + Package); the `NdcCode` VO; unique, format-validated (see [[ndc]]). |
9
+ | **PackageIdentifier** | Package-level NDC on a `PackagingConfiguration` (see [[ndc]]). |
10
+ | **ActiveIngredient** | **Entity**: Name, UNII, Strength, Strength Unit; **>= 1** per product (see [[domain-driven-design.domain]]). |
11
+ | **Substance / ActiveMoiety** | Chemical substance + active moiety; UNII-identified (see [[terminology]]); FHIR `Substance`. |
12
+ | **Strength** | Active-ingredient amount per dose unit — `Strength` VO (numerator/denominator `Quantity`, UCUM) (see [[terminology]]). |
13
+ | **DosageForm** | Physical form (tablet/capsule/solution); coded (SNOMED CT); `DosageForm` VO (see [[terminology]]). |
14
+ | **RouteOfAdministration** | Administration path (oral/IV/topical); coded; `RouteOfAdministration` VO (see [[terminology]]). |
15
+ | **AtcCode** | WHO ATC class code; **multiple per product**; validated against configured sets (see [[atc]]). |
16
+ | **MarketingStatus** | Regulatory marketing state (`MarketingStatus` VO); distinct from lifecycle state (see [[product-lifecycle.domain]]). |
17
+ | **MarketingAuthorization** | **Entity** — authorization granted by a regulator; IDMP-aligned (see [[idmp]]). |
18
+ | **MarketingAuthorizationHolder (MAH)** | Organization holding the authorization; FHIR `Organization`. |
19
+ | **Labeler** | Firm whose Labeler Code forms the first NDC segment (see [[ndc]]). |
20
+ | **PackagingConfiguration** | **Entity**: Package NDC, Description, Quantity, Unit of Measure; **>= 1** per product (see [[domain-driven-design.domain]]). |
21
+ | **ManufacturedItem / PharmaceuticalProduct** | IDMP concepts: manufactured dose-form item + administrable product (see [[idmp]]). |
22
+ | **ProvenanceRecord** | Provenance for externally sourced data (source, method, timestamp, agent) (see [[data-provenance]]). |
23
+ | **AuditRecord** | Append-only audit entry for create/modify/retire/identifier/classification changes (see [[auditing.domain]]). |
24
+ | **ProductVersion** | Queryable historical snapshot of product information (see [[persistence.domain]]). |
25
+
26
+ ## Related
27
+ - [[domain-driven-design.domain]] · [[idmp]] · [[ndc]] · [[atc]] · [[terminology]] · [[fhir]] · [[integration-terms]] · [[product-lifecycle.domain]] · [[data-provenance]]
@@ -0,0 +1,30 @@
1
+ # Product Lifecycle — Medicinal Product State Machine
2
+
3
+ > Technology base: [[domain-driven-design]]. NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## States
6
+ `Draft` → `Under Review` → `Approved` → `Active` → `Discontinued` / `Withdrawn`
7
+ - Lifecycle state is owned by the aggregate root and is distinct from the `MarketingStatus` value object, though the two MUST stay consistent (see [[domain-driven-design.domain]]).
8
+
9
+ ## Valid transitions (guarded; any other rejected as `lifecycle.invalid_transition`)
10
+ | From | Allowed to |
11
+ |---|---|
12
+ | Draft | Under Review |
13
+ | Under Review | Approved, Draft (returned for correction) |
14
+ | Approved | Active |
15
+ | Active | Discontinued, Withdrawn |
16
+ | Discontinued | Withdrawn |
17
+ | Withdrawn | *(terminal)* |
18
+
19
+ The allowed set MAY be configurable policy, but the default above is enforced; no transition bypasses the guard.
20
+
21
+ ## Guards
22
+ - Leaving **Draft** requires registration completeness (all required attributes, >= 1 ingredient, >= 1 packaging, valid NDC/dosage form/route/ATC) (see [[domain-driven-design.domain]], [[ndc]], [[terminology]], [[atc]]).
23
+ - Approve/activate/retire are **authorized** actions — only `RegulatoryOfficer` (see [[authorization.domain]]).
24
+ - Retirement is a **logical** state change, never a hard delete (see [[persistence.domain]], [[auditing.domain]]).
25
+
26
+ ## Events
27
+ Each transition emits a domain event (`MedicinalProductSubmittedForReview`/`Approved`/`Activated`/`Discontinued`/`Withdrawn`) and is audit-mandatory (see [[eventing.domain]], [[auditing.domain]]).
28
+
29
+ ## Related
30
+ - [[domain-driven-design.domain]] · [[authorization.domain]] · [[ndc]] · [[terminology]] · [[atc]] · [[eventing.domain]] · [[auditing.domain]] · [[persistence.domain]]
@@ -0,0 +1,19 @@
1
+ # Regulatory & Compliance Standards — Pharma
2
+
3
+ > NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ > Umbrella for the compliance requirements — mechanisms live in the linked files.
6
+
7
+ ## Posture
8
+ - Built for **regulatory compliance readiness** — auditability, traceability, data integrity, provenance designed in.
9
+ - GxP-relevant records follow **ALCOA+** (Attributable, Legible, Contemporaneous, Original, Accurate + Complete, Consistent, Enduring, Available).
10
+
11
+ ## Requirements
12
+ - **Audit trail** — immutable records for product creation, modification, retirement, identifier changes, classification changes; each carries User, Timestamp, Action, Previous Value, New Value (see [[auditing.domain]]).
13
+ - **Provenance** — capture source/method/agent/timestamp for externally sourced data (see [[data-provenance]]).
14
+ - **Versioning** — full, queryable version history of product information (see [[persistence.domain]]).
15
+ - **Traceability** — every change to identifiers (NDC), classification (ATC), ingredients, packaging, marketing status, lifecycle is traceable command → event → audit record → version snapshot (see [[eventing.domain]], [[auditing.domain]], [[persistence.domain]]).
16
+ - **Authorized actions** — registration, approval, retirement are authorized operations (see [[authorization.domain]], [[product-lifecycle.domain]]).
17
+
18
+ ## Related
19
+ - [[auditing.domain]] · [[data-provenance]] · [[persistence.domain]] · [[eventing.domain]] · [[product-lifecycle.domain]] · [[authorization.domain]] · [[domain-driven-design.domain]]
@@ -0,0 +1,32 @@
1
+ # Terminology Standards — Pharma
2
+
3
+ > NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Coded value objects
6
+ - **Coded data MUST use industry terminologies — free-text strings for coded concepts are FORBIDDEN.**
7
+ - Every code-bearing field is a **`Codeable` value object** `{ system, code, version, display }` (mirrors FHIR `CodeableConcept`/`Coding`; see [[fhir]]).
8
+
9
+ ## Standard terminologies
10
+ | Concept | Terminology | Conformance |
11
+ |---|---|---|
12
+ | Product / package identity | **NDC** | SHALL (see [[ndc]]) |
13
+ | Substances / active ingredients | **UNII** | SHOULD |
14
+ | Substance / clinical drug | **RxNorm** | SHOULD |
15
+ | Dosage form / route / classification | **SNOMED CT** | SHOULD |
16
+ | Therapeutic classification | **WHO ATC** | SHALL (see [[atc]]) |
17
+ | Units (strength, package qty) | **UCUM** | SHALL |
18
+
19
+ - **UNII** is the substance identity for IDMP `Substance` alignment (see [[idmp]]) and maps to FHIR `Substance.code`.
20
+
21
+ ## Validation
22
+ - Hard-coded coded literals FORBIDDEN outside the Terminology module's seed data.
23
+ - Never invent NDC/UNII/RxNorm/SNOMED/ATC/UCUM codes — confirm against value sets (see [[ai-rules.domain]]).
24
+ - Invalid dosage forms/routes rejected at validation time; the bound value set is configuration (see [[domain-driven-design.domain]]).
25
+
26
+ ## Terminology module
27
+ - Lookup/validation/expansion **MUST** go through a dedicated **Terminology module** (internal cache or external TS via FHIR `$expand` / `$validate-code`).
28
+ - Aggregates: `CodeSystem`, `ValueSet`, `ConceptMap` (subsets; expansions cached from RxNorm/SNOMED/FDA UNII-NDC/WHO ATC).
29
+ - Code-set versions are pinned + recorded; a terminology release (e.g. WHO ATC annual update) is a tracked, audited change (see [[auditing.domain]]).
30
+
31
+ ## Related
32
+ - [[ndc]] · [[atc]] · [[idmp]] · [[fhir]] · [[domain-driven-design.domain]] · [[testing.domain]] · [[ai-rules.domain]]
@@ -0,0 +1,19 @@
1
+ # Testing — Pharma Domain Addenda
2
+
3
+ > Technology base: [[testing]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## What MUST be tested
6
+ - **Aggregate invariants** — required attributes; >= 1 ActiveIngredient; >= 1 PackagingConfiguration; NDC uniqueness + format; invalid dosage forms/routes rejected (see [[domain-driven-design.domain]], [[ndc]], [[terminology]]).
7
+ - **Lifecycle state machine** — every allowed transition passes; every disallowed one is rejected (see [[product-lifecycle.domain]]).
8
+ - **NDC validation** — segment configurations, configurable rules, duplicate detection (see [[ndc]]).
9
+ - **Terminology binding** — ATC/UNII/SNOMED/RxNorm/UCUM validated against value sets; invented codes rejected (see [[terminology]], [[atc]]).
10
+ - **FHIR round-trip** — `domain -> FHIR -> domain` for Medication/MedicationKnowledge/Substance/Organization; FHIR validator passes (CI gate; see [[fhir]]).
11
+ - **Audit & versioning** — every audited op writes an immutable record (User/Timestamp/Action/Previous/New); historical versions remain queryable (see [[auditing.domain]], [[persistence.domain]]).
12
+ - **Provenance** — external imports attach a `ProvenanceRecord` (see [[data-provenance]]).
13
+
14
+ ## Test data & gates
15
+ - Use **synthetic/clearly-marked test NDCs and codes** — never real identifiers that could collide with the FDA NDC directory (see [[persistence.domain]], [[ndc]]); pin the terminology code-set version under test (see [[terminology]]).
16
+ - CI: FHIR validator passes for every modified resource/profile/example; HL7 outbound conformance checked against the internal corpus (see [[hl7]]).
17
+
18
+ ## Related
19
+ - [[testing]] · [[domain-driven-design.domain]] · [[product-lifecycle.domain]] · [[ndc]] · [[terminology]] · [[atc]] · [[fhir]] · [[auditing.domain]] · [[persistence.domain]] · [[data-provenance]] · [[hl7]]
@@ -0,0 +1,17 @@
1
+ # Vertical Slices — Pharma Domain Addenda
2
+
3
+ > Technology base: [[vertical-slices]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
4
+
5
+ ## Interop adapters in the slice
6
+ `{Module}/Interop/` carries the pharma external-protocol adapters:
7
+ ```
8
+ Fhir/ Medication / MedicationKnowledge / Substance / Organization projectors (see [[fhir]])
9
+ Hl7v2/ inbound parsers + outbound emitters (added when a consumer needs them) (see [[hl7]])
10
+ ```
11
+
12
+ ## Rules
13
+ - FHIR resources live in a **parallel projection layer** and **MUST NOT** replace internal `Shared` DTOs; projections, never the system of record (see [[fhir]], [[domain-driven-design.domain]]).
14
+ - Domain DTOs (`MedicinalProductDto`, `ActiveIngredientDto`, `PackagingConfigurationDto`) — no setters, required `init`, base64 `RowVersionBase64` (see [[coding-standards.domain]]).
15
+
16
+ ## Related
17
+ - [[vertical-slices]] · [[fhir]] · [[hl7]] · [[domain-driven-design.domain]] · [[coding-standards.domain]]
@@ -0,0 +1,12 @@
1
+ # Zero-Trust — Pharma Domain Addenda
2
+
3
+ > Technology base: [[zero-trust]]. Commands: `/aw-spec-plan`, `/aw-spec-implement`.
4
+
5
+ ## Rules
6
+ - All registry traffic MUST be TLS-encrypted; commercially-sensitive pre-market data in transit MUST be TLS-protected; at-rest: see [[data-classification.domain]], [[persistence.domain]].
7
+ - FHIR/REST scopes (`system/Medication.read`, `system/*.write` for authorized backends) enforced on every endpoint + propagated through the pipeline. **No patient-context (SMART) launch** — product master data (see [[authorization.domain]], [[fhir]]).
8
+ - Mutating operations **re-check change authority** at the handler edge (only `RegulatoryOfficer` approves/retires; identifier/classification changes are privileged) (see [[authorization.domain]]).
9
+ - Trace context MUST propagate across outbound **FHIR / HL7v2** calls and the CloudEvents stream (see [[eventing.domain]], [[auditing.domain]]).
10
+
11
+ ## Related
12
+ - [[zero-trust]] · [[authorization.domain]] · [[data-classification.domain]] · [[persistence.domain]] · [[auditing.domain]] · [[eventing.domain]] · [[fhir]]