aw-spec-cli 0.1.8 → 0.1.9

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 (257) hide show
  1. package/assets/.appweaver/DESIGN-FORMAT.md +200 -0
  2. package/assets/.appweaver/ORCH-DIALECT.md +156 -0
  3. package/assets/.appweaver/RULE-PARTITION.md +175 -0
  4. package/assets/.appweaver/STACK-PROFILES.md +461 -0
  5. package/assets/.appweaver/ai-rules.md +180 -0
  6. package/assets/.appweaver/domain.json +1 -0
  7. package/assets/.appweaver/extensions/.registry +19 -0
  8. package/assets/.appweaver/extensions/agent-context/README.md +57 -0
  9. package/assets/.appweaver/extensions/agent-context/agent-context-config.yml +4 -0
  10. package/assets/.appweaver/extensions/agent-context/commands/aw-spec.agent-context.update.md +26 -0
  11. package/assets/.appweaver/extensions/agent-context/extension.yml +37 -0
  12. package/assets/.appweaver/extensions/agent-context/scripts/bash/update-agent-context.sh +201 -0
  13. package/assets/.appweaver/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +237 -0
  14. package/assets/.appweaver/extensions.yml +16 -0
  15. package/assets/.appweaver/feature.json +3 -0
  16. package/assets/.appweaver/init-options.json +9 -0
  17. package/assets/.appweaver/integration.json +15 -0
  18. package/assets/.appweaver/integrations/aw-spec.manifest.json +9 -0
  19. package/assets/.appweaver/interpreter/run-skill.py +1176 -0
  20. package/assets/.appweaver/memory/constitution.md +50 -0
  21. package/assets/.appweaver/orchestrator/.smoke-out/smoke.md +6 -0
  22. package/assets/.appweaver/orchestrator/AGENT-PROFILE.md +94 -0
  23. package/assets/.appweaver/orchestrator/README.md +300 -0
  24. package/assets/.appweaver/orchestrator/adapters/claude_agent_sdk.py +74 -0
  25. package/assets/.appweaver/orchestrator/adapters/google_antigravity.py +74 -0
  26. package/assets/.appweaver/orchestrator/modules/delta-design.orch.yaml +105 -0
  27. package/assets/.appweaver/orchestrator/modules/delta-spec.orch.yaml +101 -0
  28. package/assets/.appweaver/orchestrator/modules/domain-select.orch.yaml +90 -0
  29. package/assets/.appweaver/orchestrator/modules/lane-gate.orch.yaml +126 -0
  30. package/assets/.appweaver/orchestrator/modules/tech-select.orch.yaml +123 -0
  31. package/assets/.appweaver/orchestrator/orchestrator.py +1721 -0
  32. package/assets/.appweaver/orchestrator/rev-templates/ai-rules.reference.md +40 -0
  33. package/assets/.appweaver/orchestrator/rev-templates/delta-design-template.skeleton.md +101 -0
  34. package/assets/.appweaver/orchestrator/rev-templates/design-template.skeleton.md +245 -0
  35. package/assets/.appweaver/orchestrator/rev-templates/domain-constitution.skeleton.md +63 -0
  36. package/assets/.appweaver/orchestrator/rev-templates/domain-requirements.skeleton.md +48 -0
  37. package/assets/.appweaver/orchestrator/rev-templates/domain-rule-bindings.skeleton.md +59 -0
  38. package/assets/.appweaver/orchestrator/rev-templates/domain-rule-file.skeleton.md +39 -0
  39. package/assets/.appweaver/orchestrator/rev-templates/frontend-rule-file.skeleton.md +63 -0
  40. package/assets/.appweaver/orchestrator/rev-templates/tech-rule-bindings.skeleton.md +116 -0
  41. package/assets/.appweaver/orchestrator/rev-templates/technical-constitution.skeleton.md +106 -0
  42. package/assets/.appweaver/orchestrator/rev-templates/technical-rule-file.skeleton.md +54 -0
  43. package/assets/.appweaver/orchestrator/rev-templates/ui-constitution.skeleton.md +125 -0
  44. package/assets/.appweaver/orchestrator/rev-templates/ui-delta-design-template.skeleton.md +123 -0
  45. package/assets/.appweaver/orchestrator/rev-templates/ui-design-template.skeleton.md +294 -0
  46. package/assets/.appweaver/orchestrator/workflows/_smoke.orch.yaml +160 -0
  47. package/assets/.appweaver/orchestrator/workflows/aw-spec-add-component.orch.yaml +270 -0
  48. package/assets/.appweaver/orchestrator/workflows/aw-spec-adopt.orch.yaml +934 -0
  49. package/assets/.appweaver/orchestrator/workflows/aw-spec-analyze-delta-design.orch.yaml +251 -0
  50. package/assets/.appweaver/orchestrator/workflows/aw-spec-analyze-design.orch.yaml +265 -0
  51. package/assets/.appweaver/orchestrator/workflows/aw-spec-analyze-slice.orch.yaml +437 -0
  52. package/assets/.appweaver/orchestrator/workflows/aw-spec-build.orch.yaml +197 -0
  53. package/assets/.appweaver/orchestrator/workflows/aw-spec-characterize.orch.yaml +475 -0
  54. package/assets/.appweaver/orchestrator/workflows/aw-spec-close-delta.orch.yaml +181 -0
  55. package/assets/.appweaver/orchestrator/workflows/aw-spec-constitution.orch.yaml +727 -0
  56. package/assets/.appweaver/orchestrator/workflows/aw-spec-demo.orch.yaml +100 -0
  57. package/assets/.appweaver/orchestrator/workflows/aw-spec-dependency-tree.orch.yaml +69 -0
  58. package/assets/.appweaver/orchestrator/workflows/aw-spec-deploy.orch.yaml +85 -0
  59. package/assets/.appweaver/orchestrator/workflows/aw-spec-design-ui.orch.yaml +386 -0
  60. package/assets/.appweaver/orchestrator/workflows/aw-spec-design.orch.yaml +382 -0
  61. package/assets/.appweaver/orchestrator/workflows/aw-spec-finalize-delta.orch.yaml +462 -0
  62. package/assets/.appweaver/orchestrator/workflows/aw-spec-foundation.orch.yaml +265 -0
  63. package/assets/.appweaver/orchestrator/workflows/aw-spec-implement-delta.orch.yaml +253 -0
  64. package/assets/.appweaver/orchestrator/workflows/aw-spec-implement-ui.orch.yaml +267 -0
  65. package/assets/.appweaver/orchestrator/workflows/aw-spec-implement.orch.yaml +287 -0
  66. package/assets/.appweaver/orchestrator/workflows/aw-spec-inventory.orch.yaml +238 -0
  67. package/assets/.appweaver/orchestrator/workflows/aw-spec-onboard.orch.yaml +1822 -0
  68. package/assets/.appweaver/orchestrator/workflows/aw-spec-parity.orch.yaml +293 -0
  69. package/assets/.appweaver/orchestrator/workflows/aw-spec-run.orch.yaml +194 -0
  70. package/assets/.appweaver/orchestrator/workflows/aw-spec-select-domain.orch.yaml +83 -0
  71. package/assets/.appweaver/orchestrator/workflows/aw-spec-select-feature.orch.yaml +128 -0
  72. package/assets/.appweaver/orchestrator/workflows/aw-spec-select-stack.orch.yaml +296 -0
  73. package/assets/.appweaver/orchestrator/workflows/aw-spec-specify.orch.yaml +439 -0
  74. package/assets/.appweaver/scripts/bash/aw-inventory.sh +17 -0
  75. package/assets/.appweaver/scripts/bash/aw-parity.sh +13 -0
  76. package/assets/.appweaver/scripts/bash/aw-rev-constitution.sh +13 -0
  77. package/assets/.appweaver/scripts/bash/aw-spec-actions.sh +2626 -0
  78. package/assets/.appweaver/scripts/bash/aw-xref.sh +15 -0
  79. package/assets/.appweaver/scripts/bash/common.sh +533 -0
  80. package/assets/.appweaver/scripts/powershell/aw-inventory.ps1 +17 -0
  81. package/assets/.appweaver/scripts/powershell/aw-parity.ps1 +13 -0
  82. package/assets/.appweaver/scripts/powershell/aw-rev-constitution.ps1 +13 -0
  83. package/assets/.appweaver/scripts/powershell/aw-spec-actions.ps1 +2232 -0
  84. package/assets/.appweaver/scripts/powershell/aw-xref.ps1 +15 -0
  85. package/assets/.appweaver/scripts/python/aw-component-catalog.py +121 -0
  86. package/assets/.appweaver/scripts/python/aw-inventory.py +1180 -0
  87. package/assets/.appweaver/scripts/python/aw-parity.py +380 -0
  88. package/assets/.appweaver/scripts/python/aw-rev-constitution.py +329 -0
  89. package/assets/.appweaver/scripts/python/aw-stack.py +1251 -0
  90. package/assets/.appweaver/scripts/python/aw-xref.py +1330 -0
  91. package/assets/.appweaver/scripts/python/validate_okf.py +352 -0
  92. package/assets/.appweaver/stack-profiles/angular.json +16 -0
  93. package/assets/.appweaver/stack-profiles/blazor-wasm.json +17 -0
  94. package/assets/.appweaver/stack-profiles/dotnet-webapi.json +15 -0
  95. package/assets/.appweaver/stack-profiles/go-chi.json +14 -0
  96. package/assets/.appweaver/stack-profiles/java-spring.json +16 -0
  97. package/assets/.appweaver/stack-profiles/nextjs.json +16 -0
  98. package/assets/.appweaver/stack-profiles/node-express.json +15 -0
  99. package/assets/.appweaver/stack-profiles/python-fastapi.json +16 -0
  100. package/assets/.appweaver/stack-profiles/react-vite.json +17 -0
  101. package/assets/.appweaver/stack-profiles/sveltekit.json +16 -0
  102. package/assets/.appweaver/stack-profiles/vue-vite.json +17 -0
  103. package/assets/.appweaver/stacks.json +3 -0
  104. package/assets/.appweaver/templates/constitution-domain-template.md +116 -0
  105. package/assets/.appweaver/templates/constitution-technical-template.md +108 -0
  106. package/assets/.appweaver/templates/constitution-ui-template.md +116 -0
  107. package/assets/.appweaver/templates/delta-design-template.md +69 -0
  108. package/assets/.appweaver/templates/delta-spec-template.md +63 -0
  109. package/assets/.appweaver/templates/design-template.md +383 -0
  110. package/assets/.appweaver/templates/okf-concept-template.md +114 -0
  111. package/assets/.appweaver/templates/parity-manifest-template.json +49 -0
  112. package/assets/.appweaver/templates/source-map-template.md +85 -0
  113. package/assets/.appweaver/templates/spec-template.md +309 -0
  114. package/assets/.appweaver/templates/ui-design-template.md +273 -0
  115. package/assets/foundations/dotnet/ModularMonolith/ModularMonolith.Reference.pack.txt +25248 -0
  116. package/assets/foundations/dotnet/ModularMonolith/ModularMonolith.pack.txt +5726 -0
  117. package/assets/foundations/dotnet/ModularMonolith/pack-foundation.ps1 +145 -0
  118. package/assets/foundations/dotnet/ModularMonolith/pack-foundation.sh +196 -0
  119. package/assets/foundations/dotnet/ModularMonolith/pack-reference-foundation.ps1 +157 -0
  120. package/assets/foundations/dotnet/ModularMonolith/pack-reference-foundation.sh +209 -0
  121. package/assets/foundations/dotnet/ModularMonolith/unpack-foundation.ps1 +126 -0
  122. package/assets/foundations/dotnet/ModularMonolith/unpack-foundation.sh +217 -0
  123. package/assets/foundations/dotnet/ModularMonolith/unpack-reference-foundation.ps1 +129 -0
  124. package/assets/foundations/dotnet/ModularMonolith/unpack-reference-foundation.sh +218 -0
  125. package/assets/foundations/dotnet/VerticalSlice/VerticalSlice.Reference.pack.txt +19318 -0
  126. package/assets/foundations/dotnet/VerticalSlice/VerticalSlice.pack.txt +2833 -0
  127. package/assets/foundations/dotnet/VerticalSlice/pack-foundation.ps1 +145 -0
  128. package/assets/foundations/dotnet/VerticalSlice/pack-foundation.sh +196 -0
  129. package/assets/foundations/dotnet/VerticalSlice/pack-reference-foundation.ps1 +157 -0
  130. package/assets/foundations/dotnet/VerticalSlice/pack-reference-foundation.sh +209 -0
  131. package/assets/foundations/dotnet/VerticalSlice/unpack-foundation.ps1 +126 -0
  132. package/assets/foundations/dotnet/VerticalSlice/unpack-foundation.sh +217 -0
  133. package/assets/foundations/dotnet/VerticalSlice/unpack-reference-foundation.ps1 +129 -0
  134. package/assets/foundations/dotnet/VerticalSlice/unpack-reference-foundation.sh +218 -0
  135. package/assets/foundations/dotnet/components/Email/README.md +119 -0
  136. package/assets/foundations/dotnet/components/Email/ReferenceEndpoints/SendEmailEndpoint.cs +84 -0
  137. package/assets/foundations/dotnet/components/Email/integration.md +300 -0
  138. package/assets/foundations/dotnet/components/Jobs/README.md +113 -0
  139. package/assets/foundations/dotnet/components/Jobs/integration.md +259 -0
  140. package/assets/foundations/dotnet/components/QrGenerator/README.md +85 -0
  141. package/assets/foundations/dotnet/components/QrGenerator/ReferenceEndpoints/GenerateQrEndpoint.cs +57 -0
  142. package/assets/foundations/dotnet/components/QrGenerator/integration.md +230 -0
  143. package/assets/foundations/dotnet/components/README.md +74 -0
  144. package/assets/guardrails/README.md +222 -0
  145. package/assets/guardrails/domain/healthcare/ai-rules.domain.md +34 -0
  146. package/assets/guardrails/domain/healthcare/api-versioning.domain.md +17 -0
  147. package/assets/guardrails/domain/healthcare/auditing.domain.md +97 -0
  148. package/assets/guardrails/domain/healthcare/authorization.domain.md +26 -0
  149. package/assets/guardrails/domain/healthcare/clinical-terms.md +20 -0
  150. package/assets/guardrails/domain/healthcare/coding-standards.domain.md +26 -0
  151. package/assets/guardrails/domain/healthcare/consent.md +19 -0
  152. package/assets/guardrails/domain/healthcare/cqrs.domain.md +12 -0
  153. package/assets/guardrails/domain/healthcare/data-classification.domain.md +28 -0
  154. package/assets/guardrails/domain/healthcare/dependency-policy.domain.md +11 -0
  155. package/assets/guardrails/domain/healthcare/dicom.md +15 -0
  156. package/assets/guardrails/domain/healthcare/domain-constitution.md +119 -0
  157. package/assets/guardrails/domain/healthcare/domain-driven-design.domain.md +28 -0
  158. package/assets/guardrails/domain/healthcare/eventing.domain.md +18 -0
  159. package/assets/guardrails/domain/healthcare/fhir.md +36 -0
  160. package/assets/guardrails/domain/healthcare/folder-structure.domain.md +25 -0
  161. package/assets/guardrails/domain/healthcare/hipaa.md +34 -0
  162. package/assets/guardrails/domain/healthcare/hl7.md +15 -0
  163. package/assets/guardrails/domain/healthcare/ihe-conformance.md +31 -0
  164. package/assets/guardrails/domain/healthcare/integration-terms.md +21 -0
  165. package/assets/guardrails/domain/healthcare/persistence.domain.md +20 -0
  166. package/assets/guardrails/domain/healthcare/terminology.md +30 -0
  167. package/assets/guardrails/domain/healthcare/testing.domain.md +15 -0
  168. package/assets/guardrails/domain/healthcare/ux/accessibility-standards.md +36 -0
  169. package/assets/guardrails/domain/healthcare/ux/content-design.md +32 -0
  170. package/assets/guardrails/domain/healthcare/ux/interaction-states.md +44 -0
  171. package/assets/guardrails/domain/healthcare/ux/journey-mapping.md +40 -0
  172. package/assets/guardrails/domain/healthcare/vertical-slices.domain.md +18 -0
  173. package/assets/guardrails/domain/healthcare/zero-trust.domain.md +12 -0
  174. package/assets/guardrails/domain/pharma/ai-rules.domain.md +32 -0
  175. package/assets/guardrails/domain/pharma/api-versioning.domain.md +20 -0
  176. package/assets/guardrails/domain/pharma/atc.md +22 -0
  177. package/assets/guardrails/domain/pharma/auditing.domain.md +90 -0
  178. package/assets/guardrails/domain/pharma/authorization.domain.md +25 -0
  179. package/assets/guardrails/domain/pharma/coding-standards.domain.md +28 -0
  180. package/assets/guardrails/domain/pharma/cqrs.domain.md +16 -0
  181. package/assets/guardrails/domain/pharma/data-classification.domain.md +24 -0
  182. package/assets/guardrails/domain/pharma/data-provenance.md +21 -0
  183. package/assets/guardrails/domain/pharma/dependency-policy.domain.md +11 -0
  184. package/assets/guardrails/domain/pharma/domain-constitution.md +113 -0
  185. package/assets/guardrails/domain/pharma/domain-driven-design.domain.md +36 -0
  186. package/assets/guardrails/domain/pharma/domain-requirements.sample.md +103 -0
  187. package/assets/guardrails/domain/pharma/eventing.domain.md +18 -0
  188. package/assets/guardrails/domain/pharma/fhir.md +31 -0
  189. package/assets/guardrails/domain/pharma/folder-structure.domain.md +26 -0
  190. package/assets/guardrails/domain/pharma/hl7.md +17 -0
  191. package/assets/guardrails/domain/pharma/idmp.md +26 -0
  192. package/assets/guardrails/domain/pharma/integration-terms.md +21 -0
  193. package/assets/guardrails/domain/pharma/ndc.md +28 -0
  194. package/assets/guardrails/domain/pharma/persistence.domain.md +23 -0
  195. package/assets/guardrails/domain/pharma/pharma-terms.md +27 -0
  196. package/assets/guardrails/domain/pharma/product-lifecycle.domain.md +30 -0
  197. package/assets/guardrails/domain/pharma/regulatory-compliance.md +19 -0
  198. package/assets/guardrails/domain/pharma/terminology.md +32 -0
  199. package/assets/guardrails/domain/pharma/testing.domain.md +19 -0
  200. package/assets/guardrails/domain/pharma/vertical-slices.domain.md +17 -0
  201. package/assets/guardrails/domain/pharma/zero-trust.domain.md +12 -0
  202. package/assets/guardrails/projects/dotnet-default-project/domain/domain-requirements.md +58 -0
  203. package/assets/guardrails/projects/dotnet-default-project/domain-rule-bindings.md +113 -0
  204. package/assets/guardrails/projects/dotnet-default-project/frontend/ui-requirements.md +43 -0
  205. package/assets/guardrails/projects/dotnet-default-project/service/technical-requirements.md +40 -0
  206. package/assets/guardrails/projects/dotnet-default-project/tech-rule-bindings.md +263 -0
  207. package/assets/guardrails/requirement-spec.txt +27 -0
  208. package/assets/guardrails/technology/dotnet-webapi/PACKAGING.md +184 -0
  209. package/assets/guardrails/technology/dotnet-webapi/api-versioning.md +44 -0
  210. package/assets/guardrails/technology/dotnet-webapi/auditing.md +96 -0
  211. package/assets/guardrails/technology/dotnet-webapi/authorization-matrix.md +14 -0
  212. package/assets/guardrails/technology/dotnet-webapi/authorization.md +39 -0
  213. package/assets/guardrails/technology/dotnet-webapi/clean-architecture.md +54 -0
  214. package/assets/guardrails/technology/dotnet-webapi/coding-standards.md +87 -0
  215. package/assets/guardrails/technology/dotnet-webapi/cqrs.md +63 -0
  216. package/assets/guardrails/technology/dotnet-webapi/data-classification.md +38 -0
  217. package/assets/guardrails/technology/dotnet-webapi/dependency-policy.md +40 -0
  218. package/assets/guardrails/technology/dotnet-webapi/domain-driven-design.md +91 -0
  219. package/assets/guardrails/technology/dotnet-webapi/eventing.md +57 -0
  220. package/assets/guardrails/technology/dotnet-webapi/examples/api-versioning.md +75 -0
  221. package/assets/guardrails/technology/dotnet-webapi/examples/auditing.md +84 -0
  222. package/assets/guardrails/technology/dotnet-webapi/examples/authorization.md +68 -0
  223. package/assets/guardrails/technology/dotnet-webapi/examples/clean-architecture.md +37 -0
  224. package/assets/guardrails/technology/dotnet-webapi/examples/cqrs.md +97 -0
  225. package/assets/guardrails/technology/dotnet-webapi/examples/domain-driven-design.md +141 -0
  226. package/assets/guardrails/technology/dotnet-webapi/examples/eventing.md +46 -0
  227. package/assets/guardrails/technology/dotnet-webapi/examples/persistence.md +207 -0
  228. package/assets/guardrails/technology/dotnet-webapi/examples/vertical-slices.md +151 -0
  229. package/assets/guardrails/technology/dotnet-webapi/examples/zero-trust.md +48 -0
  230. package/assets/guardrails/technology/dotnet-webapi/folder-structure.md +61 -0
  231. package/assets/guardrails/technology/dotnet-webapi/modular-monolith.md +47 -0
  232. package/assets/guardrails/technology/dotnet-webapi/persistence.md +82 -0
  233. package/assets/guardrails/technology/dotnet-webapi/technology-constitution.md +162 -0
  234. package/assets/guardrails/technology/dotnet-webapi/testing.md +55 -0
  235. package/assets/guardrails/technology/dotnet-webapi/vertical-slices.md +70 -0
  236. package/assets/guardrails/technology/dotnet-webapi/zero-trust.md +48 -0
  237. package/assets/guardrails/technology/java-spring/README.md +62 -0
  238. package/assets/guardrails/technology/nextjs/accessibility-implementation.md +56 -0
  239. package/assets/guardrails/technology/nextjs/api-client.md +56 -0
  240. package/assets/guardrails/technology/nextjs/api-integration.dotnet-webapi.md +174 -0
  241. package/assets/guardrails/technology/nextjs/api-integration.java-spring.md +203 -0
  242. package/assets/guardrails/technology/nextjs/auth-session.md +68 -0
  243. package/assets/guardrails/technology/nextjs/client-security.md +69 -0
  244. package/assets/guardrails/technology/nextjs/component-architecture.md +60 -0
  245. package/assets/guardrails/technology/nextjs/component-conventions.md +58 -0
  246. package/assets/guardrails/technology/nextjs/design-system.md +60 -0
  247. package/assets/guardrails/technology/nextjs/error-handling.md +72 -0
  248. package/assets/guardrails/technology/nextjs/forms-and-validation.md +75 -0
  249. package/assets/guardrails/technology/nextjs/frontend-testing.md +94 -0
  250. package/assets/guardrails/technology/nextjs/i18n.md +57 -0
  251. package/assets/guardrails/technology/nextjs/observability.md +67 -0
  252. package/assets/guardrails/technology/nextjs/performance-budgets.md +66 -0
  253. package/assets/guardrails/technology/nextjs/routing-navigation.md +52 -0
  254. package/assets/guardrails/technology/nextjs/state-management.md +70 -0
  255. package/assets/guardrails/technology/nextjs/ui-constitution.md +166 -0
  256. package/package.json +1 -1
  257. package/assets/docs/pharma-constitution.my-ref.md +0 -86
