1IntroductionRIMResistance is Futile, you Will be Assimilated!
2Introduction DDD and Event Sourcing George de la Torre Developer of custom clinical appsFor a long timeDiscovered RIM a long time ago…Oleg Sitalo (silent partner)Developer of custom clinical appsFor a long time togetherBelieves in RIM, at occasions…
3Agenda DDD and Event Sourcing Google will find heaps of stuff on this Will focus on the RIM stuffGreat resources for DDD/ESImplementing Doman-Driven DesignVaughn VernonDomain Driven Design (the Blue Book)Eric Evans
4Domain Driven Design DDD and Event Sourcing Object Oriented Model Business needs & language capturedHL7 v3 RIM benefitsDesign done! – the hardest partStandard – open & shared to allDeep insights into domain knowledgeIntegration of domains built in (No barriers!)Reuse logic across clinical domains
5Domain Model Blueprint for all Aggregates HL7 V3 RIM
7Supporting Domains External Services Anti Corruption LayerOther systems or Big Ball of Mud…Business Process and Rules EnginesPoint: This layer keeps RIM pure!
8Event Sourcing DDD and Event Sourcing Only the Aggregate (D-MIM) is persistedThe command is saved (Behavior)Aggregates publishes the eventsCommand Query Responsibility Segregation (CQRS)Command (Transaction) ModelQuery Model
9Patient Dashboard Example Use Case Schedule a patient visitFind Patient (Query Model)View Calendar (Query Model)Patient assigned time slot (Command)CreateAppointmentCommand(data) executesScheduling aggregate is created from dataThe created aggregate is appendedPublishes event to update Query Model
12Considerations Scheduling Aggregate Entity is usually the Root No cloning, only class codesAggregates varies with the RIM setAct may be the Root (Strategy)Reference others Aggregates (Observations)Act Mood partitioningPHI segregation requirement (Query model too)Performance
13Considerations continued… Scheduling AggregateConsiderations continued…Serialized, XML, JSON, etc…Relational Database (SQL)Cache based systemsFile systemsNoSQLNatural for event storesEasier to query Aggregates if neededAggregates loaded for logic on command
18Patient Dashboard Example Two Separate Models (CQRS) Domain (Transaction) ModelComplex structure (RIM)Aggregates are only created from RIMAggregates are appended (Write Only)Query ModelSimplified model structure (SQL)Multiple models created as neededModel optimized for querying (Read Only)