Skip to content

Commit 7d81a01

Browse files
committed
docs: reflect schema-driven completeness engine delivery
1 parent df38cf7 commit 7d81a01

File tree

4 files changed

+78
-30
lines changed

4 files changed

+78
-30
lines changed

docs/architecture/components/apps/product-management-consistency-validation.md

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
**Path**: `apps/product-management-consistency-validation/`
44
**Domain**: Product Management
5-
**Purpose**: Validate catalog completeness and consistency
5+
**Purpose**: Evaluate schema-driven catalog completeness and publish enrichment triggers for missing enrichable attributes
66

77
## Overview
88

9-
Checks product data for missing fields, invalid pricing, and incomplete media.
9+
Implements a schema-driven Completeness Engine that:
10+
- evaluates products against category field definitions,
11+
- computes weighted completeness scores,
12+
- stores gap reports,
13+
- triggers enrichment workflows for enrichable gaps below threshold.
1014

1115
## Architecture
1216

@@ -15,7 +19,11 @@ graph LR
1519
Client[Validation Request] -->|POST /invoke| API[FastAPI App]
1620
API --> Agent[Consistency Agent]
1721
Agent --> Products[Product Adapter]
18-
Agent --> Validator[Consistency Rules]
22+
Agent --> Validator[Legacy Validator]
23+
EH[Event Hub completeness-jobs] --> Consumer[Completeness Event Consumer]
24+
Consumer --> Engine[Completeness Engine]
25+
Engine --> Cosmos[Completeness Storage]
26+
Engine --> EH2[Event Hub enrichment-jobs]
1927
```
2028

2129
## Components
@@ -34,28 +42,50 @@ graph LR
3442

3543
Orchestrates:
3644
- Product retrieval
37-
- Consistency validation
45+
- Legacy consistency validation (`/invoke` flow)
46+
47+
### 3. Completeness Engine (`completeness_engine.py`)
48+
49+
Provides:
50+
- `CategorySchema`, `FieldDefinition`, `FieldGap`, `GapReport`
51+
- weighted completeness score computation
52+
- nested dot-path field evaluation
53+
- enrichable gap extraction
54+
55+
### 4. Completeness Event Consumer (`event_consumer.py`)
56+
57+
Consumes `completeness-jobs` and executes:
58+
- load product
59+
- load category schema
60+
- evaluate completeness
61+
- persist gap report
62+
- publish `enrichment_requested` to `enrichment-jobs` when score is below `COMPLETENESS_THRESHOLD`
3863

3964
**Current Status**: ✅ **IMPLEMENTED (mock adapters)**
4065

41-
### 3. Adapters
66+
### 5. Adapters
4267

4368
**Product Adapter**: Catalog product retrieval
44-
**Validator**: Completeness rules
69+
**Validator**: Legacy consistency rules
70+
**Completeness Storage**: Cosmos-backed schema/gap-report adapter with in-memory fallback
4571

46-
**Current Status**: ⚠️ **PARTIAL**Mock adapters return deterministic data
72+
**Current Status**: **IMPLEMENTED**Completeness engine pipeline is active; storage supports local in-memory fallback for tests/dev
4773

4874
## What's Implemented
4975

5076
✅ MCP tool registration
51-
✅ Consistency validation agent orchestration
77+
✅ Legacy consistency validation agent orchestration
78+
✅ Schema-driven completeness scoring pipeline
79+
✅ Completeness Event Hub consumer (`completeness-jobs`)
80+
✅ Enrichment trigger publishing (`enrichment-jobs`)
81+
✅ Cosmos/in-memory completeness storage adapter
82+
✅ Unit + integration tests for completeness engine and event flow
5283
✅ Dockerfile + Bicep module
5384

5485
## What's NOT Implemented
5586

56-
❌ Real product integrations
57-
❌ Foundry model integration for remediation guidance
58-
❌ Observability dashboards for data quality
87+
❌ Dedicated remediation model orchestration (currently only trigger publication)
88+
❌ Dedicated observability dashboards for completeness quality trends
5989

6090
## Operational Playbooks
6191

docs/implementation/truth-layer-api.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document describes currently available truth-layer endpoints and planned se
66

77
- Implemented services in the current repo/deployment topology:
88
- `truth-ingestion` (custom REST ingestion routes + standard service endpoints)
9-
- `product-management-consistency-validation` (completeness checks via `/invoke`)
9+
- `product-management-consistency-validation` (legacy `/invoke` + event-driven completeness engine)
1010
- `ecommerce-product-detail-enrichment` (enrichment via `/invoke`)
1111
- `product-management-acp-transformation` (ACP export via `/invoke`)
1212
- `crud-service` (transactional APIs, including review endpoints used as interim review flow)
@@ -83,7 +83,24 @@ Base URL: `http://<consistency-host>`
8383
| --- | --- | --- |
8484
| GET | `/health` | Liveness |
8585
| GET | `/ready` | Readiness |
86-
| POST | `/invoke` | Validate SKU consistency/completeness |
86+
| POST | `/invoke` | Legacy consistency/completeness validation |
87+
88+
### Event-driven completeness flow (implemented)
89+
90+
- **Consumes**: Event Hub topic `completeness-jobs` (consumer group: `completeness-engine`)
91+
- **Loads**: product + category schema
92+
- **Evaluates**: weighted completeness score and field-level gaps
93+
- **Stores**: gap report via completeness storage adapter (Cosmos-backed with local/test fallback)
94+
- **Publishes**: `enrichment_requested` to `enrichment-jobs` when:
95+
- completeness score `< COMPLETENESS_THRESHOLD` (default `0.7`)
96+
- enrichable gaps are present
97+
98+
### Completeness report model highlights
99+
100+
- `entity_id`, `category_id`, `schema_version`
101+
- `completeness_score` (`0.0``1.0`)
102+
- `gaps[]` with gap type (`missing` / `invalid`)
103+
- `enrichable_gaps[]`
87104

