aw-spec-cli 0.1.5 → 0.1.7
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.
- package/assets/.agents/agent.json +1 -1
- package/assets/.agents/skills/{aw-spec-orch → appweaver}/SKILL.md +10 -10
- package/assets/.agents/skills/{aw-spec-orch-demo → appweaver-demo}/SKILL.md +9 -9
- package/assets/.claude/agent.json +1 -1
- package/assets/.claude/skills/{aw-spec-orch → appweaver}/SKILL.md +10 -10
- package/assets/.claude/skills/{aw-spec-orch-demo → appweaver-demo}/SKILL.md +9 -9
- package/assets/.kilocode/agent.json +1 -1
- package/assets/.kilocode/workflows/{aw-spec-orch-demo.md → appweaver-demo.md} +9 -9
- package/assets/.kilocode/workflows/{aw-spec-orch.md → appweaver.md} +10 -10
- package/assets/docs/pharma-constitution.my-ref.md +86 -0
- package/dist/utils/paths.js +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/package.json +1 -1
- package/assets/.aw-spec/DESIGN-FORMAT.md +0 -151
- package/assets/.aw-spec/ORCH-DIALECT.md +0 -156
- package/assets/.aw-spec/RULE-PARTITION.md +0 -126
- package/assets/.aw-spec/domain.json +0 -3
- package/assets/.aw-spec/extensions/.registry +0 -19
- package/assets/.aw-spec/extensions/agent-context/README.md +0 -57
- package/assets/.aw-spec/extensions/agent-context/agent-context-config.yml +0 -4
- package/assets/.aw-spec/extensions/agent-context/commands/aw-spec.agent-context.update.md +0 -26
- package/assets/.aw-spec/extensions/agent-context/extension.yml +0 -37
- package/assets/.aw-spec/extensions/agent-context/scripts/bash/update-agent-context.sh +0 -201
- package/assets/.aw-spec/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +0 -237
- package/assets/.aw-spec/extensions.yml +0 -16
- package/assets/.aw-spec/feature.json +0 -3
- package/assets/.aw-spec/init-options.json +0 -9
- package/assets/.aw-spec/integration.json +0 -15
- package/assets/.aw-spec/integrations/aw-spec.manifest.json +0 -9
- package/assets/.aw-spec/interpreter/run-skill.py +0 -1158
- package/assets/.aw-spec/memory/constitution.md +0 -50
- package/assets/.aw-spec/orchestrator/AGENT-PROFILE.md +0 -94
- package/assets/.aw-spec/orchestrator/README.md +0 -300
- package/assets/.aw-spec/orchestrator/adapters/claude_agent_sdk.py +0 -74
- package/assets/.aw-spec/orchestrator/adapters/google_antigravity.py +0 -74
- package/assets/.aw-spec/orchestrator/modules/delta-design.orch.yaml +0 -105
- package/assets/.aw-spec/orchestrator/modules/delta-spec.orch.yaml +0 -79
- package/assets/.aw-spec/orchestrator/modules/domain-select.orch.yaml +0 -81
- package/assets/.aw-spec/orchestrator/modules/tech-select.orch.yaml +0 -75
- package/assets/.aw-spec/orchestrator/orchestrator.py +0 -1721
- package/assets/.aw-spec/orchestrator/rev-templates/ai-rules.reference.md +0 -40
- package/assets/.aw-spec/orchestrator/rev-templates/comandrulemap.skeleton.md +0 -59
- package/assets/.aw-spec/orchestrator/rev-templates/commandtechrulemap.skeleton.md +0 -97
- package/assets/.aw-spec/orchestrator/rev-templates/domain-constitution.skeleton.md +0 -61
- package/assets/.aw-spec/orchestrator/rev-templates/domain-requirements.skeleton.md +0 -48
- package/assets/.aw-spec/orchestrator/rev-templates/domain-rule-file.skeleton.md +0 -39
- package/assets/.aw-spec/orchestrator/rev-templates/technical-constitution.skeleton.md +0 -106
- package/assets/.aw-spec/orchestrator/rev-templates/technical-rule-file.skeleton.md +0 -54
- package/assets/.aw-spec/orchestrator/workflows/_smoke.orch.yaml +0 -160
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-add-component.orch.yaml +0 -244
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-adopt.orch.yaml +0 -775
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-delta-design.orch.yaml +0 -248
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-design.orch.yaml +0 -261
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-slice.orch.yaml +0 -425
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-build.orch.yaml +0 -188
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-characterize.orch.yaml +0 -474
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-close-delta.orch.yaml +0 -181
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-constitution.orch.yaml +0 -284
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-demo.orch.yaml +0 -103
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-dependency-tree.orch.yaml +0 -69
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-deploy.orch.yaml +0 -85
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-design.orch.yaml +0 -382
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-finalize-delta.orch.yaml +0 -382
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-foundation.orch.yaml +0 -246
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-implement-delta.orch.yaml +0 -231
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-implement.orch.yaml +0 -258
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-inventory.orch.yaml +0 -236
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-onboard.orch.yaml +0 -949
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-parity.orch.yaml +0 -293
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-run.orch.yaml +0 -177
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-select-domain.orch.yaml +0 -79
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-select-feature.orch.yaml +0 -128
- package/assets/.aw-spec/orchestrator/workflows/aw-spec-specify.orch.yaml +0 -412
- package/assets/.aw-spec/scripts/bash/aw-inventory.sh +0 -14
- package/assets/.aw-spec/scripts/bash/aw-parity.sh +0 -13
- package/assets/.aw-spec/scripts/bash/aw-rev-constitution.sh +0 -13
- package/assets/.aw-spec/scripts/bash/aw-spec-actions.sh +0 -1899
- package/assets/.aw-spec/scripts/bash/aw-xref.sh +0 -15
- package/assets/.aw-spec/scripts/bash/common.sh +0 -533
- package/assets/.aw-spec/scripts/powershell/aw-inventory.ps1 +0 -14
- package/assets/.aw-spec/scripts/powershell/aw-parity.ps1 +0 -13
- package/assets/.aw-spec/scripts/powershell/aw-rev-constitution.ps1 +0 -13
- package/assets/.aw-spec/scripts/powershell/aw-spec-actions.ps1 +0 -1563
- package/assets/.aw-spec/scripts/powershell/aw-xref.ps1 +0 -15
- package/assets/.aw-spec/scripts/python/aw-inventory.py +0 -683
- package/assets/.aw-spec/scripts/python/aw-parity.py +0 -380
- package/assets/.aw-spec/scripts/python/aw-rev-constitution.py +0 -312
- package/assets/.aw-spec/scripts/python/aw-xref.py +0 -1330
- package/assets/.aw-spec/scripts/python/validate_okf.py +0 -349
- package/assets/.aw-spec/templates/constitution-domain-template.md +0 -75
- package/assets/.aw-spec/templates/constitution-technical-template.md +0 -70
- package/assets/.aw-spec/templates/delta-design-template.md +0 -69
- package/assets/.aw-spec/templates/delta-spec-template.md +0 -60
- package/assets/.aw-spec/templates/design-template.md +0 -383
- package/assets/.aw-spec/templates/okf-concept-template.md +0 -103
- package/assets/.aw-spec/templates/parity-manifest-template.json +0 -49
- package/assets/.aw-spec/templates/source-map-template.md +0 -85
- package/assets/.aw-spec/templates/spec-template.md +0 -252
- package/assets/docs/ModularMonolith/ModularMonolith.Reference.pack.txt +0 -25248
- package/assets/docs/ModularMonolith/ModularMonolith.pack.txt +0 -5726
- package/assets/docs/ModularMonolith/pack-foundation.ps1 +0 -145
- package/assets/docs/ModularMonolith/pack-foundation.sh +0 -196
- package/assets/docs/ModularMonolith/pack-reference-foundation.ps1 +0 -157
- package/assets/docs/ModularMonolith/pack-reference-foundation.sh +0 -209
- package/assets/docs/ModularMonolith/unpack-foundation.ps1 +0 -126
- package/assets/docs/ModularMonolith/unpack-foundation.sh +0 -217
- package/assets/docs/ModularMonolith/unpack-reference-foundation.ps1 +0 -129
- package/assets/docs/ModularMonolith/unpack-reference-foundation.sh +0 -218
- package/assets/docs/README.md +0 -106
- package/assets/docs/VerticalSlice/PACKAGING.md +0 -185
- package/assets/docs/VerticalSlice/VerticalSlice.Reference.pack.txt +0 -19318
- package/assets/docs/VerticalSlice/VerticalSlice.pack.txt +0 -2833
- package/assets/docs/VerticalSlice/pack-foundation.ps1 +0 -145
- package/assets/docs/VerticalSlice/pack-foundation.sh +0 -196
- package/assets/docs/VerticalSlice/pack-reference-foundation.ps1 +0 -157
- package/assets/docs/VerticalSlice/pack-reference-foundation.sh +0 -209
- package/assets/docs/VerticalSlice/unpack-foundation.ps1 +0 -126
- package/assets/docs/VerticalSlice/unpack-foundation.sh +0 -217
- package/assets/docs/VerticalSlice/unpack-reference-foundation.ps1 +0 -129
- package/assets/docs/VerticalSlice/unpack-reference-foundation.sh +0 -218
- package/assets/docs/architecture/clean-architecture.md +0 -71
- package/assets/docs/architecture/cqrs.md +0 -141
- package/assets/docs/architecture/eventing.md +0 -83
- package/assets/docs/architecture/folder-structure.md +0 -61
- package/assets/docs/architecture/modular-monolith.md +0 -47
- package/assets/docs/architecture/persistence.md +0 -269
- package/assets/docs/architecture/testing.md +0 -55
- package/assets/docs/architecture/vertical-slices.md +0 -201
- package/assets/docs/components/Email/README.md +0 -119
- package/assets/docs/components/Email/ReferenceEndpoints/SendEmailEndpoint.cs +0 -84
- package/assets/docs/components/Email/integration.md +0 -300
- package/assets/docs/components/Jobs/README.md +0 -113
- package/assets/docs/components/Jobs/integration.md +0 -259
- package/assets/docs/components/QrGenerator/README.md +0 -85
- package/assets/docs/components/QrGenerator/ReferenceEndpoints/GenerateQrEndpoint.cs +0 -57
- package/assets/docs/components/QrGenerator/integration.md +0 -230
- package/assets/docs/components/README.md +0 -74
- package/assets/docs/domain/domain-driven-design.md +0 -212
- package/assets/docs/domainspecs/healthcare/ai-rules.domain.md +0 -34
- package/assets/docs/domainspecs/healthcare/api-versioning.domain.md +0 -17
- package/assets/docs/domainspecs/healthcare/auditing.domain.md +0 -97
- package/assets/docs/domainspecs/healthcare/authorization.domain.md +0 -26
- package/assets/docs/domainspecs/healthcare/clinical-terms.md +0 -20
- package/assets/docs/domainspecs/healthcare/coding-standards.domain.md +0 -26
- package/assets/docs/domainspecs/healthcare/comandrulemap.md +0 -100
- package/assets/docs/domainspecs/healthcare/commandtechrulemap.md +0 -119
- package/assets/docs/domainspecs/healthcare/consent.md +0 -19
- package/assets/docs/domainspecs/healthcare/cqrs.domain.md +0 -12
- package/assets/docs/domainspecs/healthcare/data-classification.domain.md +0 -28
- package/assets/docs/domainspecs/healthcare/dependency-policy.domain.md +0 -11
- package/assets/docs/domainspecs/healthcare/dicom.md +0 -15
- package/assets/docs/domainspecs/healthcare/domain-driven-design.domain.md +0 -28
- package/assets/docs/domainspecs/healthcare/domain-requirements.md +0 -55
- package/assets/docs/domainspecs/healthcare/eventing.domain.md +0 -18
- package/assets/docs/domainspecs/healthcare/fhir.md +0 -36
- package/assets/docs/domainspecs/healthcare/folder-structure.domain.md +0 -23
- package/assets/docs/domainspecs/healthcare/hipaa.md +0 -34
- package/assets/docs/domainspecs/healthcare/hl7.md +0 -15
- package/assets/docs/domainspecs/healthcare/integration-terms.md +0 -21
- package/assets/docs/domainspecs/healthcare/persistence.domain.md +0 -20
- package/assets/docs/domainspecs/healthcare/terminology.md +0 -30
- package/assets/docs/domainspecs/healthcare/testing.domain.md +0 -15
- package/assets/docs/domainspecs/healthcare/vertical-slices.domain.md +0 -18
- package/assets/docs/domainspecs/healthcare/zero-trust.domain.md +0 -12
- package/assets/docs/domainspecs/pharma/ai-rules.domain.md +0 -32
- package/assets/docs/domainspecs/pharma/api-versioning.domain.md +0 -20
- package/assets/docs/domainspecs/pharma/atc.md +0 -22
- package/assets/docs/domainspecs/pharma/auditing.domain.md +0 -90
- package/assets/docs/domainspecs/pharma/authorization.domain.md +0 -25
- package/assets/docs/domainspecs/pharma/coding-standards.domain.md +0 -28
- package/assets/docs/domainspecs/pharma/comandrulemap.md +0 -108
- package/assets/docs/domainspecs/pharma/commandtechrulemap.md +0 -119
- package/assets/docs/domainspecs/pharma/cqrs.domain.md +0 -16
- package/assets/docs/domainspecs/pharma/data-classification.domain.md +0 -24
- package/assets/docs/domainspecs/pharma/data-provenance.md +0 -21
- package/assets/docs/domainspecs/pharma/dependency-policy.domain.md +0 -11
- package/assets/docs/domainspecs/pharma/domain-driven-design.domain.md +0 -36
- package/assets/docs/domainspecs/pharma/domain-requirements.md +0 -99
- package/assets/docs/domainspecs/pharma/eventing.domain.md +0 -18
- package/assets/docs/domainspecs/pharma/fhir.md +0 -31
- package/assets/docs/domainspecs/pharma/folder-structure.domain.md +0 -24
- package/assets/docs/domainspecs/pharma/hl7.md +0 -17
- package/assets/docs/domainspecs/pharma/idmp.md +0 -26
- package/assets/docs/domainspecs/pharma/integration-terms.md +0 -21
- package/assets/docs/domainspecs/pharma/ndc.md +0 -28
- package/assets/docs/domainspecs/pharma/persistence.domain.md +0 -23
- package/assets/docs/domainspecs/pharma/pharma-terms.md +0 -27
- package/assets/docs/domainspecs/pharma/product-lifecycle.domain.md +0 -30
- package/assets/docs/domainspecs/pharma/regulatory-compliance.md +0 -19
- package/assets/docs/domainspecs/pharma/terminology.md +0 -32
- package/assets/docs/domainspecs/pharma/testing.domain.md +0 -19
- package/assets/docs/domainspecs/pharma/vertical-slices.domain.md +0 -17
- package/assets/docs/domainspecs/pharma/zero-trust.domain.md +0 -12
- package/assets/docs/glossary/ai-rules.md +0 -59
- package/assets/docs/governance/api-versioning.md +0 -99
- package/assets/docs/governance/coding-standards.md +0 -87
- package/assets/docs/governance/dependency-policy.md +0 -40
- package/assets/docs/interop/ihe-conformance.md +0 -31
- package/assets/docs/requirement-spec.txt +0 -27
- package/assets/docs/security/auditing.md +0 -160
- package/assets/docs/security/authorization-matrix.md +0 -14
- package/assets/docs/security/authorization.md +0 -87
- package/assets/docs/security/data-classification.md +0 -38
- package/assets/docs/security/zero-trust.md +0 -76
- package/assets/docs/technology-constitution.md +0 -172
|
@@ -1,31 +0,0 @@
|
|
|
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]]
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
- `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]]
|
|
@@ -1,17 +0,0 @@
|
|
|
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]]
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# ISO IDMP — Identification of Medicinal Products
|
|
2
|
-
|
|
3
|
-
> NON-NEGOTIABLE. Commands: `/aw-spec-constitution`, `/aw-spec-specify`.
|
|
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]]
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Glossary — Integration Terms (Pharma)
|
|
2
|
-
|
|
3
|
-
> Ubiquitous language for pharma interoperability standards + identifiers. Commands: `/aw-spec-specify`. 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]]
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# NDC — National Drug Code Standards
|
|
2
|
-
|
|
3
|
-
> NON-NEGOTIABLE. Commands: `/aw-spec-constitution`, `/aw-spec-specify`.
|
|
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]]
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Persistence — Pharma Domain Addenda
|
|
2
|
-
|
|
3
|
-
> Technology base: [[persistence]]. NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-gate`.
|
|
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]]
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Glossary — Pharmaceutical Terms
|
|
2
|
-
|
|
3
|
-
> Ubiquitous language for the medicinal product registry. Commands: `/aw-spec-constitution`, `/aw-spec-specify`. 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]]
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Product Lifecycle — Medicinal Product State Machine
|
|
2
|
-
|
|
3
|
-
> Technology base: [[domain-driven-design]]. NON-NEGOTIABLE. Commands: `/aw-spec-constitution`, `/aw-spec-specify`.
|
|
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]]
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Regulatory & Compliance Standards — Pharma
|
|
2
|
-
|
|
3
|
-
> NON-NEGOTIABLE. Commands: `/aw-spec-constitution`, `/aw-spec-specify`.
|
|
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]]
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Terminology Standards — Pharma
|
|
2
|
-
|
|
3
|
-
> NON-NEGOTIABLE. Commands: `/aw-spec-constitution`, `/aw-spec-specify`.
|
|
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]]
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Testing — Pharma Domain Addenda
|
|
2
|
-
|
|
3
|
-
> Technology base: [[testing]]. Commands: `/aw-spec-gate`.
|
|
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]]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Vertical Slices — Pharma Domain Addenda
|
|
2
|
-
|
|
3
|
-
> Technology base: [[vertical-slices]]. Commands: `/aw-spec-specify`, `/aw-spec-gate`.
|
|
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]]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Zero-Trust — Pharma Domain Addenda
|
|
2
|
-
|
|
3
|
-
> Technology base: [[zero-trust]]. Commands: `/aw-spec-constitution`, `/aw-spec-specify`, `/aw-spec-gate`.
|
|
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]]
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# AI Operational Rules
|
|
2
|
-
|
|
3
|
-
> Pure technology (domain-agnostic) — domain AI rules in [[ai-rules.domain]]. Applies to all AI agents (Claude Code, Augment, Copilot, etc.). Commands: **ALL**.
|
|
4
|
-
|
|
5
|
-
AI agents MUST treat the constitution as **ground truth**, overriding pre-trained habits and
|
|
6
|
-
any contradictory documentation found inside the repo.
|
|
7
|
-
|
|
8
|
-
## Context loading rules / retrieval expectations
|
|
9
|
-
|
|
10
|
-
- Before generating or editing code, **inspect the relevant vertical slice**
|
|
11
|
-
(`<Module>/Features/<Feature>/`) and the aggregate it mutates (see [[vertical-slices]]).
|
|
12
|
-
- **Confirm symbol signatures via repository search** rather than inferring from generic
|
|
13
|
-
framework knowledge — `IRepository<T>` here is AppWeaver's, not a generic one
|
|
14
|
-
(see [[cqrs]], [[persistence]]).
|
|
15
|
-
|
|
16
|
-
## AI generation rules
|
|
17
|
-
|
|
18
|
-
- New features are generated as **complete vertical slices**: Command/Query + Handler +
|
|
19
|
-
Endpoint + Validator + (when applicable) Specification + DTO + mapping extension + Unit test
|
|
20
|
-
+ Integration test.
|
|
21
|
-
- Do **NOT** introduce new top-level dependencies (see [[dependency-policy]]).
|
|
22
|
-
- Do **NOT** create speculative abstractions (single-implementation interfaces, generic
|
|
23
|
-
wrappers around existing framework types) — YAGNI.
|
|
24
|
-
- Generated tests follow Test-First Engineering and **MUST fail before** the production change
|
|
25
|
-
is in place (see [[testing]]).
|
|
26
|
-
|
|
27
|
-
## Output formatting conventions
|
|
28
|
-
|
|
29
|
-
- Do **NOT** write inline rationale comments explaining why a pattern was chosen — the
|
|
30
|
-
constitution is the rationale (see [[coding-standards]]).
|
|
31
|
-
|
|
32
|
-
## Migration generation policy
|
|
33
|
-
|
|
34
|
-
- AI MAY scaffold EF Core migrations but **MUST NOT run them** against shared environments.
|
|
35
|
-
Production migrations require DBA sign-off and an SRE-executed rollout (see [[persistence]]).
|
|
36
|
-
|
|
37
|
-
## Operating envelope
|
|
38
|
-
|
|
39
|
-
- Edits limited to the scope explicitly requested. Drive-by refactors of unrelated files are
|
|
40
|
-
forbidden.
|
|
41
|
-
- File creation constrained to the Mandatory Folder Structure; new folders require an amendment.
|
|
42
|
-
- All AI-authored commits are self-contained: source change + tests + affected
|
|
43
|
-
DTOs/mappings + migration (when schema changes).
|
|
44
|
-
|
|
45
|
-
## Refusal conditions (generic) — refuse and ask for clarification when a request would:
|
|
46
|
-
|
|
47
|
-
- Violate a NON-NEGOTIABLE principle.
|
|
48
|
-
- Introduce a Forbidden Pattern (see [[coding-standards]]).
|
|
49
|
-
- Require a cross-aggregate transaction (see [[cqrs]], [[domain-driven-design]]).
|
|
50
|
-
- Embed a secret, connection string, or production hostname in code or config.
|
|
51
|
-
- Disable a soft-delete filter, tenancy filter, audit interceptor, scope check, or auth policy
|
|
52
|
-
globally.
|
|
53
|
-
|
|
54
|
-
> Domain-specific generation rules, data masking, terminology codes, and refusal conditions are in [[ai-rules.domain]].
|
|
55
|
-
|
|
56
|
-
## Related
|
|
57
|
-
|
|
58
|
-
- [[coding-standards]] · [[dependency-policy]] · [[testing]] · [[persistence]] ·
|
|
59
|
-
[[vertical-slices]] · [[ai-rules.domain]]
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# API Versioning Policy
|
|
2
|
-
|
|
3
|
-
> Pure technology (domain-agnostic) — domain (e.g. FHIR) versioning in [[api-versioning.domain]]. Commands: `/aw-spec-design`.
|
|
4
|
-
|
|
5
|
-
## REST versioning
|
|
6
|
-
|
|
7
|
-
- Internal REST (FastEndpoints) serves first-party apps and operational tooling.
|
|
8
|
-
- List endpoints accept `pageNumber` (1-based) + `pageSize` and return `PagedResult<TDto>`
|
|
9
|
-
(see [[vertical-slices]]).
|
|
10
|
-
- Breaking changes to internal REST require a **versioned route prefix** (`v2/...`).
|
|
11
|
-
- Endpoints MUST NOT swallow exceptions; the central exception handler owns the contract.
|
|
12
|
-
|
|
13
|
-
## ETag / concurrency at the edge
|
|
14
|
-
|
|
15
|
-
- The server sets the ETag header on every create/read/update via `SetETagFromBase64(...)`.
|
|
16
|
-
- Update/Delete extract `If-Match` via `GetIfMatchBase64Token()`; mismatch -> `409
|
|
17
|
-
concurrency.conflict`. ETag tokens are strong; `W/` weak prefixes stripped on read.
|
|
18
|
-
See [[persistence]].
|
|
19
|
-
|
|
20
|
-
## Machine-readable schemas
|
|
21
|
-
|
|
22
|
-
- The service publishes versioned, machine-readable schemas:
|
|
23
|
-
- **OpenAPI** for REST,
|
|
24
|
-
- **AsyncAPI** for events (see [[eventing]]).
|
|
25
|
-
- All schemas regenerate cleanly in CI; diffs are reviewed for breaking changes
|
|
26
|
-
(see [[coding-standards]]).
|
|
27
|
-
- (FHIR CapabilityStatement — see [[api-versioning.domain]].)
|
|
28
|
-
|
|
29
|
-
## Deprecation lifecycle & sunset policy
|
|
30
|
-
|
|
31
|
-
- **Breaking changes are MAJOR version bumps** (per the constitution's governance SemVer).
|
|
32
|
-
- A superseded REST version remains available through a documented deprecation window before
|
|
33
|
-
sunset; the deprecation and sunset are announced via the published schema diffs and the
|
|
34
|
-
governance amendment process.
|
|
35
|
-
|
|
36
|
-
## Canonical example (agent reference — `<SampleProjectName>` sample)
|
|
37
|
-
|
|
38
|
-
ETag round-trip: the endpoint reads `If-Match` on update and sets the `ETag` on success;
|
|
39
|
-
the handler compares the token and translates an EF conflict to `409 concurrency.conflict`:
|
|
40
|
-
|
|
41
|
-
```csharp
|
|
42
|
-
// Endpoint (PUT /projects/{id:guid})
|
|
43
|
-
var id = Route<Guid>("id");
|
|
44
|
-
var token = HttpContext.Request.GetIfMatchBase64Token(); // extract If-Match
|
|
45
|
-
|
|
46
|
-
var result = await _mediator.Send(new UpdateProjectCommand(
|
|
47
|
-
id, req.Name, req.Description, req.StartDate, req.EndDate, req.OwnerId, token), ct);
|
|
48
|
-
|
|
49
|
-
if (result.IsSuccess && !string.IsNullOrWhiteSpace(result.Value?.RowVersionBase64))
|
|
50
|
-
HttpContext.Response.SetETagFromBase64(result.Value!.RowVersionBase64); // set ETag
|
|
51
|
-
return result;
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
```csharp
|
|
55
|
-
// Handler — compare the supplied token, and catch EF's concurrency exception
|
|
56
|
-
var current = entity.RowVersion is { Length: > 0 } rv ? Convert.ToBase64String(rv) : string.Empty;
|
|
57
|
-
if (string.IsNullOrWhiteSpace(request.RowVersionBase64) ||
|
|
58
|
-
!string.Equals(current, request.RowVersionBase64, StringComparison.Ordinal))
|
|
59
|
-
return Result<ProjectDto>.Failure(new Error(
|
|
60
|
-
"concurrency.conflict", "Resource was modified by another process. Reload and retry.",
|
|
61
|
-
409, "projects"));
|
|
62
|
-
|
|
63
|
-
entity.Update(request.Name, request.Description, request.StartDate, request.EndDate, ownerId);
|
|
64
|
-
await _repo.UpdateAsync(entity, ct);
|
|
65
|
-
|
|
66
|
-
try { await _uow.SaveChangesAsync(ct); }
|
|
67
|
-
catch (DbUpdateConcurrencyException)
|
|
68
|
-
{
|
|
69
|
-
return Result<ProjectDto>.Failure(new Error(
|
|
70
|
-
"concurrency.conflict", "Resource was modified by another process. Reload and retry.",
|
|
71
|
-
409, "projects"));
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
ETag token helpers — strong tokens; strip `W/` weak prefix and quotes on read:
|
|
76
|
-
|
|
77
|
-
```csharp
|
|
78
|
-
// <SampleProjectName>.Service/Utilities/HttpRequestETagExtensions.cs
|
|
79
|
-
public static string GetIfMatchBase64Token(this HttpRequest request, string? fallback = null)
|
|
80
|
-
{
|
|
81
|
-
var token = request.Headers.IfMatch.FirstOrDefault();
|
|
82
|
-
return !string.IsNullOrWhiteSpace(token) ? SanitizeETagToken(token) : (fallback ?? string.Empty);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public static string SanitizeETagToken(string? raw)
|
|
86
|
-
{
|
|
87
|
-
if (string.IsNullOrWhiteSpace(raw)) return string.Empty;
|
|
88
|
-
var token = raw.Trim();
|
|
89
|
-
if (token.StartsWith("W/")) token = token[2..].Trim(); // strip weak prefix
|
|
90
|
-
return token.Trim('"'); // strip quotes
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// On success the endpoint sets the strong ETag from the DTO's RowVersionBase64:
|
|
94
|
-
HttpContext.Response.SetETagFromBase64(result.Value!.RowVersionBase64);
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Related
|
|
98
|
-
|
|
99
|
-
- [[vertical-slices]] · [[persistence]] · [[eventing]] · [[coding-standards]] · [[api-versioning.domain]]
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# Coding Standards
|
|
2
|
-
|
|
3
|
-
> Pure technology (domain-agnostic) — domain forbidden patterns & CI gates in [[coding-standards.domain]]. Commands: `/aw-spec-implement`, `/aw-spec-implement-delta`, `/aw-spec-build`, `/aw-spec-analyze-slice`.
|
|
4
|
-
|
|
5
|
-
## Naming conventions
|
|
6
|
-
|
|
7
|
-
- Solution and projects: `<SampleProjectName>.<Role>` (e.g. `<SampleProjectName>.Api`,
|
|
8
|
-
`<SampleProjectName>.AppHost`, `<SampleProjectName>.ServiceDefaults`).
|
|
9
|
-
- Namespaces mirror the folder path exactly; **file-scoped namespaces only**.
|
|
10
|
-
- Aggregates: `class <Aggregate> : EntityBase<<Aggregate>Id>, IAggregateRoot,
|
|
11
|
-
IFullAuditedObject, ISoftDeletable, IConcurrencyTracked, IHasDomainEvents,
|
|
12
|
-
INamedEntity<<Aggregate>Id>`.
|
|
13
|
-
- Commands/Queries: `record <Verb><Aggregate>Command(...) : ICommand<Result<TDto>>`.
|
|
14
|
-
- DTOs: `record <Aggregate>Dto { public required Guid Id { get; init; } ... }` — no setters;
|
|
15
|
-
required init for non-nullable members.
|
|
16
|
-
|
|
17
|
-
## Nullable & language rules
|
|
18
|
-
|
|
19
|
-
- C# language version: latest LTS; **nullable reference types ENABLED**; implicit usings
|
|
20
|
-
ENABLED; **`TreatWarningsAsErrors` for Release**.
|
|
21
|
-
|
|
22
|
-
## Async conventions
|
|
23
|
-
|
|
24
|
-
- Every I/O-bound method ends with `Async` and accepts a `CancellationToken` as the **last
|
|
25
|
-
parameter**.
|
|
26
|
-
- `async void` is forbidden outside event handlers.
|
|
27
|
-
- Blocking calls (`.Result`, `.Wait()`, `Task.Run` to fake async) in request-handling paths
|
|
28
|
-
are FORBIDDEN.
|
|
29
|
-
|
|
30
|
-
## Error / exception conventions
|
|
31
|
-
|
|
32
|
-
- Exceptions are thrown by the **Domain only** (`DomainException`,
|
|
33
|
-
`InvariantViolationException`). Application code returns `Result<T>` (see [[cqrs]]).
|
|
34
|
-
- Never catch-all `catch (Exception)` that swallows or rewraps without rethrow, except in the
|
|
35
|
-
central exception handler.
|
|
36
|
-
- Never return HTTP 200 with an error body — use correct status codes (4xx client, 5xx server,
|
|
37
|
-
409 concurrency).
|
|
38
|
-
|
|
39
|
-
## Documentation expectations
|
|
40
|
-
|
|
41
|
-
- XML doc comments on public types and aggregate methods.
|
|
42
|
-
- Inline comments only where intent is non-obvious. Commented-out code MUST be removed before
|
|
43
|
-
merge.
|
|
44
|
-
- Do not write inline rationale comments explaining pattern choices — the constitution is the
|
|
45
|
-
rationale (see [[ai-rules]]).
|
|
46
|
-
|
|
47
|
-
## Forbidden patterns (generic; rejected at review, build-warning where statically detectable)
|
|
48
|
-
|
|
49
|
-
1. MediatR — use `AppWeaver.Mediator` (see [[dependency-policy]]).
|
|
50
|
-
2. AutoMapper / Mapster reflection mapping — hand-written `ToDto()` only.
|
|
51
|
-
3. Anemic domain models (see [[domain-driven-design]]).
|
|
52
|
-
4. Repository as data-access god object (see [[persistence]]).
|
|
53
|
-
5. Cross-aggregate EF navigation properties — strongly-typed ID only.
|
|
54
|
-
6. Hard-coded connection strings, secrets, ports, or issuer URLs in source (see [[zero-trust]]).
|
|
55
|
-
7. Static service locator — use constructor DI.
|
|
56
|
-
8. Direct `DbContext` access from Endpoints or Features outside repo/spec surface.
|
|
57
|
-
9. Blocking calls in request paths.
|
|
58
|
-
10. Catch-all that swallows/rewraps without rethrow (outside central handler).
|
|
59
|
-
11. `AllowAnonymous()` on sensitive-data/mutating endpoints in a CI-protected branch.
|
|
60
|
-
12. Logging/emitting secrets, tokens, keys, or payment-card data (see [[data-classification]]).
|
|
61
|
-
13. Multiple aggregate mutations in one transaction (see [[cqrs]], [[eventing]]).
|
|
62
|
-
14. `DateTime.UtcNow` / `Guid.NewGuid()` in aggregates/handlers/SUT — use `IClock` /
|
|
63
|
-
`IGuidGenerator` (see [[testing]]).
|
|
64
|
-
15. HTTP 200 with an error body.
|
|
65
|
-
16. Analytics/reporting by querying the OLTP DB directly — emit events (see [[eventing]]).
|
|
66
|
-
|
|
67
|
-
> Domain-specific forbidden patterns are in [[coding-standards.domain]].
|
|
68
|
-
|
|
69
|
-
## Quality gates (CI) — generic, must pass before merge
|
|
70
|
-
|
|
71
|
-
1. `dotnet build` succeeds with `TreatWarningsAsErrors=true` for Release.
|
|
72
|
-
2. `dotnet test` passes for UnitTests + IntegrationTests.
|
|
73
|
-
3. Code coverage on changed files meets the Testing Profile threshold (see [[testing]]).
|
|
74
|
-
4. EF Core migrations apply cleanly to a fresh PostgreSQL instance (see [[persistence]]).
|
|
75
|
-
5. OpenAPI document generation succeeds; diff reviewed for breaking changes.
|
|
76
|
-
6. AsyncAPI regenerates cleanly for any domain-event contract change (see [[eventing]]).
|
|
77
|
-
7. Static analysis (Roslyn analyzers, nullable warnings, banned-API analyzer) — zero errors.
|
|
78
|
-
8. Grep checks: no `AllowAnonymous()` on production endpoints, no hard-coded secrets, no
|
|
79
|
-
MediatR/AutoMapper references.
|
|
80
|
-
9. Constitution compliance review checked off in the PR template.
|
|
81
|
-
|
|
82
|
-
> Domain-specific CI gates are in [[coding-standards.domain]].
|
|
83
|
-
|
|
84
|
-
## Related
|
|
85
|
-
|
|
86
|
-
- [[dependency-policy]] · [[api-versioning]] · [[domain-driven-design]] · [[cqrs]] ·
|
|
87
|
-
[[persistence]] · [[testing]] · [[ai-rules]] · [[coding-standards.domain]]
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Dependency Policy
|
|
2
|
-
|
|
3
|
-
> Pure technology (domain-agnostic) — domain package rules in [[dependency-policy.domain]]. Commands: `/aw-spec-implement`, `/aw-spec-implement-delta`.
|
|
4
|
-
|
|
5
|
-
## Package governance
|
|
6
|
-
|
|
7
|
-
- **All package versions are governed by `Directory.Packages.props`** (Central Package
|
|
8
|
-
Management). `PackageReference` entries in `.csproj` MUST NOT specify a `Version`.
|
|
9
|
-
- New dependencies are added via `dotnet add package`.
|
|
10
|
-
|
|
11
|
-
## Approved / preferred packages
|
|
12
|
-
|
|
13
|
-
- Mediator: **`AppWeaver.Mediator`**.
|
|
14
|
-
- Mapping: **hand-written `ToDto()` extension methods** (no reflection mapper).
|
|
15
|
-
- Observability: **`AppWeaver.ServiceDefaults`** (OpenTelemetry + Serilog + resilience +
|
|
16
|
-
discovery) — see [[auditing]].
|
|
17
|
-
- Validation: FluentValidation (via the mediator pipeline behavior; see [[cqrs]]).
|
|
18
|
-
|
|
19
|
-
## Banned packages
|
|
20
|
-
|
|
21
|
-
- **MediatR** — MUST NOT appear in any `Directory.Packages.props` entry (CI grep gate).
|
|
22
|
-
- **AutoMapper / Mapster** (reflection mapping) — forbidden (see [[coding-standards]]).
|
|
23
|
-
- Any logging package that ships analytics/telemetry exfiltration by default — rejected.
|
|
24
|
-
|
|
25
|
-
## Supply-chain rules
|
|
26
|
-
|
|
27
|
-
- New dependencies are reviewed for **license and supply-chain risk** before adoption.
|
|
28
|
-
- AI agents **MUST NOT** introduce new top-level dependencies; new framework capabilities are
|
|
29
|
-
requested explicitly by the developer (see [[ai-rules]]).
|
|
30
|
-
- Do not create speculative abstractions (single-implementation interfaces, generic wrappers
|
|
31
|
-
around existing framework types) — YAGNI is enforced.
|
|
32
|
-
|
|
33
|
-
## Licensing expectations
|
|
34
|
-
|
|
35
|
-
- Dependencies must carry a license compatible with the intended commercial deployment;
|
|
36
|
-
copyleft licenses that would force source disclosure of the service are rejected.
|
|
37
|
-
|
|
38
|
-
## Related
|
|
39
|
-
|
|
40
|
-
- [[coding-standards]] · [[cqrs]] · [[auditing]] · [[ai-rules]] · [[dependency-policy.domain]]
|