aw-spec-cli 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/.agents/skills/aw-spec-addcomponent/SKILL.md +129 -0
- package/assets/.agents/skills/aw-spec-agent-context-update/SKILL.md +31 -0
- package/assets/.agents/skills/aw-spec-analyze/SKILL.md +296 -0
- package/assets/.agents/skills/aw-spec-checklist/SKILL.md +374 -0
- package/assets/.agents/skills/aw-spec-clarify/SKILL.md +320 -0
- package/assets/.agents/skills/aw-spec-constitution/SKILL.md +194 -0
- package/assets/.agents/skills/aw-spec-fast-implement/SKILL.md +268 -0
- package/assets/.agents/skills/aw-spec-foundation/SKILL.md +358 -0
- package/assets/.agents/skills/aw-spec-implement/SKILL.md +279 -0
- package/assets/.agents/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
- package/assets/.agents/skills/aw-spec-plan/SKILL.md +221 -0
- package/assets/.agents/skills/aw-spec-select-domain/SKILL.md +73 -0
- package/assets/.agents/skills/aw-spec-specify/SKILL.md +382 -0
- package/assets/.agents/skills/aw-spec-tasks/SKILL.md +259 -0
- package/assets/.agents/skills/aw-spec-taskstoissues/SKILL.md +107 -0
- package/assets/.aw-spec/domain.json +3 -0
- package/assets/.aw-spec/extensions/.registry +19 -0
- package/assets/.aw-spec/extensions/agent-context/README.md +57 -0
- package/assets/.aw-spec/extensions/agent-context/agent-context-config.yml +4 -0
- package/assets/.aw-spec/extensions/agent-context/commands/aw-spec.agent-context.update.md +26 -0
- package/assets/.aw-spec/extensions/agent-context/extension.yml +34 -0
- package/assets/.aw-spec/extensions/agent-context/scripts/bash/update-agent-context.sh +201 -0
- package/assets/.aw-spec/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +237 -0
- package/assets/.aw-spec/extensions.yml +23 -0
- package/assets/.aw-spec/feature.json +3 -0
- package/assets/.aw-spec/init-options.json +9 -0
- package/assets/.aw-spec/integration.json +15 -0
- package/assets/.aw-spec/integrations/aw-spec.manifest.json +17 -0
- package/assets/.aw-spec/integrations/claude.manifest.json +17 -0
- package/assets/.aw-spec/memory/constitution.md +50 -0
- package/assets/.aw-spec/scripts/bash/check-prerequisites.sh +189 -0
- package/assets/.aw-spec/scripts/bash/common.sh +582 -0
- package/assets/.aw-spec/scripts/bash/create-new-feature.sh +299 -0
- package/assets/.aw-spec/scripts/bash/setup-plan.sh +84 -0
- package/assets/.aw-spec/scripts/bash/setup-tasks.sh +91 -0
- package/assets/.aw-spec/templates/checklist-template.md +40 -0
- package/assets/.aw-spec/templates/constitution-template.md +57 -0
- package/assets/.aw-spec/templates/plan-template.md +113 -0
- package/assets/.aw-spec/templates/spec-template.md +131 -0
- package/assets/.aw-spec/templates/tasks-template.md +252 -0
- package/assets/.aw-spec/workflows/aw-spec/workflow.yml +77 -0
- package/assets/.aw-spec/workflows/workflow-registry.json +13 -0
- package/assets/.claude/skills/aw-spec-addcomponent/SKILL.md +129 -0
- package/assets/.claude/skills/aw-spec-agent-context-update/SKILL.md +31 -0
- package/assets/.claude/skills/aw-spec-analyze/SKILL.md +296 -0
- package/assets/.claude/skills/aw-spec-checklist/SKILL.md +374 -0
- package/assets/.claude/skills/aw-spec-clarify/SKILL.md +320 -0
- package/assets/.claude/skills/aw-spec-constitution/SKILL.md +194 -0
- package/assets/.claude/skills/aw-spec-fast-implement/SKILL.md +268 -0
- package/assets/.claude/skills/aw-spec-foundation/SKILL.md +358 -0
- package/assets/.claude/skills/aw-spec-implement/SKILL.md +279 -0
- package/assets/.claude/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
- package/assets/.claude/skills/aw-spec-plan/SKILL.md +221 -0
- package/assets/.claude/skills/aw-spec-select-domain/SKILL.md +73 -0
- package/assets/.claude/skills/aw-spec-specify/SKILL.md +382 -0
- package/assets/.claude/skills/aw-spec-tasks/SKILL.md +259 -0
- package/assets/.claude/skills/aw-spec-taskstoissues/SKILL.md +107 -0
- package/assets/.kilocode/rules/specify-rules.md +4 -0
- package/assets/.kilocode/workflows/aw-spec-addcomponent.md +129 -0
- package/assets/.kilocode/workflows/aw-spec-agent-context.update.md +31 -0
- package/assets/.kilocode/workflows/aw-spec-analyze.md +296 -0
- package/assets/.kilocode/workflows/aw-spec-checklist.md +374 -0
- package/assets/.kilocode/workflows/aw-spec-clarify.md +320 -0
- package/assets/.kilocode/workflows/aw-spec-constitution.md +194 -0
- package/assets/.kilocode/workflows/aw-spec-fast-implement.md +263 -0
- package/assets/.kilocode/workflows/aw-spec-foundation.md +358 -0
- package/assets/.kilocode/workflows/aw-spec-implement.md +279 -0
- package/assets/.kilocode/workflows/aw-spec-minimal-implementation.md +204 -0
- package/assets/.kilocode/workflows/aw-spec-plan.md +221 -0
- package/assets/.kilocode/workflows/aw-spec-select-domain.md +73 -0
- package/assets/.kilocode/workflows/aw-spec-specify.md +382 -0
- package/assets/.kilocode/workflows/aw-spec-tasks.md +259 -0
- package/assets/.kilocode/workflows/aw-spec-taskstoissues.md +107 -0
- package/assets/docs/README.md +106 -0
- package/assets/docs/VerticalSlice/PACKAGING.md +185 -0
- package/assets/docs/VerticalSlice/VerticalSlice.pack.txt +2833 -0
- package/assets/docs/VerticalSlice/pack-foundation.ps1 +145 -0
- package/assets/docs/VerticalSlice/pack-foundation.sh +196 -0
- package/assets/docs/VerticalSlice/unpack-foundation.ps1 +126 -0
- package/assets/docs/VerticalSlice/unpack-foundation.sh +217 -0
- package/assets/docs/architecture/clean-architecture.md +71 -0
- package/assets/docs/architecture/cqrs.md +141 -0
- package/assets/docs/architecture/eventing.md +83 -0
- package/assets/docs/architecture/folder-structure.md +61 -0
- package/assets/docs/architecture/modular-monolith.md +47 -0
- package/assets/docs/architecture/persistence.md +269 -0
- package/assets/docs/architecture/testing.md +55 -0
- package/assets/docs/architecture/vertical-slices.md +201 -0
- package/assets/docs/command.txt +295 -0
- package/assets/docs/components/Email/README.md +112 -0
- package/assets/docs/components/Email/integration.md +260 -0
- package/assets/docs/components/Jobs/README.md +113 -0
- package/assets/docs/components/Jobs/integration.md +245 -0
- package/assets/docs/components/QrGenerator/README.md +78 -0
- package/assets/docs/components/QrGenerator/integration.md +185 -0
- package/assets/docs/components/README.md +57 -0
- package/assets/docs/domain/domain-driven-design.md +212 -0
- package/assets/docs/domainspecs/healthcare/ai-rules.domain.md +34 -0
- package/assets/docs/domainspecs/healthcare/api-versioning.domain.md +17 -0
- package/assets/docs/domainspecs/healthcare/auditing.domain.md +29 -0
- package/assets/docs/domainspecs/healthcare/authorization.domain.md +26 -0
- package/assets/docs/domainspecs/healthcare/clinical-terms.md +20 -0
- package/assets/docs/domainspecs/healthcare/coding-standards.domain.md +26 -0
- package/assets/docs/domainspecs/healthcare/comandrulemap.md +119 -0
- package/assets/docs/domainspecs/healthcare/consent.md +19 -0
- package/assets/docs/domainspecs/healthcare/cqrs.domain.md +12 -0
- package/assets/docs/domainspecs/healthcare/data-classification.domain.md +28 -0
- package/assets/docs/domainspecs/healthcare/dependency-policy.domain.md +11 -0
- package/assets/docs/domainspecs/healthcare/dicom.md +15 -0
- package/assets/docs/domainspecs/healthcare/domain-driven-design.domain.md +28 -0
- package/assets/docs/domainspecs/healthcare/domain-requirements.md +55 -0
- package/assets/docs/domainspecs/healthcare/eventing.domain.md +18 -0
- package/assets/docs/domainspecs/healthcare/fhir.md +36 -0
- package/assets/docs/domainspecs/healthcare/folder-structure.domain.md +23 -0
- package/assets/docs/domainspecs/healthcare/hipaa.md +34 -0
- package/assets/docs/domainspecs/healthcare/hl7.md +15 -0
- package/assets/docs/domainspecs/healthcare/integration-terms.md +21 -0
- package/assets/docs/domainspecs/healthcare/persistence.domain.md +20 -0
- package/assets/docs/domainspecs/healthcare/terminology.md +30 -0
- package/assets/docs/domainspecs/healthcare/testing.domain.md +15 -0
- package/assets/docs/domainspecs/healthcare/vertical-slices.domain.md +18 -0
- package/assets/docs/domainspecs/healthcare/zero-trust.domain.md +12 -0
- package/assets/docs/domainspecs/pharma/ai-rules.domain.md +32 -0
- package/assets/docs/domainspecs/pharma/api-versioning.domain.md +20 -0
- package/assets/docs/domainspecs/pharma/atc.md +22 -0
- package/assets/docs/domainspecs/pharma/auditing.domain.md +26 -0
- package/assets/docs/domainspecs/pharma/authorization.domain.md +25 -0
- package/assets/docs/domainspecs/pharma/coding-standards.domain.md +28 -0
- package/assets/docs/domainspecs/pharma/comandrulemap.md +136 -0
- package/assets/docs/domainspecs/pharma/cqrs.domain.md +16 -0
- package/assets/docs/domainspecs/pharma/data-classification.domain.md +24 -0
- package/assets/docs/domainspecs/pharma/data-provenance.md +21 -0
- package/assets/docs/domainspecs/pharma/dependency-policy.domain.md +11 -0
- package/assets/docs/domainspecs/pharma/domain-driven-design.domain.md +36 -0
- package/assets/docs/domainspecs/pharma/domain-requirements.md +99 -0
- package/assets/docs/domainspecs/pharma/eventing.domain.md +18 -0
- package/assets/docs/domainspecs/pharma/fhir.md +31 -0
- package/assets/docs/domainspecs/pharma/folder-structure.domain.md +24 -0
- package/assets/docs/domainspecs/pharma/hl7.md +17 -0
- package/assets/docs/domainspecs/pharma/idmp.md +26 -0
- package/assets/docs/domainspecs/pharma/integration-terms.md +21 -0
- package/assets/docs/domainspecs/pharma/ndc.md +28 -0
- package/assets/docs/domainspecs/pharma/persistence.domain.md +23 -0
- package/assets/docs/domainspecs/pharma/pharma-terms.md +27 -0
- package/assets/docs/domainspecs/pharma/product-lifecycle.domain.md +30 -0
- package/assets/docs/domainspecs/pharma/regulatory-compliance.md +19 -0
- package/assets/docs/domainspecs/pharma/terminology.md +32 -0
- package/assets/docs/domainspecs/pharma/testing.domain.md +19 -0
- package/assets/docs/domainspecs/pharma/vertical-slices.domain.md +17 -0
- package/assets/docs/domainspecs/pharma/zero-trust.domain.md +12 -0
- package/assets/docs/glossary/ai-rules.md +59 -0
- package/assets/docs/governance/api-versioning.md +99 -0
- package/assets/docs/governance/coding-standards.md +87 -0
- package/assets/docs/governance/dependency-policy.md +40 -0
- package/assets/docs/interop/ihe-conformance.md +31 -0
- package/assets/docs/pharma-constitution.my-ref.md +86 -0
- package/assets/docs/requirement-spec.txt +15 -0
- package/assets/docs/security/auditing.md +117 -0
- package/assets/docs/security/authorization-matrix.md +14 -0
- package/assets/docs/security/authorization.md +87 -0
- package/assets/docs/security/data-classification.md +38 -0
- package/assets/docs/security/zero-trust.md +76 -0
- package/assets/docs/technology-constitution.md +172 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/utils/copy-assets.d.ts +8 -1
- package/dist/utils/copy-assets.d.ts.map +1 -1
- package/dist/utils/copy-assets.js +1 -0
- package/dist/utils/copy-assets.js.map +1 -1
- package/dist/utils/paths.js +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Domain-Driven Design Standards (Tactical Patterns)
|
|
2
|
+
|
|
3
|
+
> Pure technology (domain-agnostic) — generic DDD tactical patterns; the business model, canonical aggregates + invariants are in [[domain-driven-design.domain]]. NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
> Note: this file lives under `domain/` because DDD is a domain-modeling methodology, but the
|
|
6
|
+
> rules here are domain-agnostic and reusable. The business-specific model is in the companion
|
|
7
|
+
> `.domain.md`.
|
|
8
|
+
|
|
9
|
+
## Ubiquitous language & bounded contexts
|
|
10
|
+
|
|
11
|
+
- Use a consistent ubiquitous language across each bounded context.
|
|
12
|
+
- Each bounded context = one module with `Domain / Features / Persistence / Shared`
|
|
13
|
+
(see [[modular-monolith]]).
|
|
14
|
+
|
|
15
|
+
## Aggregate design
|
|
16
|
+
|
|
17
|
+
- Every entity exposed to the Application layer is reached through an **Aggregate Root**.
|
|
18
|
+
- Aggregate roots implement `IAggregateRoot`, `EntityBase<TId>`, and the
|
|
19
|
+
audit/soft-delete/concurrency/domain-event interfaces they need:
|
|
20
|
+
`IFullAuditedObject` or `IAuditableEntityBase`, `ISoftDeletable`, `IConcurrencyTracked`,
|
|
21
|
+
`IHasDomainEvents`, `INamedEntity<TId>` when listable.
|
|
22
|
+
|
|
23
|
+
### Aggregate root responsibilities
|
|
24
|
+
|
|
25
|
+
- Enforce all invariants for the aggregate.
|
|
26
|
+
- Own the lifecycle of its child entities.
|
|
27
|
+
- Raise domain events for state transitions.
|
|
28
|
+
|
|
29
|
+
### Child entity ownership
|
|
30
|
+
|
|
31
|
+
- Child entities implement `IAggregateChild` and expose `GetAggregateRoot()`.
|
|
32
|
+
- They are mutated **only** through methods on the aggregate root.
|
|
33
|
+
|
|
34
|
+
## Transactional / consistency boundaries
|
|
35
|
+
|
|
36
|
+
- **Transaction boundary equals aggregate boundary**: a single command mutates a single
|
|
37
|
+
aggregate per transaction.
|
|
38
|
+
- Cross-aggregate effects flow through **domain events** or **follow-up commands**
|
|
39
|
+
(see [[eventing]], [[cqrs]]).
|
|
40
|
+
|
|
41
|
+
## Strongly typed IDs
|
|
42
|
+
|
|
43
|
+
- IDs are **strongly-typed Vogen value objects** (`<Aggregate>Id` as
|
|
44
|
+
`[ValueObject<Guid>] partial struct`).
|
|
45
|
+
- Raw `Guid` parameters at the Application boundary **MUST be wrapped** at the handler edge.
|
|
46
|
+
|
|
47
|
+
## Value objects
|
|
48
|
+
|
|
49
|
+
- Value Objects are **sealed**, have **private constructors**, **validate in the constructor**,
|
|
50
|
+
throw `DomainException` on invariant violations, and expose a `From(...)` factory.
|
|
51
|
+
|
|
52
|
+
## Domain events
|
|
53
|
+
|
|
54
|
+
- Derive from `DomainEventBase`, are immutable, added inside aggregate methods via
|
|
55
|
+
`AddDomainEvent(...)`, published explicitly by command handlers. See [[eventing]].
|
|
56
|
+
|
|
57
|
+
## Domain services, repositories, specifications
|
|
58
|
+
|
|
59
|
+
- Invariants are enforced **inside the aggregate**; validators check request shape only.
|
|
60
|
+
- Repository usage is limited to `IRepository<T>` / `IReadRepository<T>` + `Specification<T>`.
|
|
61
|
+
- Specification pattern: query composition lives in the Domain. See [[persistence]].
|
|
62
|
+
|
|
63
|
+
## Domain exception handling
|
|
64
|
+
|
|
65
|
+
- Exceptions are thrown by the Domain only (`DomainException`, `InvariantViolationException`).
|
|
66
|
+
Application code returns `Result<T>` (see [[cqrs]]).
|
|
67
|
+
|
|
68
|
+
## Encapsulation, immutability, audit-awareness
|
|
69
|
+
|
|
70
|
+
- **Rich domain model** — no public setters on aggregates, no business logic in handlers.
|
|
71
|
+
- Soft-delete and audit behavior are first-class on protected aggregates
|
|
72
|
+
(see [[persistence]], [[auditing]]).
|
|
73
|
+
|
|
74
|
+
## Anti-patterns (FORBIDDEN)
|
|
75
|
+
|
|
76
|
+
- **Anemic domain models** — no public setters, no "manager/service" classes mutating
|
|
77
|
+
aggregate state from outside, no primitive-typed IDs, no business logic in handlers.
|
|
78
|
+
- Cross-aggregate EF navigation properties — reference by strongly-typed ID only.
|
|
79
|
+
- Cross-bounded-context interaction except via Shared DTOs / `IMediator` / anti-corruption
|
|
80
|
+
adapters.
|
|
81
|
+
|
|
82
|
+
## Canonical example (agent reference — `<SampleProjectName>` sample)
|
|
83
|
+
|
|
84
|
+
Aggregate root with a strongly-typed Vogen ID, owned child collection, concurrency token,
|
|
85
|
+
domain events, and an invariant enforced **inside** the aggregate:
|
|
86
|
+
|
|
87
|
+
```csharp
|
|
88
|
+
// <SampleProjectName>.Service/Projects/Domain/Project.cs
|
|
89
|
+
[ValueObject<Guid>]
|
|
90
|
+
public partial struct ProjectId { }
|
|
91
|
+
|
|
92
|
+
public class Project :
|
|
93
|
+
EntityBase<ProjectId>, IAggregateRoot, IFullAuditedObject, IFieldAudited,
|
|
94
|
+
ISoftDeletable, IConcurrencyTracked, IHasDomainEvents, INamedEntity<ProjectId>
|
|
95
|
+
{
|
|
96
|
+
private readonly List<ProjectTask> _tasks = new();
|
|
97
|
+
|
|
98
|
+
public string Name { get; set; } = default!; // INamedEntity
|
|
99
|
+
public ProjectCode Code { get; private set; } = default!; // value object
|
|
100
|
+
public ProjectStatus Status { get; private set; }
|
|
101
|
+
public TaskUserId? OwnerId { get; private set; } // cross-aggregate ref by ID only
|
|
102
|
+
public IReadOnlyCollection<ProjectTask> Tasks => _tasks.AsReadOnly();
|
|
103
|
+
|
|
104
|
+
public byte[] RowVersion { get; set; } = Array.Empty<byte>(); // IConcurrencyTracked
|
|
105
|
+
|
|
106
|
+
private readonly List<DomainEventBase> _domainEvents = new();
|
|
107
|
+
[NotMapped] public IEnumerable<DomainEventBase> DomainEvents => _domainEvents.AsReadOnly();
|
|
108
|
+
public void ClearDomainEvents() => _domainEvents.Clear();
|
|
109
|
+
|
|
110
|
+
private Project() { } // EF Core ctor
|
|
111
|
+
|
|
112
|
+
public Project(string code, string name, DateOnly startDate, TaskUserId? ownerId)
|
|
113
|
+
{
|
|
114
|
+
Id = ProjectId.From(Guid.NewGuid());
|
|
115
|
+
Code = ProjectCode.From(code); // VO validates in its ctor
|
|
116
|
+
Name = ProjectTitle.From(name).Value;
|
|
117
|
+
Status = ProjectStatus.Planning;
|
|
118
|
+
OwnerId = ownerId;
|
|
119
|
+
AddDomainEvent(new ProjectCreatedEvent(Id.Value, Code.Value, Name));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Invariant lives in the aggregate — never in the handler/validator.
|
|
123
|
+
public ProjectTask AddTask(string title, TaskPriority priority)
|
|
124
|
+
{
|
|
125
|
+
if (Status is ProjectStatus.Cancelled or ProjectStatus.Archived)
|
|
126
|
+
throw new DomainException("Cannot add tasks to a Cancelled or Archived project.");
|
|
127
|
+
var task = new ProjectTask(Id, title, priority);
|
|
128
|
+
_tasks.Add(task);
|
|
129
|
+
AddDomainEvent(new TaskCreatedEvent(Id.Value, task.Id.Value, task.Title.Value));
|
|
130
|
+
return task;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private void AddDomainEvent(DomainEventBase e) => _domainEvents.Add(e);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Value object — sealed, private ctor, validates in the ctor, `From(...)` factory,
|
|
138
|
+
throws `DomainException`:
|
|
139
|
+
|
|
140
|
+
```csharp
|
|
141
|
+
// <SampleProjectName>.Service/Projects/Domain/ProjectCode.cs
|
|
142
|
+
public sealed class ProjectCode : IEquatable<ProjectCode>
|
|
143
|
+
{
|
|
144
|
+
private static readonly Regex _valid = new(@"^[A-Z0-9][A-Z0-9\-]{1,14}$", RegexOptions.Compiled);
|
|
145
|
+
public string Value { get; private set; } = default!;
|
|
146
|
+
|
|
147
|
+
private ProjectCode() { }
|
|
148
|
+
private ProjectCode(string value)
|
|
149
|
+
{
|
|
150
|
+
if (string.IsNullOrWhiteSpace(value))
|
|
151
|
+
throw new DomainException("Project code cannot be empty.");
|
|
152
|
+
var trimmed = value.Trim().ToUpperInvariant();
|
|
153
|
+
if (!_valid.IsMatch(trimmed))
|
|
154
|
+
throw new DomainException("Project code must be uppercase alphanumeric with hyphens.");
|
|
155
|
+
Value = trimmed;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public static ProjectCode From(string value) => new(value);
|
|
159
|
+
public bool Equals(ProjectCode? o) => o is not null && Value == o.Value;
|
|
160
|
+
public override bool Equals(object? obj) => Equals(obj as ProjectCode);
|
|
161
|
+
public override int GetHashCode() => HashCode.Combine(Value);
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Child entity — implements `IAggregateChild`, exposes `GetAggregateRoot()`, has only `private`
|
|
166
|
+
setters, and is mutated **only** through methods the parent aggregate calls:
|
|
167
|
+
|
|
168
|
+
```csharp
|
|
169
|
+
// <SampleProjectName>.Service/Projects/Domain/ProjectTask.cs
|
|
170
|
+
[ValueObject<Guid>]
|
|
171
|
+
public partial struct ProjectTaskId { }
|
|
172
|
+
|
|
173
|
+
public class ProjectTask : EntityBase<ProjectTaskId>, IAggregateChild
|
|
174
|
+
{
|
|
175
|
+
public ProjectId ProjectId { get; private set; } // FK back to the root
|
|
176
|
+
public TaskTitle Title { get; private set; } = default!; // value object
|
|
177
|
+
public ProjectTaskStatus Status { get; private set; }
|
|
178
|
+
public TaskUserId? AssigneeId { get; private set; } // cross-aggregate ref by ID
|
|
179
|
+
|
|
180
|
+
public Project Project { get; private set; } = default!; // EF-only nav, private setter
|
|
181
|
+
public object GetAggregateRoot() => Project; // IAggregateChild
|
|
182
|
+
|
|
183
|
+
private ProjectTask() { } // EF Core ctor
|
|
184
|
+
public ProjectTask(ProjectId projectId, string title, TaskPriority priority)
|
|
185
|
+
{
|
|
186
|
+
Id = ProjectTaskId.From(Guid.NewGuid());
|
|
187
|
+
ProjectId = projectId;
|
|
188
|
+
Title = TaskTitle.From(title);
|
|
189
|
+
Status = ProjectTaskStatus.Open;
|
|
190
|
+
Priority = priority;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// State-machine invariant lives on the child; the parent calls it (project.ChangeTaskStatus).
|
|
194
|
+
public void ChangeStatus(ProjectTaskStatus newStatus)
|
|
195
|
+
{
|
|
196
|
+
if (Status == ProjectTaskStatus.Cancelled)
|
|
197
|
+
throw new DomainException("A cancelled task cannot be re-opened.");
|
|
198
|
+
Status = newStatus;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public void AssignTo(TaskUserId assigneeId) => AssigneeId = assigneeId;
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
> The aggregate root mutates children only through its own methods (e.g. `Project.AssignTask`
|
|
206
|
+
> calls `task.AssignTo(...)` and raises the domain event) — callers never touch `ProjectTask`
|
|
207
|
+
> directly. EF mapping for the owned collection is in [[persistence]].
|
|
208
|
+
|
|
209
|
+
## Related
|
|
210
|
+
|
|
211
|
+
- [[modular-monolith]] · [[clean-architecture]] · [[cqrs]] · [[persistence]] ·
|
|
212
|
+
[[eventing]] · [[domain-driven-design.domain]]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# AI Operational Rules — Healthcare Domain Addenda
|
|
2
|
+
|
|
3
|
+
> Technology base: [[ai-rules]]. Commands: **ALL**.
|
|
4
|
+
|
|
5
|
+
## Context & codes
|
|
6
|
+
- FHIR types: use the **official FHIR .NET SDK**, version-matched (R4/R5) to the endpoint (see [[fhir]]).
|
|
7
|
+
- Confirm coded values against the Terminology module's value sets; never invent ICD/SNOMED/LOINC/CPT codes (see [[terminology]]).
|
|
8
|
+
|
|
9
|
+
## Generation
|
|
10
|
+
- A complete slice adds a FHIR projector + FHIR-validator test when applicable (see [[fhir]], [[testing.domain]]).
|
|
11
|
+
- Generated FHIR resources MUST honor declared IG profiles and pass the FHIR validator (see [[fhir]]).
|
|
12
|
+
- Comments are reserved for clinical intent (generic rule in [[ai-rules]]).
|
|
13
|
+
|
|
14
|
+
## PHI masking
|
|
15
|
+
- MUST NOT log, echo, or commit any field of `Patient`/`Encounter`/`Observation`/`MedicationRequest`/`ClinicalNote`/`DiagnosticReport`/`Claim`/`Coverage` other than the strongly-typed ID.
|
|
16
|
+
- Apply field-level redaction in every generated example payload (see [[data-classification.domain]], [[hipaa]]).
|
|
17
|
+
|
|
18
|
+
## Tests
|
|
19
|
+
- MUST use the synthetic-PHI fixture library (`<SampleProjectName>.TestFixtures`); never inline fabricated PHI.
|
|
20
|
+
- Never invent ICD/SNOMED/LOINC/CPT/HCPCS/RxNorm/CVX codes — use a sentinel constant (see [[testing.domain]], [[terminology]]).
|
|
21
|
+
|
|
22
|
+
## Security-touching code
|
|
23
|
+
- MUST NOT modify authorization handlers, scope evaluators, consent checks, audit emitters, or encryption code without an explicit security-reviewer-attached prompt (see [[authorization.domain]], [[auditing.domain]], [[consent]]).
|
|
24
|
+
- FHIR profile changes: regenerate the IG artifacts + CapabilityStatement in the **same commit** (see [[fhir]], [[api-versioning.domain]]).
|
|
25
|
+
|
|
26
|
+
## Refusal conditions — extend [[ai-rules]]; refuse to:
|
|
27
|
+
- Embed any PHI test fixture in code/config.
|
|
28
|
+
- Disable a consent check globally.
|
|
29
|
+
- Bypass Interop adapters by writing aggregates directly from an external feed (see [[hl7]], [[eventing.domain]]).
|
|
30
|
+
- Generate de-identification logic without a documented method (Safe Harbor / Expert Determination) (see [[hipaa]]).
|
|
31
|
+
- Return PHI in error messages, logs, or trace attributes (see [[data-classification.domain]]).
|
|
32
|
+
|
|
33
|
+
## Related
|
|
34
|
+
- [[ai-rules]] · [[fhir]] · [[terminology]] · [[hipaa]] · [[consent]] · [[data-classification.domain]] · [[auditing.domain]] · [[authorization.domain]] · [[testing.domain]]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# API Versioning — Healthcare Domain Addenda (FHIR)
|
|
2
|
+
|
|
3
|
+
> Technology base: [[api-versioning]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## FHIR versioning
|
|
6
|
+
- R4 default; R5 is **additive** under a versioned path (`/fhir/R5/...`).
|
|
7
|
+
- Breaking FHIR changes 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
|
+
## Concurrency at the edge
|
|
11
|
+
- FHIR resources honor `If-Match` via the aggregate's concurrency token → FHIR **weak** ETag at the projection boundary (see [[persistence.domain]]).
|
|
12
|
+
|
|
13
|
+
## CapabilityStatement
|
|
14
|
+
- Published for FHIR (beyond generic OpenAPI/AsyncAPI); regenerates cleanly in CI; diff reviewed for breaking changes (see [[fhir]], [[coding-standards.domain]]).
|
|
15
|
+
|
|
16
|
+
## Related
|
|
17
|
+
- [[api-versioning]] · [[fhir]] · [[persistence.domain]] · [[coding-standards.domain]]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Auditing — Healthcare Domain Addenda (ATNA)
|
|
2
|
+
|
|
3
|
+
> Technology base: [[auditing]]. NON-NEGOTIABLE. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
- Auditing is **MANDATORY** for every PHI-bearing aggregate.
|
|
7
|
+
- Enable via `.EnableAdvancedAuditing()` + `AddAuditing(... UseEfCoreAuditing(...).UseAppWeaverDataStore())`.
|
|
8
|
+
- Audit tables: shared `AppWeaver.DataStore`, schema `Auditing`, prefix `Audit_`.
|
|
9
|
+
- A **PHI-access-audit** pipeline behavior runs on every mediator request (see [[cqrs.domain]]).
|
|
10
|
+
|
|
11
|
+
## Record (immutable)
|
|
12
|
+
Every PHI read/mutation, authentication, consent change, export, and break-the-glass MUST emit:
|
|
13
|
+
```
|
|
14
|
+
{ timestamp, subjectId, subjectRole, patientId, action, resourceType,
|
|
15
|
+
resourceId, outcome, sourceIp, correlationId, reason }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Audit-mandatory operations
|
|
19
|
+
Every PHI read/write; every authentication; every consent change; every export (`$export`, bulk/report download); every break-the-glass; every privileged admin action; every IdP/role change. See [[authorization.domain]].
|
|
20
|
+
|
|
21
|
+
## Retention & format
|
|
22
|
+
- **Append-only**; retained **>= 6 years**; exportable as FHIR `AuditEvent` (see [[domain-driven-design.domain]], [[persistence.domain]]).
|
|
23
|
+
|
|
24
|
+
## Telemetry & breach
|
|
25
|
+
- **PHI, full SSN, payment-card numbers, government IDs MUST NEVER** appear in logs, metric labels, exception messages, or traces (see [[data-classification.domain]]).
|
|
26
|
+
- Anomalous PHI access (volume spikes, off-hours mass reads, repeated denials) emits **Critical** alerts (see [[hipaa]]).
|
|
27
|
+
|
|
28
|
+
## Related
|
|
29
|
+
- [[auditing]] · [[hipaa]] · [[data-classification.domain]] · [[authorization.domain]] · [[consent]] · [[fhir]] · [[cqrs.domain]] · [[persistence.domain]]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Authorization — Healthcare Domain Addenda
|
|
2
|
+
|
|
3
|
+
> Technology base: [[authorization]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## Roles
|
|
6
|
+
`SystemAdmin`, `ComplianceOfficer`, `Physician`, `Nurse`, `LabTechnician`, `Radiologist`, `Pharmacist`, `BillingClerk`, `FrontDesk`, `Patient`, `ExternalSystem`, `ResearchAnalyst` (de-identified scope only). Per-route matrix: `docs/security/authorization-matrix.md`.
|
|
7
|
+
|
|
8
|
+
## SMART-on-FHIR scopes
|
|
9
|
+
- Scopes (`patient/*.read`, `user/Observation.read`, `system/*.write`, `launch/patient`) MUST be enforced on **every FHIR endpoint**.
|
|
10
|
+
- App launch (EHR + standalone): **PKCE mandatory; implicit flow FORBIDDEN** (see [[fhir]]).
|
|
11
|
+
|
|
12
|
+
## PHI minimum-necessary
|
|
13
|
+
- The PHI-access pipeline returns only fields the caller's role + scopes authorize; field-level redaction lives in projection extensions (see [[hipaa]], [[data-classification.domain]]).
|
|
14
|
+
|
|
15
|
+
## Consent & break-the-glass
|
|
16
|
+
- Pipeline checks **consent state** before releasing PHI outside the treating-provider context (see [[consent]]).
|
|
17
|
+
- Break-the-glass = explicit emergency-access command: documented reason + high-priority audit + real-time alert (see [[consent]], [[auditing.domain]]).
|
|
18
|
+
|
|
19
|
+
## Audit-mandatory
|
|
20
|
+
Every PHI read/write, authentication, consent change, export, break-the-glass, privileged admin action, IdP/role change (see [[auditing.domain]]).
|
|
21
|
+
|
|
22
|
+
## Anonymous allowlist
|
|
23
|
+
- Adds `/metadata` (FHIR CapabilityStatement) to the generic allowlist (see [[fhir]]).
|
|
24
|
+
|
|
25
|
+
## Related
|
|
26
|
+
- [[authorization]] · [[hipaa]] · [[consent]] · [[auditing.domain]] · [[data-classification.domain]] · [[fhir]]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Glossary — Clinical Terms
|
|
2
|
+
|
|
3
|
+
> Ubiquitous language for clinical aggregates. Commands: `/aw-spec-specify`, `/aw-spec-clarify`, `/aw-spec-plan`. See [[domain-driven-design.domain]] (modeling) + [[terminology]] (coding).
|
|
4
|
+
|
|
5
|
+
| Term | Definition |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **MRN** | Patient identifier, **unique per tenant** on `Patient` (Patients); cross-referenced via PIX/PDQ (see [[integration-terms]]). |
|
|
8
|
+
| **Encounter** | Clinical interaction (inpatient/outpatient/emergency); owns Admission/Transfer/Discharge; not Closeable with open Orders/Results/ChargeItems/unsigned ClinicalNotes (Encounters). |
|
|
9
|
+
| **Observation** | A discrete measurement/finding — vitals/social history (EMR) or lab result (Lab); coded LOINC/SNOMED (see [[terminology]]). |
|
|
10
|
+
| **Coverage** | Patient insurance record (Insurance); required (or documented self-pay) before admission. |
|
|
11
|
+
| **PractitionerRole** | A Practitioner's role within an Organization/Location (Identity) — drives role-based auth (see [[authorization.domain]]). |
|
|
12
|
+
| **CarePlan** | A planned set of clinical activities (EMR). |
|
|
13
|
+
| **DiagnosticReport** | A finalized result set with interpretation — radiology (Radiology) or lab (Lab). |
|
|
14
|
+
| **ClinicalNote** | Documentation entry; once **Signed** immutable; corrections are addenda; deletion forbidden (supersede via Amend). |
|
|
15
|
+
| **ProblemList / AllergyIntolerance / MedicationStatement / Immunization / Procedure / ServiceRequest** | EMR aggregates; coded SNOMED/ICD/RxNorm/CVX as applicable. |
|
|
16
|
+
| **MedicationRequest / MedicationDispense / MedicationAdministration** | Pharmacy aggregates; dispense blocked on allergy/interaction/contraindication without documented override. |
|
|
17
|
+
| **Consent** | First-class aggregate governing PHI disclosure; withdrawal blocks disclosure immediately (see [[consent]]). |
|
|
18
|
+
|
|
19
|
+
## Related
|
|
20
|
+
- [[integration-terms]] · [[domain-driven-design.domain]] · [[terminology]] · [[fhir]]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Coding Standards — Healthcare Domain Addenda
|
|
2
|
+
|
|
3
|
+
> Technology base: [[coding-standards]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## Coded value objects
|
|
6
|
+
- Follow the FHIR pattern: `Codeable`, `Coding`, `Quantity`, `Period`, `Range`, `Ratio`, `Identifier`, `HumanName`, `Address`, `ContactPoint` (see [[terminology]]).
|
|
7
|
+
- The Domain may additionally throw `ConsentDeniedException` (see [[consent]]).
|
|
8
|
+
|
|
9
|
+
## Forbidden patterns — extend [[coding-standards]]
|
|
10
|
+
- **H1.** Hard delete of any clinical/financial/audit/PHI-bearing aggregate (see [[persistence.domain]]).
|
|
11
|
+
- **H2.** Hard-coded IdP issuer / FHIR server / HL7 endpoint URLs, or PHI test fixtures, in source.
|
|
12
|
+
- **H3.** Logging/emitting any PHI element, full SSN/government ID (see [[data-classification.domain]]).
|
|
13
|
+
- **H4.** Storing patient data (names, MRNs, DOBs, diagnoses, meds, labs, imaging) as free text when a coded vocabulary applies (see [[terminology]]).
|
|
14
|
+
- **H5.** A second FHIR write path bypassing the canonical aggregate (see [[fhir]]).
|
|
15
|
+
- **H6.** Storing/transmitting PHI to any non-production environment (see [[hipaa]]).
|
|
16
|
+
- **H7.** FHIR errors not using `OperationOutcome` with HTTP 422 (see [[fhir]]).
|
|
17
|
+
|
|
18
|
+
## Quality gates — extend [[coding-standards]]
|
|
19
|
+
- **HG1.** FHIR CapabilityStatement regenerates cleanly; diff reviewed (see [[fhir]]).
|
|
20
|
+
- **HG2.** FHIR validator passes for every modified resource/profile/example.
|
|
21
|
+
- **HG3.** Grep: no PHI string literals in tests outside sanctioned fixtures; no MediatR/AutoMapper.
|
|
22
|
+
- **HG4.** PHI-logging analyzer passes — no Patient/Encounter/Observation/MedicationRequest field logged except the ID (see [[data-classification.domain]]).
|
|
23
|
+
- **HG5.** Security-reviewer sign-off for any PHI-access change.
|
|
24
|
+
|
|
25
|
+
## Related
|
|
26
|
+
- [[coding-standards]] · [[terminology]] · [[fhir]] · [[hipaa]] · [[consent]] · [[data-classification.domain]] · [[persistence.domain]]
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Healthcare Domain — Command → Rule-File Map
|
|
2
|
+
|
|
3
|
+
Per-AW-Spec-command list of the **healthcare domain** rule files in this folder.
|
|
4
|
+
Technology standards already auto-load inside each command; the files below are the
|
|
5
|
+
domain-specific ones to load **in addition** for a healthcare project.
|
|
6
|
+
|
|
7
|
+
- All paths are workspace-relative and live in this folder: `docs/domainspecs/healthcare/`.
|
|
8
|
+
- A skill can read this file and load every path under the matching command heading.
|
|
9
|
+
- This file is the **canonical source** for the healthcare domain mapping;
|
|
10
|
+
`/aw-spec-select-domain` selects this folder as active.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## /aw-spec-constitution
|
|
15
|
+
- docs/domainspecs/healthcare/domain-requirements.md
|
|
16
|
+
- docs/domainspecs/healthcare/ai-rules.domain.md
|
|
17
|
+
|
|
18
|
+
## /aw-spec-specify
|
|
19
|
+
- docs/domainspecs/healthcare/domain-requirements.md
|
|
20
|
+
- docs/domainspecs/healthcare/clinical-terms.md
|
|
21
|
+
- docs/domainspecs/healthcare/integration-terms.md
|
|
22
|
+
- docs/domainspecs/healthcare/domain-driven-design.domain.md
|
|
23
|
+
- docs/domainspecs/healthcare/fhir.md
|
|
24
|
+
- docs/domainspecs/healthcare/hl7.md
|
|
25
|
+
- docs/domainspecs/healthcare/dicom.md
|
|
26
|
+
- docs/domainspecs/healthcare/terminology.md
|
|
27
|
+
- docs/domainspecs/healthcare/hipaa.md
|
|
28
|
+
- docs/domainspecs/healthcare/consent.md
|
|
29
|
+
- docs/domainspecs/healthcare/data-classification.domain.md
|
|
30
|
+
- docs/domainspecs/healthcare/ai-rules.domain.md
|
|
31
|
+
|
|
32
|
+
## /aw-spec-clarify
|
|
33
|
+
- docs/domainspecs/healthcare/domain-driven-design.domain.md
|
|
34
|
+
- docs/domainspecs/healthcare/hl7.md
|
|
35
|
+
- docs/domainspecs/healthcare/hipaa.md
|
|
36
|
+
- docs/domainspecs/healthcare/consent.md
|
|
37
|
+
- docs/domainspecs/healthcare/clinical-terms.md
|
|
38
|
+
- docs/domainspecs/healthcare/integration-terms.md
|
|
39
|
+
|
|
40
|
+
## /aw-spec-plan
|
|
41
|
+
- docs/domainspecs/healthcare/folder-structure.domain.md
|
|
42
|
+
- docs/domainspecs/healthcare/cqrs.domain.md
|
|
43
|
+
- docs/domainspecs/healthcare/vertical-slices.domain.md
|
|
44
|
+
- docs/domainspecs/healthcare/persistence.domain.md
|
|
45
|
+
- docs/domainspecs/healthcare/testing.domain.md
|
|
46
|
+
- docs/domainspecs/healthcare/eventing.domain.md
|
|
47
|
+
- docs/domainspecs/healthcare/domain-driven-design.domain.md
|
|
48
|
+
- docs/domainspecs/healthcare/fhir.md
|
|
49
|
+
- docs/domainspecs/healthcare/hl7.md
|
|
50
|
+
- docs/domainspecs/healthcare/dicom.md
|
|
51
|
+
- docs/domainspecs/healthcare/terminology.md
|
|
52
|
+
- docs/domainspecs/healthcare/hipaa.md
|
|
53
|
+
- docs/domainspecs/healthcare/consent.md
|
|
54
|
+
- docs/domainspecs/healthcare/zero-trust.domain.md
|
|
55
|
+
- docs/domainspecs/healthcare/authorization.domain.md
|
|
56
|
+
- docs/domainspecs/healthcare/auditing.domain.md
|
|
57
|
+
- docs/domainspecs/healthcare/data-classification.domain.md
|
|
58
|
+
- docs/domainspecs/healthcare/coding-standards.domain.md
|
|
59
|
+
- docs/domainspecs/healthcare/dependency-policy.domain.md
|
|
60
|
+
- docs/domainspecs/healthcare/api-versioning.domain.md
|
|
61
|
+
- docs/domainspecs/healthcare/ai-rules.domain.md
|
|
62
|
+
|
|
63
|
+
## /aw-spec-tasks
|
|
64
|
+
- docs/domainspecs/healthcare/folder-structure.domain.md
|
|
65
|
+
- docs/domainspecs/healthcare/vertical-slices.domain.md
|
|
66
|
+
- docs/domainspecs/healthcare/cqrs.domain.md
|
|
67
|
+
- docs/domainspecs/healthcare/persistence.domain.md
|
|
68
|
+
- docs/domainspecs/healthcare/testing.domain.md
|
|
69
|
+
- docs/domainspecs/healthcare/eventing.domain.md
|
|
70
|
+
- docs/domainspecs/healthcare/domain-driven-design.domain.md
|
|
71
|
+
- docs/domainspecs/healthcare/fhir.md
|
|
72
|
+
- docs/domainspecs/healthcare/hl7.md
|
|
73
|
+
- docs/domainspecs/healthcare/authorization.domain.md
|
|
74
|
+
- docs/domainspecs/healthcare/auditing.domain.md
|
|
75
|
+
- docs/domainspecs/healthcare/coding-standards.domain.md
|
|
76
|
+
- docs/domainspecs/healthcare/ai-rules.domain.md
|
|
77
|
+
|
|
78
|
+
## /aw-spec-analyze
|
|
79
|
+
- docs/domainspecs/healthcare/hl7.md
|
|
80
|
+
- docs/domainspecs/healthcare/hipaa.md
|
|
81
|
+
- docs/domainspecs/healthcare/auditing.domain.md
|
|
82
|
+
- docs/domainspecs/healthcare/coding-standards.domain.md
|
|
83
|
+
- docs/domainspecs/healthcare/ai-rules.domain.md
|
|
84
|
+
|
|
85
|
+
## /aw-spec-implement
|
|
86
|
+
- docs/domainspecs/healthcare/folder-structure.domain.md
|
|
87
|
+
- docs/domainspecs/healthcare/vertical-slices.domain.md
|
|
88
|
+
- docs/domainspecs/healthcare/cqrs.domain.md
|
|
89
|
+
- docs/domainspecs/healthcare/persistence.domain.md
|
|
90
|
+
- docs/domainspecs/healthcare/testing.domain.md
|
|
91
|
+
- docs/domainspecs/healthcare/eventing.domain.md
|
|
92
|
+
- docs/domainspecs/healthcare/domain-driven-design.domain.md
|
|
93
|
+
- docs/domainspecs/healthcare/fhir.md
|
|
94
|
+
- docs/domainspecs/healthcare/hl7.md
|
|
95
|
+
- docs/domainspecs/healthcare/terminology.md
|
|
96
|
+
- docs/domainspecs/healthcare/hipaa.md
|
|
97
|
+
- docs/domainspecs/healthcare/consent.md
|
|
98
|
+
- docs/domainspecs/healthcare/authorization.domain.md
|
|
99
|
+
- docs/domainspecs/healthcare/auditing.domain.md
|
|
100
|
+
- docs/domainspecs/healthcare/data-classification.domain.md
|
|
101
|
+
- docs/domainspecs/healthcare/zero-trust.domain.md
|
|
102
|
+
- docs/domainspecs/healthcare/coding-standards.domain.md
|
|
103
|
+
- docs/domainspecs/healthcare/dependency-policy.domain.md
|
|
104
|
+
- docs/domainspecs/healthcare/api-versioning.domain.md
|
|
105
|
+
- docs/domainspecs/healthcare/ai-rules.domain.md
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Quick reference (command → file count)
|
|
110
|
+
|
|
111
|
+
| Command | Domain rule files |
|
|
112
|
+
|---|---|
|
|
113
|
+
| /aw-spec-constitution | 2 |
|
|
114
|
+
| /aw-spec-specify | 12 |
|
|
115
|
+
| /aw-spec-clarify | 6 |
|
|
116
|
+
| /aw-spec-plan | 21 |
|
|
117
|
+
| /aw-spec-tasks | 13 |
|
|
118
|
+
| /aw-spec-analyze | 5 |
|
|
119
|
+
| /aw-spec-implement | 20 |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Consent Standards
|
|
2
|
+
|
|
3
|
+
> NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## First-class aggregate
|
|
6
|
+
- Consent is a **first-class aggregate** (Patients module). A **withdrawn consent MUST block downstream PHI disclosure** for the purpose-of-use **immediately**; state changes emit `ConsentChangedEvent` (see [[eventing]]).
|
|
7
|
+
- The access-control pipeline **MUST check consent before releasing PHI** outside the treating-provider context. Denial surfaces as `ConsentDeniedException` from the Domain (see [[domain-driven-design.domain]], [[authorization.domain]]).
|
|
8
|
+
|
|
9
|
+
## Break-the-glass
|
|
10
|
+
- Explicit **emergency-access command**: documented reason + high-priority audit + real-time alert; audit-mandatory (see [[auditing.domain]]).
|
|
11
|
+
|
|
12
|
+
## Restriction-of-processing
|
|
13
|
+
- GDPR restriction (Art. 18) + erasure (Art. 17) are first-class audited commands. Where law forbids erasing medical records, **restriction-of-processing is the fallback** (see [[hipaa]], [[persistence.domain]]).
|
|
14
|
+
|
|
15
|
+
## FHIR mapping
|
|
16
|
+
- **BPPC** + **FHIR Consent** profiles honored; Consent projects to the FHIR `Consent` resource (see [[fhir]]).
|
|
17
|
+
|
|
18
|
+
## Related
|
|
19
|
+
- [[hipaa]] · [[authorization.domain]] · [[auditing.domain]] · [[fhir]] · [[domain-driven-design.domain]]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# CQRS — Healthcare Domain Addenda
|
|
2
|
+
|
|
3
|
+
> Technology base: [[cqrs]]. Commands: `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## Pipeline
|
|
6
|
+
- Append a **PHI-access-audit behavior** to the mediator pipeline (beyond generic logging + FluentValidation): emit an audit record for every command/query touching PHI (see [[auditing.domain]]).
|
|
7
|
+
|
|
8
|
+
## Error codes
|
|
9
|
+
Dot-namespaced slugs (see [[cqrs]]). Examples: `patient.not_found` · `claim.duplicate_submission` · `consent.denied` · `concurrency.conflict`.
|
|
10
|
+
|
|
11
|
+
## Related
|
|
12
|
+
- [[cqrs]] · [[auditing.domain]] · [[hipaa]] · [[domain-driven-design.domain]]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Data Classification — Healthcare Domain Addenda
|
|
2
|
+
|
|
3
|
+
> Technology base: [[data-classification]]. NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## Categories
|
|
6
|
+
| Class | Extra rules |
|
|
7
|
+
|---|---|
|
|
8
|
+
| **PHI** (clinical, demographic, identifiers) | Minimum-necessary; audited; encrypted |
|
|
9
|
+
| **PII** (non-clinical identifiers) | Encrypted; minimum-necessary |
|
|
10
|
+
| **PCI** (payment) | **Out of scope** — route to a PCI-DSS processor |
|
|
11
|
+
| **Behavioral Health** (42 CFR Part 2) | Extra-sensitive; field-level encryption |
|
|
12
|
+
| **Genetic** (GINA) | Extra-sensitive |
|
|
13
|
+
| **Pediatric** (minors) | Extended retention; heightened protection |
|
|
14
|
+
|
|
15
|
+
## Field-level encryption (required)
|
|
16
|
+
SSN, government IDs, payment-card data, behavioral-health flags (see [[hipaa]], [[persistence.domain]]).
|
|
17
|
+
|
|
18
|
+
## Logging
|
|
19
|
+
- **NEVER** log/emit any PHI element, full SSN, government ID, or full payment-card data.
|
|
20
|
+
- PHI-logging analyzer (CI gate): no Patient/Encounter/Observation/MedicationRequest field logged except the ID (see [[coding-standards.domain]]).
|
|
21
|
+
|
|
22
|
+
## Export
|
|
23
|
+
- Analytics/research/non-prod exports MUST pass **Safe-Harbor or Expert-Determination** de-identification.
|
|
24
|
+
- **Production PHI in non-production is FORBIDDEN** (see [[hipaa]], [[testing.domain]]).
|
|
25
|
+
- Bulk `$export` gated by authorization + de-identification (see [[fhir]]).
|
|
26
|
+
|
|
27
|
+
## Related
|
|
28
|
+
- [[data-classification]] · [[hipaa]] · [[auditing.domain]] · [[authorization.domain]] · [[persistence.domain]] · [[coding-standards.domain]]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Dependency Policy — Healthcare Domain Addenda
|
|
2
|
+
|
|
3
|
+
> Technology base: [[dependency-policy]]. Commands: `/aw-spec-plan`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## Reviews & libraries
|
|
6
|
+
- Every new dependency gets a **HIPAA-suitability** review beyond the generic license/supply-chain check — e.g. reject a logging package that ships analytics by default (PHI-exfiltration risk) (see [[hipaa]], [[data-classification.domain]]).
|
|
7
|
+
- FHIR: the **official FHIR .NET SDK**, version-matched to the endpoint (R4/R5; see [[fhir]]).
|
|
8
|
+
- HL7 v2 / DICOM libraries are added **only** on explicit developer request — no AI-introduced healthcare-protocol dependencies (see [[hl7]], [[dicom]], [[ai-rules.domain]]).
|
|
9
|
+
|
|
10
|
+
## Related
|
|
11
|
+
- [[dependency-policy]] · [[fhir]] · [[hl7]] · [[dicom]] · [[hipaa]] · [[ai-rules.domain]]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# DICOM Standards
|
|
2
|
+
|
|
3
|
+
> Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## DICOMweb façade
|
|
6
|
+
- Supported via a **DICOMweb façade** — **QIDO-RS** (query), **WADO-RS** (retrieve), **STOW-RS** (store) — fronting a separately deployed PACS/VNA. Adapters live in `{Module}/Interop/Dicom/` (Radiology only).
|
|
7
|
+
- The PACS/VNA endpoint is an Aspire resource referenced via `.WithReference(...)`; hosts/ports discovered through Aspire, never hard-coded.
|
|
8
|
+
|
|
9
|
+
## Metadata only
|
|
10
|
+
- **Only DICOM METADATA is persisted here** — pixel data lives in the PACS/VNA, referenced by study/series/instance UIDs.
|
|
11
|
+
- Radiology aggregates: `ImagingOrder`, `ImagingStudy` (metadata), `DiagnosticReport`; results surface via FHIR projections (`ImagingStudy`, `DiagnosticReport`; see [[fhir]]).
|
|
12
|
+
- Trace context propagates across DICOM outbound calls (see [[auditing]]).
|
|
13
|
+
|
|
14
|
+
## Related
|
|
15
|
+
- [[fhir]] · [[integration-terms]] · [[domain-driven-design]]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Domain-Driven Design — Healthcare Domain Model
|
|
2
|
+
|
|
3
|
+
> Technology base: [[domain-driven-design]]. NON-NEGOTIABLE. Commands: `/aw-spec-specify`, `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-implement`.
|
|
4
|
+
|
|
5
|
+
## Modeling
|
|
6
|
+
- Use the clinical/interop ubiquitous language (see [[clinical-terms]], [[integration-terms]]).
|
|
7
|
+
- FHIR-aligned, but **FHIR resources are projections, not the system of record** (see [[fhir]]).
|
|
8
|
+
- Coded concepts use industry terminologies, never free text (see [[terminology]]); coded value objects follow the FHIR pattern (`Codeable`, `Coding`, `Quantity`, `Period`, `Range`, `Ratio`, `Identifier`, `HumanName`, `Address`, `ContactPoint`).
|
|
9
|
+
- Domain may throw `ConsentDeniedException` beyond generic Domain exceptions (see [[consent]]).
|
|
10
|
+
|
|
11
|
+
## Aggregates & invariants
|
|
12
|
+
- **Patient** — MRN unique per tenant; DOB <= today; merge only via `MergePatientsCommand` preserving audit; minimum-necessary projection by role/scope.
|
|
13
|
+
- **Consent** — withdrawal blocks downstream PHI disclosure for the purpose-of-use immediately; emits `ConsentChangedEvent` (see [[consent]]).
|
|
14
|
+
- **Appointment** — no overlap with a booked slot for the same Practitioner/Resource; no past booking; late cancellation (< N hrs) emits `LateCancellationEvent`.
|
|
15
|
+
- **Encounter** — not Closed/Discharged while any open Order/Result/ChargeItem/unsigned ClinicalNote exists; admission requires active Coverage or documented self-pay.
|
|
16
|
+
- **ClinicalNote** — Signed = immutable; addendum is a new linked note; deletion forbidden (supersede via Amend).
|
|
17
|
+
- **MedicationRequest** — dispense forbidden on active allergy match, lethal interaction, or pediatric/renal contraindication without a documented override (prescriber, reason, timestamp).
|
|
18
|
+
- **ControlledSubstanceLedger** — every dispense/waste must balance; append-only; daily reconciliation.
|
|
19
|
+
- **LabOrder/ImagingOrder** — not Cancellable once a Specimen/Image is acquired; transition to Aborted with a reason.
|
|
20
|
+
- **Claim** — total billed = sum(ChargeItem.amount); resubmission needs a new ClaimVersion; none after final adjudication unless an Appeal is opened.
|
|
21
|
+
- **InventoryItem** — stock <= 0 forbidden; dispensing an expired Lot rejected; near-expiry emits `ExpiryAlertEvent`.
|
|
22
|
+
- **AuditRecord** — append-only; no update/delete; retention >= 6 years (see [[auditing.domain]]).
|
|
23
|
+
|
|
24
|
+
## AI guidance
|
|
25
|
+
See [[ai-rules.domain]] — confirm signatures, use the official FHIR SDK, never invent codes, mask PHI.
|
|
26
|
+
|
|
27
|
+
## Related
|
|
28
|
+
- [[domain-driven-design]] · [[fhir]] · [[terminology]] · [[consent]] · [[clinical-terms]] · [[integration-terms]] · [[auditing.domain]] · [[persistence.domain]] · [[ai-rules.domain]]
|