88105
### Example request: `POST /invoke` (completeness)
89106

docs/project-status.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Remaining quality issues to address.
130130
| [#94](https://github.com/Azure-Samples/holiday-peak-hub/issues/94) | Phase 1: Event Hub helpers | 1 | PR #150 (Draft) |
131131
| [#96](https://github.com/Azure-Samples/holiday-peak-hub/issues/96) | Phase 2: Generic REST PIM connector | 2 | PR #151 (Draft) |
132132
| [#98](https://github.com/Azure-Samples/holiday-peak-hub/issues/98) | Phase 2: Truth Ingestion service | 2 | ✅ Closed (PR #146) |
133-
| [#99](https://github.com/Azure-Samples/holiday-peak-hub/issues/99) | Phase 2: Completeness Engine refactor | 2 | Open |
133+
| [#99](https://github.com/Azure-Samples/holiday-peak-hub/issues/99) | Phase 2: Completeness Engine refactor | 2 | ✅ Closed (PR #123) |
134134
| [#101](https://github.com/Azure-Samples/holiday-peak-hub/issues/101) | Phase 3: Truth Enrichment service | 3 | PR #125 (Draft) |
135135
| [#102](https://github.com/Azure-Samples/holiday-peak-hub/issues/102) | Phase 3: Truth HITL service (Human-in-the-Loop) | 3 |
136136
| [#103](https://github.com/Azure-Samples/holiday-peak-hub/issues/103) | Phase 3: HITL Staff Review UI pages | 3 |

docs/roadmap/012-product-truth-layer-plan.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The spec defines a **deployable reference implementation** for retailers to inge
8484
| Connector contracts | `PIMConnectorBase`, `DAMConnectorBase` + 7 other ABCs in `integrations/contracts.py` | **Good** — Need concrete implementations |
8585
| Connector registry | `ConnectorRegistry` in `integrations/registry.py` | **Good** — Runtime registry with health monitoring |
8686
| App factory | `build_service_app()` in `app_factory.py` | **Strong** — Standard service bootstrap |
87-
| Consistency validation | `product-management-consistency-validation` agent | **Weak**Only checks 4 fields (name, price sign, currency, image); no completeness scoring |
87+
| Consistency validation | `product-management-consistency-validation` agent | **Implemented**Schema-driven completeness scoring, gap reporting, and enrichment trigger integration (PR #123) |
8888
| Product enrichment | `ecommerce-product-detail-enrichment` agent | **Wrong target** — Enriches PDP display, not PIM attributes |
8989
| Product schemas | `CatalogProduct`, `ProductContext` in `schemas/product.py` | **Partial** — Missing style/variant split, provenance, share policy |
9090
| IaC | Full Bicep stack: AKS, ACR, Cosmos DB, Event Hubs, Redis, Storage, APIM, Key Vault, App Insights, VNet, AI Foundry | **Strong** — All infra provisioned; Cosmos containers empty, Service Bus absent |
@@ -120,7 +120,7 @@ Latest on `origin/main`: commit `74d56c6` — "Fix APIM routing, postdeploy hook
120120
| G1 | §3.1 Core Data Plane | No Cosmos DB containers for product graph, candidates, schemas, audit. Cosmos container array is `[]` in Bicep. | **CRITICAL** |
121121
| G2 | §7 Data Model | No `ProductStyle`, `ProductVariant`, `TruthAttribute`, `ProposedAttribute` models. Only flat `CatalogProduct`. | **CRITICAL** |
122122
| G3 | §3.1 Ingestion | No ingestion service. PIM/DAM connector ABCs exist but no concrete connectors or scheduled pull. | **CRITICAL** |
123-
| G4 | §3.1 Completeness Engine | No completeness scoring. Existing validation checks 4 fields. No category schema definitions. | **CRITICAL** |
123+
| G4 | §3.1 Completeness Engine | **Resolved in PR #123** — weighted completeness scoring, schema-driven gap analysis, and Event Hub enrichment trigger are implemented. | **CLOSED** |
124124
| G5 | §3.1 Enrichment Orchestrator | No PIM enrichment agent. Existing enrichment targets e-commerce PDP, not product graph. | **CRITICAL** |
125125
| G6 | §3.1 HITL Workflow | Zero implementation. No approval endpoints, no review queue, no UI. | **CRITICAL** |
126126
| G7 | §8 Category Schemas | No `/schemas/` directory. No category-level required attributes or validation rules. | **CRITICAL** |
@@ -186,20 +186,21 @@ GapReport — entityId, missingKeys[], invalidKeys[], completenessScore
186186
**Add**: Optional parameter to register truth-layer specific middleware (audit logging, provenance tracking).
187187
**Add**: Truth-layer Event Hub consumer groups and lifespan helpers for job topics.
188188

189-
### 4.7 `apps/product-management-consistency-validation/` — MAJOR REFACTOR
190-
191-
**Current**: Checks 4 fields (name, price, currency, image).
192-
**Target**: Becomes the **Completeness Engine** (§3.1.3, §8). Must:
193-
- Load category schemas from Cosmos `schemas` container
194-
- Compute `missing = required - truthAttributesPresent`
195-
- Compute `invalid = truthAttributesFailValidation`
196-
- Generate `GapReport` with `completenessScore`
197-
- Publish enrichment job events to Event Hub
198-
199-
Keep existing MCP tools and add new ones:
200-
- `/product/completeness/check` — full gap analysis
201-
- `/product/completeness/score` — score-only endpoint
202-
- `/product/completeness/batch` — batch job trigger
189+
### 4.7 `apps/product-management-consistency-validation/` — COMPLETED (PR #123)
190+
191+
Delivered capabilities:
192+
- Added schema-driven completeness engine (`completeness_engine.py`) with:
193+
- weighted scoring (`0.0``1.0`)
194+
- nested field-path evaluation
195+
- per-field gap typing (`missing`, `invalid`)
196+
- enrichable gap extraction
197+
- Added completeness job consumer (`event_consumer.py`) for `completeness-jobs`.
198+
- Added enrichment trigger publishing to `enrichment-jobs` when:
199+
- completeness score is below `COMPLETENESS_THRESHOLD`
200+
- enrichable gaps exist.
201+
- Added Cosmos-backed completeness storage adapter with in-memory fallback for local/test.
202+
- Preserved backward compatibility of existing validator pathways.
203+
- Added unit and integration test coverage for scoring and event flow.
203204

204205
### 4.8 `apps/product-management-acp-transformation/` — EXTEND
205206

0 commit comments

Comments
 (0)