openapi: 3.0.3 info: title: Facility Layout Reports API description: > The READ-ONLY analytical surface of the facility-layout "Layout Catalog Growth & Change" data product, served by the separate `cmd/facility-reports` binary over a read-only pool (`default_transaction_read_only=on`) against the analytical database — NOT by the OLTP `cmd/facility` binary documented in apis/openapi.yaml. The report is a projection over this service's own domain events (SiteRegistered, ZoneRegistered, AisleRegistered, LocationTypeRegistered, PlacementRuleDefined, LocationSlotRegistered, LocationSlotDecommissioned, FacilityLayoutImported), delivered on the `warehouse.facility.analytics` topic and applied by `cmd/facility-projector`, the single writer. It is therefore EVENTUALLY CONSISTENT: use GET /reports/catalog-growth/freshness to see how far behind the event stream the read model currently is. The layout is a slow-changing reference catalog, so rows are bucketed by UTC DAY, not by hour. version: "1.0.0" license: name: MIT contact: name: Facility Layout Team url: https://github.com/IQVO/facility-layout servers: - url: http://localhost:8092 description: Local development (cmd/facility-reports, HTTP_ADDR default :8092) tags: - name: reports description: The Layout Catalog Growth & Change analytical read model. - name: health description: Liveness and readiness probes. paths: /healthz: get: tags: [health] operationId: getReportsHealthz summary: Liveness probe description: Reports whether the reports process is up and able to serve requests. responses: "200": description: Service is up content: application/json: schema: $ref: "#/components/schemas/Status" example: status: ok /readyz: get: tags: [health] operationId: getReportsReadyz summary: Readiness probe description: > 200 while the process accepts traffic; 503 once graceful shutdown has begun, so the load balancer stops routing to it before the listener closes. responses: "200": description: Ready to serve content: application/json: schema: $ref: "#/components/schemas/Status" example: status: ready "503": description: Shutting down; not ready content: application/json: schema: $ref: "#/components/schemas/Status" example: status: not_ready /reports/catalog-growth: get: tags: [reports] operationId: getCatalogGrowthReport summary: Layout Catalog Growth report, keyed by scope and UTC day description: > Returns the catalog-growth rows whose day bucket falls in the half-open window [from, to), ordered by day bucket then scope. Rows are bucketed by the BUSINESS time of the underlying event (its CloudEvents `time`), never by ingestion time, so a replayed or late-projected event lands on the day the change actually happened. `scope` is the part of the map a change belongs to: a site code for site- and zone-level changes, a zone id for aisle- and slot-level changes, and the empty string for catalog-wide definitions (location types, placement rules, bulk imports). parameters: - name: from in: query required: true description: Inclusive start of the window, RFC 3339. Compared against each row's day bucket. schema: type: string format: date-time example: "2026-03-01T00:00:00Z" - name: to in: query required: true description: > Exclusive end of the window, RFC 3339. A window whose `to` is not after `from` is not rejected; it simply matches no rows. schema: type: string format: date-time example: "2026-03-08T00:00:00Z" - name: scope in: query required: false description: > Optional exact-match filter on the row scope (a site code or a zone id). Omit it, or send it empty, for every scope including the catalog-wide one. schema: type: string example: WH1 - name: granularity in: query required: false description: Bucket resolution. Only daily buckets are modelled. schema: type: string enum: [day] default: day responses: "200": description: > The report for the requested window. An empty window is a 200 with an empty `rows` array, not a 404. content: application/json: schema: $ref: "#/components/schemas/CatalogGrowthReport" "400": description: The query is malformed or missing a required parameter (`invalid-report-query`). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" "500": description: The report could not be served (`report-store-error`). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" /reports/catalog-growth/freshness: get: tags: [reports] operationId: getCatalogGrowthFreshness summary: How far the read model trails the event stream description: > Returns the age of the most recently projected event: the data product's published freshness signal. A growing lag means the projector is falling behind or has stopped. A lag of 0 on a never-populated read model looks the same as a perfectly fresh one, so read it alongside the report's own counts. responses: "200": description: The current projection lag. content: application/json: schema: $ref: "#/components/schemas/Freshness" "500": description: The freshness signal could not be read (`report-store-error`). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" components: schemas: CatalogGrowthReport: type: object required: [rows] properties: rows: type: array description: > One row per (scope, day bucket), ordered by day bucket then scope. Always present; empty for a window with no data. items: $ref: "#/components/schemas/CatalogGrowthRow" CatalogGrowthRow: type: object required: - scope - dayBucket - sitesRegistered - zonesRegistered - aislesRegistered - locationTypesRegistered - placementRulesDefined - slotsRegistered - slotsDecommissioned - bulkImports - importRowsSubmitted - importRowsImported - importRowsRejected properties: scope: type: string description: > Site code, zone id, or the empty string for catalog-wide definitions. example: WH1 dayBucket: type: string format: date-time description: Start (midnight UTC) of the day this row aggregates. example: "2026-03-01T00:00:00Z" sitesRegistered: type: integer minimum: 0 description: SiteRegistered events in this bucket. example: 1 zonesRegistered: type: integer minimum: 0 description: ZoneRegistered events in this bucket. example: 2 aislesRegistered: type: integer minimum: 0 description: AisleRegistered events in this bucket. example: 4 locationTypesRegistered: type: integer minimum: 0 description: LocationTypeRegistered events in this bucket. example: 0 placementRulesDefined: type: integer minimum: 0 description: PlacementRuleDefined events in this bucket. example: 0 slotsRegistered: type: integer minimum: 0 description: LocationSlotRegistered events in this bucket. example: 120 slotsDecommissioned: type: integer minimum: 0 description: LocationSlotDecommissioned events in this bucket. example: 3 bulkImports: type: integer minimum: 0 description: FacilityLayoutImported events in this bucket. example: 0 importRowsSubmitted: type: integer minimum: 0 description: Rows submitted across this bucket's bulk imports. example: 0 importRowsImported: type: integer minimum: 0 description: Rows imported across this bucket's bulk imports. example: 0 importRowsRejected: type: integer minimum: 0 description: Rows rejected across this bucket's bulk imports. example: 0 Freshness: type: object required: [lagSeconds] properties: lagSeconds: type: number format: double description: > Seconds between now and the business time of the most recently projected event. 0 when the read model is empty. example: 4.2 Status: type: object required: [status] properties: status: type: string example: ok Problem: type: object description: RFC 7807 problem detail, identical in shape to the OLTP API's. required: [type, title, status] properties: type: type: string format: uri description: Stable identifier for the error category. example: https://errors.facility-layout.warehouse-systems.dev/invalid-report-query title: type: string description: Fixed human-readable summary of the error category. example: The report query is malformed or missing a required parameter status: type: integer description: The HTTP status code, repeated in the body. example: 400 detail: type: string description: Human-readable explanation specific to this occurrence. example: "query parameter 'from' is required (RFC3339)" instance: type: string description: The request path this problem occurred on. example: /reports/catalog-growth