Skip to content
Partner Developer Portal

Definition

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.

FieldDescription
stock_item_idUnique identifier for the stock item.
pack_code_idLocal identifier of the ProScript Connect pack.
stock_levelCurrent quantity of the stock item.
minimum_stockLower threshold used to monitor inventory levels.
maximum_stockUpper threshold used to monitor inventory levels.
pack_priceRegional preparation pack price used for stock valuation and cost context.
dispensed_date_timeTimestamp of the latest qualifying dispense event for the pack.

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.