Blood Bank & Lab Items Seed
Seed reference for blood-bank and lab catalog items across regions.
The INTAKE tab of the blood-bank order-lab page at
/blood-bank/blood-order-lab renders three category boxes — โลหิตวิทยา
(Hematology), ชีวะโมเลกุล (Molecular), ภูมคุ้มกันวิทยา (Immunology) —
populated from a single GET /v2/medication/labItems call that filters by
a blood-bank category UUID and by a fixed list of six codes.
If those six codes are missing from lab_item on the target backend, the
dialog shows “ไม่มีข้อมูล” (no data) and briefly spins before settling,
even when 99 other lab items exist in the same category.
What gets seeded
| Code | Section | Name (EN) | ชื่อ (TH) | Pangalan (FIL) |
|---|---|---|---|---|
| 609 | Hematology | CBC (Complete Blood Count) | ความสมบูรณ์ของเม็ดเลือด (CBC) | CBC (Kumpletong Bilang ng Dugo) |
| 99397 | Molecular | NAT (Nucleic Acid Testing) | การตรวจหากรดนิวคลีอิก (NAT) | NAT (Pagsusuri ng Nucleic Acid) |
| 24885 | Immunology | ABO Blood Grouping | การตรวจหมู่เลือด ABO | Pagsusuri ng ABO Blood Type |
| 24886 | Immunology | Rh Typing | การตรวจหมู่เลือด Rh | Pagsusuri ng Rh Blood Type |
| 24887 | Immunology | Crossmatch | การจับคู่เลือด (Crossmatch) | Crossmatch (Paghahambing ng Dugo) |
| 24888 | Immunology | Antibody Screening | การตรวจคัดกรองแอนติบอดี | Pagsusuri ng Antibody |
Each entry inserts two documents:
- A
productrow (required ref fromlab_item.product). - The
lab_itemrow itself, linked to the blood-bank category73fbd47b-31ea-4b11-83cb-d43bf483a787.
The script is idempotent — it skips any row whose
(category, code) tuple already exists.
Where the seed lives
| Region | Path |
|---|---|
| Philippines | infrastructure/market-packs/medos-philippines/seed-bloodbank-lab-items.js |
| Thailand | infrastructure/market-packs/medos-thailand/seed-bloodbank-lab-items.js |
| AWS backup | s3://medos-market-pack-seeds/<region>/<date>/seed-bloodbank-lab-items.js |
The market-pack copy is the source of truth; the S3 copy is a point-in-time backup aligned with the other market-pack artifacts described in Seed Artifacts (S3).
Running the seed
The script is a mongosh file (the same pattern as
seed-donation-units.js). Run it directly against the region’s MongoDB:
# Philippines (replace HOST with your DocumentDB/Mongo endpoint)
mongosh "mongodb://HOST/medos-db?replicaSet=rs0" \
--file infrastructure/market-packs/medos-philippines/seed-bloodbank-lab-items.js
# Thailand
mongosh "mongodb://HOST/medos-db?replicaSet=rs0" \
--file infrastructure/market-packs/medos-thailand/seed-bloodbank-lab-items.js
On-premise
Inside the Docker stack started by docker-compose-onpremise.yml:
docker compose exec mongodb \
mongosh "mongodb://localhost/medos-db?replicaSet=rs0" \
--file /market-pack/seed-bloodbank-lab-items.js
Mount the market-pack folder into the container via a bind mount if it isn’t already present.
AWS (ECS / Fargate backend)
From a bastion or any host with network access to the DocumentDB cluster:
# Copy from S3 to the bastion, then run against DocumentDB
aws s3 cp \
s3://medos-market-pack-seeds/philippines/latest/seed-bloodbank-lab-items.js \
/tmp/
mongosh "mongodb://<docdb-endpoint>:27017/medos-db?tls=true&replicaSet=rs0" \
--file /tmp/seed-bloodbank-lab-items.js
Expected output:
inserted: code=609 CBC (Complete Blood Count)
inserted: code=99397 NAT (Nucleic Acid Testing)
inserted: code=24885 ABO Blood Grouping
inserted: code=24886 Rh Typing
inserted: code=24887 Crossmatch
inserted: code=24888 Antibody Screening
---
lab_items inserted: 6
products inserted: 6
skipped (existing): 0
total bloodbank lab_items now: 6
Why the codes are hardcoded in the frontend
The LabOrder component (web/packages/diagnostics-kit/src/blood-bank/components/blood-order-lab/components/order/LabOrder.tsx)
pins the six codes on purpose — they correspond to the three UI columns:
// code 609 → Hematology box
// code 99397 → Molecular box
// codes 24885, 24886, 24887, 24888 → Immunology box
If new tests get added to a column, add them to both the seed (here) and
the code string in LabOrder.tsx.