@@ -0,0 +1,20 @@
1
+ # API Versioning — Pharma Domain Addenda (FHIR)
2
+
3
+ > Technology base: [[api-versioning]]. Commands: `/aw-spec-specify`, `/aw-spec-gate`.
4
+
5
+ ## FHIR versioning
6
+ - R4 default; R5 **additive** under a versioned path (`/fhir/R5/...`).
7
+ - Breaking changes to the Medication / MedicationKnowledge / Substance / Organization surface require a **new version path** + a published CapabilityStatement diff (see [[fhir]]).
8
+ - FHIR list endpoints use Bundle/searchset semantics (`_count`, `_offset`/`_page`, `_total`).
9
+
10
+ ## NDC identifier stability
11
+ - `NdcCode` is a **stable identifier** — never silently rewritten. A correction is an explicit, audited identifier-change emitting `ProductIdentifierChanged`, preserved in version history (see [[ndc]], [[auditing.domain]], [[persistence.domain]], [[eventing.domain]]). ATC reclassification is likewise a versioned, audited event (see [[atc]]).
12
+
13
+ ## Concurrency at the edge
14
+ - FHIR resources honor `If-Match` via the aggregate's concurrency token → FHIR **weak** ETag at the projection boundary (see [[persistence.domain]]).
15
+
16
+ ## CapabilityStatement
17
+ - Published for FHIR (beyond generic OpenAPI); regenerates cleanly in CI; diff reviewed for breaking changes (see [[fhir]], [[coding-standards.domain]]).
18
+
19
+ ## Related
20
+ - [[api-versioning]] · [[fhir]] · [[ndc]] · [[atc]] · [[persistence.domain]] · [[eventing.domain]] · [[auditing.domain]] · [[coding-standards.domain]]
@@ -0,0 +1,22 @@
1
+ # ATC — WHO Anatomical Therapeutic Chemical Classification
2
+
3
+ > NON-NEGOTIABLE. Commands: `/aw-spec-constitution`, `/aw-spec-specify`.
4
+
5
+ ## Value Object
6
+ - ATC is the **`AtcCode` value object** — immutable, equality by value (see [[domain-driven-design.domain]]); carries code, ATC system URI, **ATC edition/version** (WHO updates annually), display.
7
+ - Free-text storage of a therapeutic class is a Forbidden Pattern.
8
+
9
+ ## Multiplicity
10
+ - **Multiple ATC codes MAY attach to one `MedicinalProduct`** (a collection of `AtcCode` VOs).
11
+ - The 7-character hierarchy (anatomical → therapeutic → pharmacological → chemical subgroup → substance) SHALL be representable; level is derivable from code length.
12
+
13
+ ## Validation
14
+ - **ATC codes SHALL be validated against configured code sets** — the bound edition is value-set data via the Terminology module (see [[terminology]]).
15
+ - An ATC code absent from the configured set is rejected; the Domain MUST NOT persist an unvalidated ATC code; never invent ATC codes (see [[ai-rules.domain]]).
16
+ - Changing a product's ATC is a **classification change** — audit-mandatory (see [[auditing.domain]]).
17
+
18
+ ## FHIR mapping
19
+ - ATC → FHIR `Medication.code` / `MedicationKnowledge` classification codings (`CodeableConcept`, ATC system URI) (see [[fhir]]).
20
+
21
+ ## Related
22
+ - [[terminology]] · [[domain-driven-design.domain]] · [[fhir]] · [[auditing.domain]] · [[ai-rules.domain]]
@@ -0,0 +1,90 @@
1
+ # Auditing — Pharma Domain Addenda
2
+
3
+ > Technology base: [[auditing]]. NON-NEGOTIABLE. Consumed by `/aw-spec-specify` (LIFTS the
4
+ > auditing requirement into the spec) and `/aw-spec-gate` (VALIDATES the spec/design realise it).
5
+ > `/aw-spec-design` and `/aw-spec-implement` never load this file — auditing reaches them through
6
+ > the spec's **declared audit level per aggregate**, and the enablement mechanics live in the
7
+ > technical base [[auditing]]. Keep this file technology-agnostic (levels + rules, **no code**).
8
+
9
+ ## Two auditing levels (framework-supported)
10
+
11
+ AppWeaver auditing has exactly **two levels**; the framework's audit interceptor populates every
12
+ audit field automatically (handlers NEVER assign audit fields):
13
+
14
+ | Level | Captures | Depth |
15
+ |---|---|---|
16
+ | **Basic** | who/when lifecycle — created / modified / (soft-)deleted, by whom and when; one audit entry per aggregate root per save (who · action · resource type · resource id · timestamp · correlation) | entity-level (Created/Updated/Deleted) — **no** before/after values |
17
+ | **Advanced** | everything Basic captures **plus field-level before/after** — each changed property's previous → new value | entity-level **+ property-level previous/new value** |
18
+
19
+ - **Advanced is REQUIRED whenever the spec asks for "previous value / new value"** — before/after
20
+ values exist ONLY at the Advanced tier.
21
+ - Child entities fold their changes into the owning aggregate root's audit entry.
22
+
23
+ > Code realisation — marker interfaces (Basic = `IAuditedObject` / `IFullAuditedObject`; Advanced =
24
+ > `+ IFieldAudited`), the one-time composition, and the audit query API — lives in the technical
25
+ > base. See [[auditing]]; `/aw-spec-design` and `/aw-spec-implement` get the HOW from there.
26
+
27
+ ## Aggregate assignment rule (how specify decides the level)
28
+
29
+ `/aw-spec-specify` MUST assign an audit level to every aggregate it models and LIFT it into the
30
+ spec as an explicit, developer-editable declaration:
31
+
32
+ - The **main aggregate** of the requirement (the aggregate root the story is about) → **Advanced**.
33
+ - **Supporting aggregates** (collaborating/referenced roots) → **Basic** by default.
34
+ - A developer MAY raise or lower a level afterwards by editing the spec declaration — the level is
35
+ a **spec** decision, never a design or implementation one. `/aw-spec-design` then follows the
36
+ declared level.
37
+
38
+ Lift it as one line the gate can check, e.g. under Constraints:
39
+
40
+ > **CN-0xx**: Auditing level — `<MainAggregate>` uses **Advanced** (field-level before/after)
41
+ > auditing; `<SupportingAggregate…>` use **Basic** (lifecycle) auditing; creation is
42
+ > audit-mandatory and append-only. — lifted from auditing.domain.
43
+
44
+ Declare the **level** — do NOT enumerate the audit record's field shape in the spec (next section).
45
+
46
+ ## Spec-required vs framework-emitted (what the gate checks)
47
+
48
+ The audit record's field shape is **framework-emitted** — the interceptor populates it; it is NOT
49
+ spec-authored content. Fields the platform always supplies:
50
+
51
+ - `resourceType`, `resourceId`, `correlationId`, `tenantId`, and the physical record layout.
52
+
53
+ Split for the gate:
54
+
55
+ - **Spec-required** (specify lifts it; the gate checks the spec + design carry it): the **audit
56
+ level per aggregate**; that creation is **audit-mandatory** and **append-only**; and the
57
+ business-meaningful capture — **User, Timestamp, Action, Previous Value, New Value** (the last
58
+ two imply Advanced).
59
+ - **Framework-emitted** (NEVER a spec/design gap — always populated by the platform): the fields
60
+ listed above. The gate MUST NOT raise a LIFT-FAILURE for them; they are guaranteed by the
61
+ framework, not authored in the spec.
62
+
63
+ ## Queryable audit (framework-provided)
64
+
65
+ The audit store is queryable out of the box (by resource identity, by user, by tenant, and by
66
+ action/time with paging — see [[auditing]]). A spec "queryable creation audit record for
67
+ compliance" success criterion is therefore satisfied by the framework's audit query API; design
68
+ references it and does **NOT** need a bespoke audit read port/model.
69
+
70
+ ## Setup (pharma)
71
+
72
+ - Auditing is **MANDATORY** for `MedicinalProduct` (**Advanced**) and its child entities
73
+ (`ActiveIngredient`, `PackagingConfiguration`, `MarketingAuthorization` — folded into the
74
+ product's audit entry).
75
+ - Audit-mandatory operations: product **creation**, **modification**, **retirement**
76
+ (Discontinued/Withdrawn), **identifier changes** (NDC / Package NDC), **classification changes**
77
+ (ATC) — plus every lifecycle transition and authorized admin action (see
78
+ [[product-lifecycle.domain]], [[ndc]], [[atc]]).
79
+
80
+ ## Immutability & retention
81
+
82
+ - Audit records (log · entity change · property change) are **append-only** — no update, no delete
83
+ (see [[domain-driven-design.domain]], [[persistence.domain]]).
84
+ - Retained per regulatory policy, queryable for the full window; exportable, MAY project to FHIR
85
+ `AuditEvent` / `Provenance` (see [[fhir]], [[data-provenance]]).
86
+ - Audit + domain events + version snapshots give end-to-end traceability (see
87
+ [[regulatory-compliance]], [[eventing.domain]]).
88
+
89
+ ## Related
90
+ - [[auditing]] · [[regulatory-compliance]] · [[data-provenance]] · [[persistence.domain]] · [[product-lifecycle.domain]] · [[ndc]] · [[atc]] · [[cqrs.domain]] · [[eventing.domain]] · [[fhir]] · [[domain-driven-design.domain]]
@@ -0,0 +1,25 @@
1
+ # Authorization — Pharma Domain Addenda
2
+
3
+ > Technology base: [[authorization]]. Commands: `/aw-spec-constitution`, `/aw-spec-specify`, `/aw-spec-gate`.
4
+
5
+ ## Roles
6
+ `SystemAdmin`, `RegulatoryOfficer`, `ProductSteward`, `TerminologyManager`, `DataManager`, `ReadOnlyConsumer`, `ExternalSystem`. Per-route matrix: `guardrails/technology/dotnet-webapi/authorization-matrix.md`.
7
+
8
+ ## Change authority
9
+ - **Only `RegulatoryOfficer`** performs guarded lifecycle transitions — approve / activate / discontinue / withdraw (see [[product-lifecycle.domain]]).
10
+ - `ProductSteward` creates/edits a `Draft` and submits for review; MUST NOT approve/activate/retire.
11
+ - **NDC and ATC changes require `RegulatoryOfficer`** authority (or `ProductSteward` + documented `RegulatoryOfficer` sign-off) (see [[ndc]], [[atc]], [[auditing.domain]]).
12
+ - `TerminologyManager` owns `CodeSystem`/`ValueSet`/`ConceptMap` + version changes (see [[terminology]]).
13
+ - `DataManager` runs external imports; each attaches a `ProvenanceRecord` (see [[data-provenance]]).
14
+
15
+ ## Scope enforcement
16
+ - FHIR endpoints scope-enforced (`system/Medication.read`, `system/Substance.read`, `system/*.write` for authorized backends). **No patient-context (SMART) scope** — product master data, not patient data (see [[fhir]], [[zero-trust.domain]]).
17
+
18
+ ## Audit-mandatory
19
+ Every product create/modify/retire, identifier change, classification change, lifecycle transition, terminology change, external import, privileged admin/role change (see [[auditing.domain]]).
20
+
21
+ ## Anonymous allowlist
22
+ - `/fhir/metadata` (CapabilityStatement) and `/health`; no write or product-data endpoint is anonymous (see [[fhir]]).
23
+
24
+ ## Related
25
+ - [[authorization]] · [[product-lifecycle.domain]] · [[ndc]] · [[atc]] · [[terminology]] · [[data-provenance]] · [[auditing.domain]] · [[data-classification.domain]] · [[fhir]] · [[zero-trust.domain]]
@@ -0,0 +1,28 @@
1
+ # Coding Standards — Pharma Domain Addenda
2
+
3
+ > Technology base: [[coding-standards]]. Commands: `/aw-spec-gate`.
4
+
5
+ ## Coded value objects
6
+ - Follow the FHIR pattern: `Codeable`, `Coding`, `Quantity`, `Ratio`, `Identifier` (see [[terminology]], [[fhir]]).
7
+ - Spec-mandated names: `NdcCode`, `ProductName`, `GenericName`, `Strength`, `DosageForm`, `RouteOfAdministration`, `AtcCode`, `MarketingStatus`, `PackageIdentifier` (see [[domain-driven-design.domain]]).
8
+ - Domain may throw `InvalidNdcException`, `InvalidLifecycleTransitionException`, `UnvalidatedCodeException` (see [[ndc]], [[product-lifecycle.domain]], [[terminology]]).
9
+
10
+ ## Forbidden patterns — extend [[coding-standards]]
11
+ - **P1.** Hard delete of a `MedicinalProduct`, version history, or `AuditRecord` — use lifecycle retirement / logical delete (see [[persistence.domain]], [[product-lifecycle.domain]]).
12
+ - **P2.** Hard-coded NDC/Labeler/ATC/UNII/RxNorm/SNOMED literals outside the Terminology seed (see [[terminology]], [[ndc]], [[atc]]).
13
+ - **P3.** Storing NDC, dosage form, route, ATC, or strength as **free text** when a value object/code applies (see [[terminology]]).
14
+ - **P4.** A second FHIR write path bypassing the aggregate (see [[fhir]]).
15
+ - **P5.** Persisting a product with an invalid NDC, dosage form, route, or unvalidated ATC code (see [[ndc]], [[atc]], [[terminology]]).
16
+ - **P6.** Mutating a contained entity (`ActiveIngredient`/`PackagingConfiguration`/`MarketingAuthorization`) outside the aggregate root (see [[domain-driven-design.domain]]).
17
+ - **P7.** Allowing an invalid lifecycle transition or removing a transition guard (see [[product-lifecycle.domain]]).
18
+ - **P8.** Exposing `Draft`/pre-market product data on the public surface (see [[data-classification.domain]]).
19
+
20
+ ## Quality gates — extend [[coding-standards]]
21
+ - **PG1.** FHIR CapabilityStatement regenerates cleanly; FHIR validator passes for every modified Medication/MedicationKnowledge/Substance/Organization resource (see [[fhir]]).
22
+ - **PG2.** No invented NDC/ATC/UNII/RxNorm/SNOMED codes — codes resolve against value sets (grep + tests; see [[terminology]]).
23
+ - **PG3.** NDC uniqueness + format + duplicate-detection tests pass (see [[ndc]]).
24
+ - **PG4.** Lifecycle state-machine tests pass — every allowed + every rejected transition (see [[product-lifecycle.domain]], [[testing.domain]]).
25
+ - **PG5.** Audit-emission tests cover create/modify/retire/identifier/classification with required fields (see [[auditing.domain]]).
26
+
27
+ ## Related
28
+ - [[coding-standards]] · [[terminology]] · [[ndc]] · [[atc]] · [[fhir]] · [[domain-driven-design.domain]] · [[product-lifecycle.domain]] · [[persistence.domain]] · [[data-classification.domain]] · [[auditing.domain]] · [[testing.domain]]
@@ -0,0 +1,16 @@
1
+ # CQRS — Pharma Domain Addenda
2
+
3
+ > Technology base: [[cqrs]]. Commands: `/aw-spec-specify`, `/aw-spec-gate`.
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-constitution`, `/aw-spec-specify`, `/aw-spec-gate`.
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-constitution`, `/aw-spec-specify`.
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-gate`.
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,113 @@
1
+ # Domain Constitution — pharma
2
+
3
+ > The industry-specific governance base for this industry corpus. It heads the set mapped under
4
+ > `## /aw-spec-constitution` in a project's `domain-rule-bindings.md` — this file, then the standard
5
+ > industry rules beside it, then the project team's `domain-requirements.md` — which
6
+ > `/appweaver constitution` ratifies into `.appweaver/memory/constitution.domain.md`.
7
+ >
8
+ > `domain-requirements.md` is supplied by the project owner and its mapping is optional: where
9
+ > the file is absent the set loads without it, and the ratified half carries the standard
10
+ > industry rules alone.
11
+
12
+ This file carries **only** what is true because the industry is pharmaceutical: project
13
+ identity, the regulatory regime, and the domain principles that extend the technology base.
14
+ Generic rules stay in the corpus's detail rule files — this file says which of them are supreme
15
+ and non-negotiable, and cites them. Keep every principle to one declarative, testable line plus
16
+ its `→` pointer; do not restate the rule file here.
17
+
18
+ Principles are numbered **XVI+**, continuing the technology base which ends at XV. Each names
19
+ the technical principle it extends. Experience principles (UX-*) belong to the lane corpus's
20
+ `ui-constitution.md` and never appear here.
21
+
22
+ ## Project Identity
23
+
24
+ - **Regulated role**: authoritative system of record for medicinal product data — product
25
+ registration, lifecycle state, and the identifiers other systems resolve against.
26
+ - **Bounded contexts**: product registration · substance & composition · regulatory submission
27
+ & lifecycle · classification & coding · interoperability.
28
+ - **Consumers**: regulatory affairs, supply-chain partners, and downstream clinical systems,
29
+ all through the published API and projections — never the database.
30
+
31
+ ## Regulatory Regime
32
+
33
+ - **GxP** — the system is validated; a change to a regulated behaviour is a documented,
34
+ approved change, not a deployment.
35
+ - **21 CFR Part 11 / EU Annex 11** — electronic records and electronic signatures.
36
+ - **IDMP (ISO 11615/11616/11238/11239/11240)** — the identification of medicinal products.
37
+ - **DSCSA / EU FMD** — traceability and serialization obligations on distribution data.
38
+ - Retention is regulator-set, exceeds the product's commercial life, and outranks any
39
+ deletion request the platform can otherwise honour.
40
+
41
+ ## Domain Principles (XVI+)
42
+
43
+ ### XVI — Product Identity is Multi-Coded and Authoritative (NON-NEGOTIABLE)
44
+ *Extends III (Domain-Driven Design).* A medicinal product carries its regulatory identifiers as
45
+ validated value objects, never as free strings; an unrecognised or unverifiable code is a
46
+ rejected write, not a stored one.
47
+ → `guardrails/domain/pharma/ndc.md`, `idmp.md`, `atc.md`
48
+
49
+ ### XVII — Lifecycle State is Explicit and Guarded (NON-NEGOTIABLE)
50
+ *Extends III (Domain-Driven Design).* Registration state lives on the aggregate as a modelled
51
+ transition with an approver and an effective date; no handler infers state, and no transition
52
+ happens without the invariant that permits it.
53
+ → `guardrails/domain/pharma/product-lifecycle.domain.md`
54
+
55
+ ### XVIII — Data Integrity is ALCOA+ (NON-NEGOTIABLE)
56
+ *Extends X (Observability).* Every regulated value is attributable, legible, contemporaneous,
57
+ original and accurate: provenance travels with the data, corrections are versioned records, and
58
+ regulated data is never destructively overwritten or hard-deleted.
59
+ → `guardrails/domain/pharma/data-provenance.md`, `auditing.domain.md`
60
+
61
+ ### XIX — Electronic Records Carry Electronic Signatures (NON-NEGOTIABLE)
62
+ *Extends IX (Security by Default).* A regulated approval is a signed record — signer identity,
63
+ meaning of the signature, and timestamp bound to the record — and the signature is verifiable
64
+ for the full retention period.
65
+ → `guardrails/domain/pharma/regulatory-compliance.md`, `auditing.domain.md`
66
+
67
+ ### XX — Interoperability Surfaces are Contract-First
68
+ *Extends XIV (Single Source of Truth).* FHIR and HL7 surfaces are published, versioned
69
+ contracts generated from the domain model; an inbound feed is adapted at the boundary and never
70
+ allowed to shape an aggregate.
71
+ → `guardrails/domain/pharma/fhir.md`, `hl7.md`
72
+
73
+ ### XXI — Regulated Data is Classified Before it is Stored (NON-NEGOTIABLE)
74
+ *Extends IX (Security by Default).* Every field carrying commercially confidential or
75
+ submission-restricted content is classified at design time; classification drives encryption,
76
+ masking, export eligibility and log redaction — no field is classified after the fact.
77
+ → `guardrails/domain/pharma/data-classification.domain.md`, `authorization.domain.md`
78
+
79
+ ### XXII — The Ubiquitous Language is the Domain Glossary
80
+ *Extends III (Domain-Driven Design).* Aggregates, endpoints and DTOs use the corpus's terms; a
81
+ term the glossary does not define is a modelling gap routed back to specify, never a locally
82
+ invented synonym.
83
+ → `guardrails/domain/pharma/terminology.md`, `pharma-terms.md`
84
+
85
+ ### XXIII — Generation Refuses Where the Domain Requires a Human
86
+ *Extends the AI operational rules.* An agent may not invent a regulatory code, a lifecycle
87
+ transition, a retention period or a signature semantic; where the rule files are silent the
88
+ generation stops and asks.
89
+ → `guardrails/domain/pharma/ai-rules.domain.md`
90
+
91
+ ## Domain Folder Additions
92
+
93
+ Additions to the technology base's mandatory structure — Interop adapters per published
94
+ surface, regulatory control fixtures, and domain test data — are governed by
95
+ `guardrails/domain/pharma/folder-structure.domain.md`. Nothing here relaxes the base layout.
96
+
97
+ ## Governance Overrides
98
+
99
+ - An amendment touching a NON-NEGOTIABLE principle above requires the Principal Engineer **and**
100
+ the Regulatory Affairs approver named for the project.
101
+ - A change to a published interoperability surface, a retention period, or a signature semantic
102
+ triggers regulatory review before merge.
103
+ - This half versions independently of `technology-constitution.md` and
104
+ `ui-constitution.md`; the base amendment procedure and SemVer policy apply unchanged.
105
+
106
+ ## Ratification Metadata
107
+
108
+ > Carried into `constitution.domain.md` at ratification; the constitution command owns the
109
+ > version bump from there.
110
+
111
+ - **Version:** 1.0.0
112
+ - **Ratified:** `<YYYY-MM-DD>`
113
+ - **Last Amended:** `<YYYY-MM-DD>`
@@ -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`.
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,103 @@
1
+ # DOMAIN REQUIREMENTS (project-specific)
2
+
3
+ > Project-specific input, **authored by the project owner** and updated independently per
4
+ > project. It is the last file in the set mapped under `## /aw-spec-constitution` in
5
+ > `domain-rule-bindings.md`, and the only one there expected to differ between two projects on this
6
+ > corpus; the standard industry rules beside it are shared. Its mapping is optional — a project
7
+ > that has not authored it yet ratifies the standard set alone.
8
+ >
9
+ > This file holds the per-project enumeration and headline profiles for the **Medicinal Product
10
+ > Registration** domain. Detailed domain *rules* are expanded in the sibling files in this folder.
11
+ >
12
+ > Replace `<SampleProjectName>` and the bounded-context list below for a new project.
13
+
14
+ =====================================================================
15
+ [DOMAIN: Bounded Contexts / Modules]
16
+ =====================================================================
17
+ - ProductRegistry — aggregate root: **MedicinalProduct**; owns ActiveIngredient,
18
+ PackagingConfiguration, MarketingAuthorization entities and the product value objects
19
+ (NdcCode, ProductName, GenericName, Strength, DosageForm, RouteOfAdministration, AtcCode,
20
+ MarketingStatus, PackageIdentifier). See [[domain-driven-design.domain]].
21
+ - Substances — aggregates: Substance, ActiveMoiety; UNII-keyed ingredient identity
22
+ (see [[terminology]]).
23
+ - Organizations — aggregates: Organization, MarketingAuthorizationHolder, Manufacturer,
24
+ Labeler. Maps to FHIR `Organization` (see [[fhir]]).
25
+ - Classification — aggregates: AtcClassification, ProductClassification; ATC code sets and
26
+ SNOMED CT classification references (see [[atc]], [[terminology]]).
27
+ - Terminology — aggregates: CodeSystem, ValueSet, ConceptMap (project-managed subsets;
28
+ expansions cached from external terminology services). Backs NDC/ATC/UNII/SNOMED/RxNorm
29
+ validation (see [[terminology]]).
30
+ - Lifecycle — the MedicinalProduct state machine (Draft → Under Review → Approved → Active →
31
+ Discontinued → Withdrawn) and its transition guards (see [[product-lifecycle.domain]]).
32
+ - Interoperability — aggregates: FhirProjection, IntegrationEndpoint; FHIR Medication /
33
+ MedicationKnowledge / Substance / Organization projections and HL7 readiness
34
+ (see [[fhir]], [[hl7]]).
35
+ - Provenance — aggregate: ProvenanceRecord for externally sourced product data
36
+ (see [[data-provenance]]).
37
+ - Auditing — aggregate: AuditRecord (append-only). Captures creation, modification,
38
+ retirement, identifier and classification changes (see [[auditing.domain]]).
39
+
40
+ =====================================================================
41
+ [DOMAIN: subsection pointers]
42
+ =====================================================================
43
+ [DOMAIN: Standards — NDC] -> guardrails/domain/pharma/ndc.md
44
+ [DOMAIN: Standards — ISO IDMP] -> guardrails/domain/pharma/idmp.md
45
+ [DOMAIN: Standards — ATC] -> guardrails/domain/pharma/atc.md
46
+ [DOMAIN: Standards — Terminology] -> guardrails/domain/pharma/terminology.md
47
+ [DOMAIN: Interop — FHIR] -> guardrails/domain/pharma/fhir.md
48
+ [DOMAIN: Interop — HL7] -> guardrails/domain/pharma/hl7.md
49
+ [DOMAIN: Aggregates and Business Invariants] -> guardrails/domain/pharma/domain-driven-design.domain.md
50
+ [DOMAIN: Product Lifecycle] -> guardrails/domain/pharma/product-lifecycle.domain.md
51
+ [DOMAIN: Regulatory / Compliance] -> guardrails/domain/pharma/regulatory-compliance.md
52
+ [DOMAIN: Data Provenance] -> guardrails/domain/pharma/data-provenance.md
53
+ [DOMAIN: Audit Profile] -> guardrails/domain/pharma/auditing.domain.md
54
+ [DOMAIN: Persistence / Versioning Profile] -> guardrails/domain/pharma/persistence.domain.md
55
+ [DOMAIN: Eventing Profile] -> guardrails/domain/pharma/eventing.domain.md
56
+ [DOMAIN: Testing Profile] -> guardrails/domain/pharma/testing.domain.md
57
+ [DOMAIN: Security Profile] -> guardrails/domain/pharma/authorization.domain.md, guardrails/domain/pharma/data-classification.domain.md, guardrails/domain/pharma/zero-trust.domain.md
58
+ [DOMAIN: Coding Standards Profile] -> guardrails/domain/pharma/coding-standards.domain.md
59
+ [DOMAIN: CQRS / Vertical Slices Profile] -> guardrails/domain/pharma/cqrs.domain.md, guardrails/domain/pharma/vertical-slices.domain.md
60
+ [DOMAIN: Folder Structure Profile] -> guardrails/domain/pharma/folder-structure.domain.md
61
+ [DOMAIN: API Versioning Profile] -> guardrails/domain/pharma/api-versioning.domain.md
62
+ [DOMAIN: Dependency Policy Profile] -> guardrails/domain/pharma/dependency-policy.domain.md
63
+ [DOMAIN: Integration Terms] -> guardrails/domain/pharma/integration-terms.md
64
+ [DOMAIN: AI Policy Addenda] -> guardrails/domain/pharma/ai-rules.domain.md
65
+ [DOMAIN: Ubiquitous Language] -> guardrails/domain/pharma/pharma-terms.md
66
+ [DOMAIN: Platform Topology] -> below
67
+
68
+ =====================================================================
69
+ [DOMAIN: Platform Topology]
70
+ =====================================================================
71
+ - Target runtime: Kubernetes (AKS, EKS, or on-prem). Single-region by default; multi-region
72
+ active/passive for DR.
73
+ - External dependencies (Aspire resources): PostgreSQL (primary product registry), Redis
74
+ (cache for terminology expansions + read models), a message broker (Azure Service Bus,
75
+ AWS SQS/SNS, or RabbitMQ) for CloudEvents, an OTel collector, the configured IdP, an external
76
+ Terminology Service (NDC/RxNorm/SNOMED/UNII/ATC value-set expansion, optional), a FHIR
77
+ validator container, and an object store (S3/Blob) for imported source documents / labels.
78
+ - Scale targets: P95 read latency < 200 ms at 200 RPS per module; FHIR search P95 < 500 ms.
79
+ - Disaster recovery: RPO <= 15 minutes, RTO <= 4 hours; daily encrypted backups with 35-day
80
+ retention plus monthly archive. Product registry and audit history are retention-protected
81
+ (see [[persistence.domain]], [[auditing.domain]]).
82
+
83
+ =====================================================================
84
+ [DOMAIN: Governance Overrides]
85
+ =====================================================================
86
+ - Principal Engineers (approvers): TBD — fill at ratification.
87
+ - Regulatory / Compliance Officer (mandatory approver for any identifier, classification, or
88
+ lifecycle-rule change): TBD.
89
+ - Domain Owners (per module): TBD — assign one regulatory and one technical owner per bounded
90
+ context.
91
+ - Quarterly review cadence: first business week of each quarter; an additional review after
92
+ every relevant regulatory or terminology-release update (e.g. WHO ATC annual update, FDA NDC
93
+ directory changes).
94
+ - Exception process: a time-boxed waiver via a Waiver Request issue, approved by a Principal
95
+ Engineer + the Compliance Officer, with a mandatory expiry <= 90 days and a remediation plan
96
+ recorded in the issue.
97
+
98
+ ## Related
99
+
100
+ - [[domain-driven-design.domain]] · [[product-lifecycle.domain]] · [[ndc]] · [[idmp]] ·
101
+ [[atc]] · [[terminology]] · [[fhir]] · [[hl7]] · [[regulatory-compliance]] ·
102
+ [[data-provenance]] · [[auditing.domain]] · [[persistence.domain]] · [[ai-rules.domain]] ·
103
+ [[pharma-terms]]
@@ -0,0 +1,18 @@
1
+ # Eventing — Pharma Domain Addenda
2
+
3
+ > Technology base: [[eventing]]. Commands: `/aw-spec-specify`, `/aw-spec-gate`.
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-constitution`, `/aw-spec-specify`.
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,26 @@
1
+ # Folder Structure — Pharma Domain Addenda
2
+
3
+ > Technology base: [[folder-structure]]. Commands: `/aw-spec-gate`. 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
+ - Paths above are **inside the project being built**, not inside the rule corpus — the `docs/` lines
21
+ are artefacts the project produces, and the corpus's own rule files never move there.
22
+ - `Interop/` adapters translate to/from internal commands + projections (see [[vertical-slices.domain]]).
23
+ - Coded VOs follow the FHIR pattern (see [[terminology]], [[coding-standards.domain]]); version history + audit store are retention-protected (see [[persistence.domain]], [[auditing.domain]]).
24
+
25
+ ## Related
26
+ - [[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-constitution`, `/aw-spec-specify`.
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]]