You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The app only exposes `POST /`(called by Aidbox). Direct `GET`requests will return 404/405 — that's expected.
72
+
The app only exposes `POST /`— that's the HTTP-RPC entry point Aidbox dispatches to. Direct calls to the Flask container with `GET`or any other path return 404/405 — Aidbox is the front door. Users invoke the operation via Aidbox at `Measure/$evaluate-measure` (registered in Step 2), and that endpoint supports both `POST` and `GET`.
72
73
73
74
## Step 2. Register the App resource in Aidbox
74
75
75
-
This tells Aidbox to route `POST /Measure/$evaluate-measure` calls to your sql-evaluate-app.
76
+
This tells Aidbox to route both `POST` and `GET` calls on `Measure/$evaluate-measure` to your sql-evaluate-app. The two are semantically distinct:
77
+
78
+
-**`POST`** runs the measure **and persists** the resulting `MeasureReport` in Aidbox (the `measure-evaluate` operation below).
79
+
-**`GET`** runs the measure and returns the report without persisting it (the `measure-evaluate-get` operation below) — useful for ad-hoc / read-only validation.
76
80
77
81
```bash
78
82
curl -u <admin>:<password> -X PUT \
@@ -116,6 +120,7 @@ One command loads all non-clinical artifacts into your Aidbox:
116
120
- Shared SQL views (8 flat projections over FHIR JSONB)
-**Performance indexes** (~17 btree indexes on JSONB paths used by the measures — without these, measure SQL at scale is 100–1000× slower due to sequential scans)
Population-level report across all your patients (either `POST` or `GET` works the same way):
183
195
184
196
```bash
185
197
curl -u <admin>:<password> -X POST \
@@ -255,6 +267,49 @@ Quickest debug: evaluate for one known-good patient (`?subject=Patient/<id>&repo
255
267
256
268
Re-run `python3 setup.py --skip-clinical` — it's idempotent (`DELETE WHERE valueset_url = X` before INSERT per ValueSet).
257
269
270
+
### `$evaluate-measure` times out or is very slow on a large dataset
271
+
272
+
Most often: the **performance indexes are missing**. They are part of `sql/03-performance.sql`, executed automatically by `setup.py`. If you installed an earlier version of this sample (before indexes were bundled), you can apply them standalone without re-running the full setup:
273
+
274
+
```bash
275
+
# Set credentials once (avoid pasting them inline)
276
+
export AIDBOX_USER=<your-admin-user>
277
+
export AIDBOX_PASS=<your-admin-password>
278
+
export AIDBOX_URL=https://aidbox.example.com
279
+
280
+
# Inspect the file
281
+
cat sql/03-performance.sql
282
+
283
+
# Apply via Aidbox $sql (the whole file is sent in one transactional call)
-d '["SELECT count(*) AS index_count FROM pg_indexes WHERE indexname LIKE '"'"'ix_%'"'"'"]'
308
+
# → [{"index_count": 17}] (or close to it)
309
+
```
310
+
311
+
The single most important index for single-patient queries is `ix_<resource>_subject` on `(resource->'subject'->>'id')` — without it, every patient-scoped query degrades to a full sequential scan of the resource table.
0 commit comments