Domain Event
Command
Aggregate
Policy
Ext. System
Read Model
Hotspot
Fluxo 1 — Onboarding de Membro
Gatilho
ext. systemMédico Prescritor
commandSubmit Medical Record
aggregateMember
eventMedical Record Submitted
Consentimento
policy→ Request Consent
commandRecord Consent
aggregateMember
eventConsent Recorded
eventMember Activated
Hotspots
hotspotReceita digital vs papel?
hotspotValidade prescrição: 30 dias?
hotspotMenores de idade?
Fluxo 2 — Ciclo de Cultivo
Início
commandStart Cultivation Batch
aggregateCultivation Batch
eventCultivation Batch Started
commandRegister Plant
eventPlant Registered
Stage Loop
commandAdvance Plant Stage
aggregatePlant
eventPlant Stage Advanced
commandDestroy Plant
eventPlant Destroyed
Colheita
commandRecord Harvest
aggregateCultivation Batch
eventHarvest Recorded
Policy →
policy→ Create Processing Run
policy→ CPC 29 Valuation
Fluxo 3 — Processamento & Laboratório
Processamento
commandCreate Processing Run
aggregateHarvest Batch
eventProcessing Run Completed
Laboratório
commandSubmit Lab Sample
ext. systemLaboratório Analítico
eventLab Sample Submitted
commandApprove Lab Sample
commandReject Lab Sample
eventLab Sample Approved
eventLab Sample Rejected
Fluxo 4 — Inventário
Lote
policy→ Quarantine Lot
aggregateInventory Lot
eventLot Quarantined
commandRelease Lot
read modelCOA Aprovado?
eventLot Released
Fluxo 5 — Dispensação
Verificações
read modelMember Quota
read modelValid Prescription
read modelAvailable Lots
commandRecord Dispensation
aggregateDispensation
eventDispensation Recorded
SNGPC
policy→ Sync vs Async
eventSNGPC XML Generated
ext. systemANVISA SNGPC API
eventSNGPC XML Sent ✓
eventSNGPC XML Failed ✗
Fluxo 6 — Compliance & Relatórios
Calendário
policy→ Generate KPI Report
policy→ BSPO Trimestral
policy→ BSPO Anual
aggregateCompliance Report
eventKPI Report Generated
eventBSPO Generated
eventDRE Generated
Fluxo 7 — LGPD: Anonimização de Membro
Requisição
commandRequest Anonymization
read modelDispensações Pendentes?
commandExecute Crypto Deletion
aggregateMember
eventMember Anonymized
Policy →
policy→ LGPD Compliance Entry
policy→ Audit Entry Preserved