File size: 2,440 Bytes
1504aaa
 
 
 
 
 
 
 
 
 
 
ecd72cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
title: PDC Intelligence
emoji: 🧵
colorFrom: purple
colorTo: blue
sdk: docker
sdk_version: "3.11"
app_port: 7860
pinned: false
---

# PDC Intelligence Prototype (MVP)

This prototype is built under `PDC/` and aligned to the PDC meeting notes and process documents.

## Scope Covered

- Phase-1 focus: greige construction recommendation from finish-side requirements.
- Dashboard for dataset health, coverage, and core relativity metrics.
- Article search with filters and article-level detail.
- Construction calculator with optimistic/expected/pessimistic scenarios.
- Relativity analytics by weave/blend and numeric correlation matrix.
- Feasibility process flow mapping from meeting/process docs.
- Built-in validation report endpoint for ongoing prediction quality checks.

## Folder Layout

- `backend/`: FastAPI APIs and statistical engine.
- `frontend/`: Next.js dashboard and calculator UI.
- `backend/app/data/`: copied data files for runtime.

## Backend Run

```bash
cd backend
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/uvicorn app.main:app --reload --port 8000
```

## Frontend Run

```bash
cd frontend
npm install
npm run dev
```

Frontend rewrites `/api/*` to backend `http://localhost:8000/api/*`.

## One-command Run

From `PDC/`:

```bash
./run_app.sh
```

This script will:

- create backend venv if missing
- install backend dependencies
- run backend tests before startup
- install frontend dependencies
- start backend and frontend together

## Verification Performed

- Unit tests:
  - formula correctness checks
  - prediction response contract checks
  - holdout MAE threshold checks
  - validation report generation checks

Run tests:

```bash
cd backend
.venv/bin/python -m pytest -q
```

Current run: `3 passed`

Validation API:

```bash
GET /api/validation/report?sample_size=250&seed=42
```

Returns MAE, error percentiles, and confidence distribution.

Data source audit API:

```bash
GET /api/data-source/audit
```

Returns source file usage, raw vs used row counts, dataset distribution, and column-level null coverage.

## Predictive Validation Snapshot

On a 300-row holdout sample:

- MAE (Greige EPI): `13.92`
- MAE (Greige PPI): `8.132`
- P90 absolute error (Greige EPI): `33.0`
- P90 absolute error (Greige PPI): `20.0`

These are baseline MVP metrics and can be improved by adding tighter cluster filters (count band, loom, weave aliases) and weighted neighbors.