Presentation on theme: "Domain Driven Design and Event Sourcing with RIM."— Presentation transcript:
Domain Driven Design and Event Sourcing with RIM
Introduction 1 RIMResistance is Futile, you Will be Assimilated!
DDD and Event Sourcing 2 Introduction – George de la Torre Developer of custom clinical apps For a long time Discovered RIM a long time ago… – Oleg Sitalo (silent partner) Developer of custom clinical apps For a long time together Believes in RIM, at occasions…
DDD and Event Sourcing 3 Agenda – Google will find heaps of stuff on this – Will focus on the RIM stuff – Great resources for DDD/ES us/library/jj aspx us/library/jj aspx Implementing Doman-Driven Design – Vaughn Vernon Domain Driven Design (the Blue Book) – Eric Evans
DDD and Event Sourcing 4 Domain Driven Design – Object Oriented Model – Business needs & language captured – HL7 v3 RIM benefits Design done! – the hardest part Standard – open & shared to all Deep insights into domain knowledge Integration of domains built in (No barriers!) Reuse logic across clinical domains
Domain Model Blueprint for all Aggregates 5 HL7 V3 RIM
7 Supporting Domains External Services Other systems or Big Ball of Mud… Anti Corruption Layer Business Process and Rules Engines Point: This layer keeps RIM pure!
DDD and Event Sourcing 8 Event Sourcing – Only the Aggregate (D-MIM) is persisted – The command is saved (Behavior) – Aggregates publishes the events – Command Query Responsibility Segregation (CQRS) Command (Transaction) Model Query Model
Patient Dashboard Example Use Case 9 Schedule a patient visit – Find Patient (Query Model) – View Calendar (Query Model) – Patient assigned time slot (Command) – CreateAppointmentCommand(data) executes Scheduling aggregate is created from data The created aggregate is appended Publishes event to update Query Model
10 Scheduling Aggregate Example
11 Scheduling Aggregate CMET (PAT) is the Root
12 Scheduling Aggregate Considerations – Entity is usually the Root – No cloning, only class codes – Aggregates varies with the RIM set – Act may be the Root (Strategy) Reference others Aggregates (Observations) Act Mood partitioning PHI segregation requirement (Query model too) Performance
13 Scheduling Aggregate Considerations continued… – Serialized, XML, JSON, etc… – Relational Database (SQL) – Cache based systems – File systems – NoSQL Natural for event stores Easier to query Aggregates if needed Aggregates loaded for logic on command
Patient Dashboard Example Two Separate Models (CQRS) 18 Domain (Transaction) Model – Complex structure (RIM) – Aggregates are only created from RIM – Aggregates are appended (Write Only) Query Model – Simplified model structure (SQL) – Multiple models created as needed – Model optimized for querying (Read Only)
Simple Component Design CQRS 19 Web Dashboard Web Dashboard View Model Aggregate Services App Services Publishes to Commands Query Events SQL