Spensara Spensara Knowledge Base & Documentation Repository

Repository Docs & Knowledge Base

Consolidated Spensara documentation repository (722 Markdown & architecture documents in ../repository)
Built Word Documents (.docx): Spensara Overview (.docx) Capability Assessment (.docx) Brink POS Ingestion Analysis (.docx) The Borg Ingestion Architecture (.docx)

Implementation Specs (157)

Detailed engineering and feature implementation specifications.
implementation-specs/specs/RedshiftSyntheticDataFeed/TASK1.2.md 2,452 bytes · Updated Oct 23, 2026 10:44 AM EDT
Raw File

TASK 1.2: Implement PostgreSQL KDS Source Reader

Summary

Implement the source reader that reads current simulator-generated KDS data from the shared PostgreSQL warehouse.

The reader treats PostgreSQL as the current simulator source only. It must not become the Redshift target abstraction.

Dependencies

  • TASK 1.1 (synthetic feed configuration and service contract)

Files to Create

1. Source reader service

Create a source reader equivalent to:

  • ISyntheticKdsSourceReader
  • SyntheticKdsSourceReader

Exact names may differ.

The reader may use the existing KDSContext because PostgreSQL is the current source of simulator data.

2. Source read models

Create lightweight source DTO/read models if needed to decouple downstream mapping from EF-generated entities.

Recommended logical models:

  • source order row
  • source item row
  • source item bump row
  • source batch/snapshot result

Files to Modify

3. Dependency injection registration

Register the source reader with the feed implementation.

Required Behavior

The source reader must:

  • read kdsdev.orders rows for a configured store_guid,
  • read matching kdsdev.items rows for those orders,
  • read matching kdsdev.item_bumps rows for those items,
  • support full-refresh reads,
  • support incremental reads when a checkpoint is provided,
  • avoid reading unrelated stores,
  • project only columns required by the phase-1 mapping,
  • avoid loading the entire warehouse when a time/checkpoint boundary is provided.

Minimum source tables:

  • kdsdev.orders
  • kdsdev.items
  • kdsdev.item_bumps

Optional:

  • kdsdev.condiments remain out of scope because no phase-1 curated contract consumes them.

Acceptance Criteria

  • [x] Source reader can read orders by store_guid
  • [x] Source reader can read items for selected orders
  • [x] Source reader can read item bump state for selected items
  • [x] Source reader projects only required columns
  • [x] Source reader supports full-refresh source reads
  • [x] Source reader supports an incremental boundary or leaves a clear extension point for TASK 2.2
  • [x] Source reader is used only as source access, not Redshift target access
  • [ ] No Redshift writes are implemented in this task
  • [x] Solution builds without errors

Notes

  • Keep KDSContext as legacy/source access only.
  • Do not remodel the whole PostgreSQL warehouse.
  • Do not add payments, POS, inventory, or customer source reads.