← Back to project

Scrapbook: Event Model & Pharmacy Domain Design



Date: 2026-02-16T16:30:00Z

Event Schemas



RawChangeEvent: as emitted by Debezium MySQL connector. Fields:


We'll accept this as ingress; we don't need to model it in our code as a struct? Actually we will parse into struct for Go. But canonical strips Debezium specifics.


CanonicalChangeEvent:


BusinessEvent:

Handling Concerns



Pharmacy Domain Schema (simplified)



Tables:


We'll include standard audit fields: `created_at`, `updated_at`, `created_by`, `updated_by` on most tables. These are crucial for traceability.


DDL will be standard MySQL (InnoDB) with foreign keys.

Synthetic Data Generator Plan



We'll write a generator in Go (or Python) that populates the pharmacy schema with realistic data and then generates day-by-day changes.

Initial load:


Daily patterns:

Anomaly injection (to test detection):

The generator will have flags to enable/disable anomaly types and vary intensity.


Generator pseudocode (language‑agnostic):


initialize_schema()
populate_static_data(branches, products, suppliers, roles, users)
set_current_date(start_date)
while current_date <= end_date:
simulate_sales(current_date)
simulate_inventory_adjustments(current_date)
simulate_purchase_orders(current_date)
simulate_user_activity(current_date)
if anomaly_week:
inject_anomalies(current_date)
commit_transaction_for_day()
advance_date()


We'll implement in Go using `github.com/brianvoe/gofakeit` for realistic names and numbers, or custom.

---

This thinking will be refined into Report 3.