Definition
Overview
Section titled “Overview”mart_stock is a stock-item warehouse mart used for inventory and replenishment analytics in Community Pharmacy. It combines stock balances with product-pack, pharmacy, pricing, preparation attributes, and latest dispense context. Duplicate records are filtered from the mart and routed to the quarantine model.
Key Data Fields
Section titled “Key Data Fields”| Field | Description |
|---|---|
| stock_item_id | Unique identifier for the stock item. |
| pack_code_id | Local identifier of the ProScript Connect pack. |
| stock_level | Current quantity of the stock item. |
| minimum_stock | Lower threshold used to monitor inventory levels. |
| maximum_stock | Upper threshold used to monitor inventory levels. |
| pack_price | Regional preparation pack price used for stock valuation and cost context. |
| dispensed_date_time | Timestamp of the latest qualifying dispense event for the pack. |
Source
Section titled “Source”The lineage for this model is: psc stock and dispensing source tables -> stock -> mart_stock.
The upstream stock control model joins stg_stock_item, active_pharmacy, dim_product_pack, stg_pharmacy_pack_region, stg_inventory_count_item, stg_pharmacy_preparation, stg_pharmacy_preparation_region, and dispensing-related staging models to enrich stock items and calculate latest dispense context.
mart_stock is materialized as incremental with merge strategy and unique key (organisation, stock_item_id). Incremental updates are driven by the mart incremental filter and row hash comparison (row_id), so changed or new records are inserted or updated while unchanged rows are skipped.