Market Pack Seeds
Per-region seed file inventory and apply order for the market-pack system.
Reference master-data dumps for each regional deployment, stored in S3 for replay. Captured from a live, curated backend, these are the source of truth for seeding a fresh medOS deployment — AWS, on-premise, or local.
Where they live
s3://medos-market-pack-seeds/
├── thailand/
│ └── 2026-04-22/
│ ├── seeds-from-vajira.tar.gz ← Full archive (22 MB compressed)
│ └── jsonl/ ← Individual collection files
│ ├── aaa_roles.jsonl (35 rows)
│ ├── aaa_users_list.jsonl (65 rows)
│ ├── administration_clinics.jsonl (80 rows)
│ ├── administration_subClinics.jsonl (600 rows)
│ ├── administration_beds.jsonl (2,510 rows)
│ ├── administration_titles.jsonl (2,996 rows)
│ ├── administration_addressAreas.jsonl (7,426 rows)
│ ├── medication_medicationItems.jsonl (84,862 rows)
│ ├── financial_products.jsonl (93,794 rows)
│ ├── diagnostic_diagnosiss.jsonl (253 rows)
│ └── ... 30 more collections
└── japan/ ← future
└── philippines/ ← future
Access: private bucket, versioning enabled, public access blocked.
Requires AWS credentials for 523231704210 with s3:GetObject on
medos-market-pack-seeds/*.
Available dumps
What’s inside — collection coverage
| Domain | Collections | Note |
|---|---|---|
| Identity (aaa) | users/list, roles |
65 users, passwords replaced with dev321456 default |
| Administration | clinics, subClinics, buildings, beds, bedtypes, titles, genders, nationalities, religions, races, maritalStatus, occupations, communicateLanguages, humanIdentityTypes, addressAreas, specialtys, patientCategorys, doctorRooms, chiefComplaints, riskLevels |
|
| Financial | payors, payorPlans, billingGroups, billingSubGroups, products |
93k products |
| Medication | medicationItems, labItems, dosageForms, administrationRoutes |
85k drugs |
| Diagnostic | diagnosiss, diagnosisTemplates, dischargeTypes, dischargeStatuss, physicalExaminates, treatmentDoctors |
|
| Foundation | units, manufacturers, vendors |
Consuming the seeds
Option A: Full bulk download
# Download + extract
aws s3 cp s3://medos-market-pack-seeds/thailand/2026-04-22/seeds-from-vajira.tar.gz /tmp/
tar xzf /tmp/seeds-from-vajira.tar.gz -C infrastructure/market-packs/medos-thailand/
# → populates infrastructure/market-packs/medos-thailand/seeds-from-vajira/
Option B: Single collection
aws s3 cp \
s3://medos-market-pack-seeds/thailand/2026-04-22/jsonl/administration_clinics.jsonl \
./clinics.jsonl
Import into a backend
Three paths depending on endpoint availability:
1. API-based (recommended — validation + events)
# POST-able collections (clinics, medicationItems, users, etc.)
cd infrastructure/market-packs/medos-thailand
AWS_BASE="http://your-backend/api/v2" node topup-to-aws.mjs \
administration/clinics administration/subClinics financial/products \
medication/medicationItems ...
2. Direct Mongo (for enum/reference tables with no POST route)
# Collections without API create endpoint: genders, nationalities, races, etc.
cat seeds-from-vajira/administration_occupations.jsonl | \
ssh ec2 "docker exec -i mongo mongoimport --db medos-db -c occupation \
--mode upsert --upsertFields _id"
3. Users top-up (sets default password dev321456 for all migrated users)
node topup-users.mjs
Scripts in the repo
Located in infrastructure/market-packs/medos-thailand/:
| Script | Purpose |
|---|---|
topup-to-aws.mjs |
Generic API-based top-up for POST-able collections |
topup-medication-items.mjs |
Specialized for medicationItems (schema-drift transforms) |
topup-users.mjs |
User top-up with password reset to dev321456 |
audit-all.mjs |
Compare seed file vs target backend, report gaps |
test-aws-readiness.sh |
Smoke-test all critical API endpoints |
redump.mjs |
Re-dump a single collection from a source backend |
Known gaps (Thailand dump, 2026-04-22)
chiefComplaints(215 rows) — transactional, tied to patient/encounter refs not in the dump. Included in archive but can’t be imported cleanly.administration/wards— no list endpoint on the source backend.diagnostic/icd— path differs between source and target schema.
Adding a new regional dump
# 1. Dump from source (ensure you have API access + JWT)
cd infrastructure/market-packs/medos-<region>
BASE="https://source-backend/api/v2" TOKEN="..." ./dump-all.sh
# 2. Upload to S3 with datestamp
STAMP=$(date +%Y-%m-%d)
tar czf seeds-$STAMP.tar.gz seeds-from-*/
aws s3 cp seeds-$STAMP.tar.gz s3://medos-market-pack-seeds/<region>/$STAMP/
aws s3 sync seeds-from-*/ s3://medos-market-pack-seeds/<region>/$STAMP/jsonl/
Reusing across countries
Not every collection is Thailand-specific. Three reuse tiers:
Tier 1 — fully universal (use as-is anywhere)
Code-based, language-agnostic data. Extracted to
s3://medos-market-pack-seeds/universal/2026-04-22/:
| Collection | Rows | Why universal |
|---|---|---|
medication_dosageForms |
493 | tablet/capsule/syrup |
medication_administrationRoutes |
150 | oral/IV/IM |
administration_genders |
4 | M/F/NB/Unknown |
administration_maritalStatus |
7 | single/married |
administration_humanIdentityTypes |
9 | passport/NID |
administration_bedtypes |
69 | ICU/HDU/General |
administration_riskLevels |
14 | clinical risk scoring |
foundation_units |
251 | SI units (kg/mg/ml) |
diagnostic_dischargeTypes |
11 | discharge category |
diagnostic_dischargeStatuss |
4 | discharge status codes |
diagnostic_treatmentDoctors |
3 | treatment-doctor roles |
Download:
aws s3 cp s3://medos-market-pack-seeds/universal/2026-04-22/seeds.tar.gz /tmp/
tar xzf /tmp/seeds.tar.gz
# → apply to any country deployment with topup-to-aws.mjs
Extract fresh from any source country seeds:
cd infrastructure/market-packs
node scripts/extract-universal.mjs \
--source=medos-thailand/seeds-from-vajira \
--out=medos-universal/seeds
Tier 2 — universal structure, region-specific labels
Same list everywhere, translate the display labels:
| Collection | Reuse approach |
|---|---|
administration_nationalities |
Keep _id + ISO code, translate name to target language |
administration_religions |
Keep _id, translate name |
administration_races |
Keep _id, translate name |
administration_occupations |
Translate name or swap for local occupation codes |
administration_titles |
Append local honorifics (さん, Sr./Sra.) to universal set |
administration_communicateLanguages |
Keep list, translate display names |
administration_specialtys |
Medical specialties largely overlap — translate labels |
Pattern:
// scripts/translate-labels.ts (prototype)
for each row in source JSONL:
row.name = translate(row.name, from: 'th', to: targetLocale)
row.name_th = originalName // preserve original for search
write to target pack
Tier 3 — region-specific (fresh per country)
administration/clinics,subClinics,buildings,beds,doctorRooms— facility/org data, always country-specificadministration/addressAreas— Thai provinces only; each country ships own administrative divisionsfinancial/payors,payorPlans,billingGroups,products— insurance (NHSO → PhilHealth → Kaigo → …)medication/labItems— lab catalog varies by country’s formularymedication/medicationItems— drug catalog; ~40–60% might be reusable (international brand names like ATORVASTATIN), rest is local formularyaaa/users/list— always fresh per deployment
Recommended pipeline for a new country (e.g. Philippines)
# 1. Start with the universal layer
aws s3 cp s3://medos-market-pack-seeds/universal/2026-04-22/seeds.tar.gz /tmp/
tar xzf /tmp/seeds.tar.gz -C infrastructure/market-packs/medos-philippines/
node infrastructure/market-packs/medos-philippines/import-to-target.mjs
# 2. Apply Tier 2 (translate + import)
node scripts/translate-labels.ts \
--source=medos-thailand/seeds-from-vajira \
--out=medos-philippines/seeds \
--target-locale=fil-PH \
--collections=nationalities,religions,races,occupations,titles
# 3. Fresh Tier 3 (country-specific seed scripts already in the repo)
# infrastructure/market-packs/medos-philippines/seed-philhealth-rates.sql
# infrastructure/market-packs/medos-philippines/seed-hospital-facility.sql
# ...
# 4. Drug/lab catalogs — either
# (a) dump from a target-country sandbox when available, OR
# (b) seed a minimal starter catalog (top-200 drugs) + let ops team add
Related
- Market Packs — region-specific config and rate tables
- AWS Deployment — provisioning the backend infrastructure
- On-Premise Deployment — docker-compose single-box install