Admin — Disease categories
Same auth as review types (snr_adm). Payloads use short keys.
POST /admin/save-disease-categories
Section titled “POST /admin/save-disease-categories”Creates a disease category. cond_en / cond_ar must be paired (same length).
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
spec_en | string | yes | Specialty (English), trimmed |
spec_ar | string | yes | Specialty (Arabic), trimmed |
cond_en | string[] | yes | Non-empty; each item non-empty after trim |
cond_ar | string[] | yes | Same length as cond_en |
Example request
Section titled “Example request”{ "spec_en": "Cardiology (Heart Conditions)", "spec_ar": "أمراض القلب", "cond_en": ["Heart failure", "coronary artery disease"], "cond_ar": ["قصور القلب", "مرض الشريان التاجي"]}Response — success (200)
Section titled “Response — success (200)”{ "status": 1000, "message": "Disease category saved", "data": { "dc_id": "550e8400-e29b-41d4-a716-446655440000" }}Response — duplicate (409)
Section titled “Response — duplicate (409)”{ "status": 1002, "message": "Disease category already exists for this specialty (English)"}(Match is case-insensitive on English specialty for active rows.)
POST /admin/map-doctors
Section titled “POST /admin/map-doctors”Sets disease_categories.doctor_ids (JSON array of provider id strings) for an active category. Replaces the stored list. Requires D1 migration 0006_disease_categories_doctor_ids.sql. When doctor_ids is non-empty, each id is validated against persistence by trying mapped departments from POST /admin/list-mapped-department until a matching doctor profile is found.
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
dc_id | string | yes | Active disease_categories.dc_id |
doctor_ids | string[] | yes | Each element non-empty after trim; [] clears all mapped ids |
Example request
Section titled “Example request”{ "dc_id": "550e8400-e29b-41d4-a716-446655440000", "doctor_ids": ["EMP1", "EMP2"]}Response — success (200)
Section titled “Response — success (200)”{ "status": 1000, "message": "Doctors mapped to disease category", "data": { "dc_id": "550e8400-e29b-41d4-a716-446655440000" }}Not found → 404 (message: "Disease category not found").
POST /admin/list-mapped-doctors
Section titled “POST /admin/list-mapped-doctors”Paginated list of active disease categories with English specialty label and doctor count from disease_categories.doctor_ids (JSON array). Same optional q search as POST /admin/list-disease-categories (English specialty, Arabic specialty). Requires migration 0006_disease_categories_doctor_ids.sql.
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
page | number | no | default 1 |
size | number | no | default 15, max 100 |
q | string | no | search substring |
Response — success (200)
Section titled “Response — success (200)”Each element of data:
| Field | Type | Notes |
|---|---|---|
dc_id | string | Category id (for edit / POST /admin/map-doctors) |
spec_en | string | English specialty label |
doctor_count | number | Count of string ids in stored doctor_ids JSON |
{ "status": 1000, "message": "ok", "data": [ { "dc_id": "550e8400-e29b-41d4-a716-446655440000", "spec_en": "Cardiology (Heart Conditions)", "doctor_count": 6 } ], "pagination": { "total": 24, "page": 1, "size": 15 }}POST /admin/mapped-doctors-details
Section titled “POST /admin/mapped-doctors-details”Single active disease category: English specialty and the mapped doctor id list (same strings as POST /admin/map-doctors). Requires migration 0006_disease_categories_doctor_ids.sql.
Request body
Section titled “Request body”| Field | Type | Required |
|---|---|---|
dc_id | string | yes |
Response — data
Section titled “Response — data”| Field | Type | Notes |
|---|---|---|
dc_id | string | Echo of category id |
spec_en | string | English specialty label |
doctors | string[] | Provider / employee ids from doctor_ids JSON (empty if none) |
Example (200)
Section titled “Example (200)”{ "status": 1000, "message": "ok", "data": { "dc_id": "550e8400-e29b-41d4-a716-446655440000", "spec_en": "Cardiology (Heart Conditions)", "doctors": ["EMP1", "EMP2"] }}Not found → 404 (message: "Disease category not found").
POST /admin/list-disease-categories
Section titled “POST /admin/list-disease-categories”Paginated list with optional search on English specialty and Arabic specialty.
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
page | number | no | default 1 |
size | number | no | default 15, max 100 |
q | string | no | search substring |
Example request
Section titled “Example request”{ "page": 1, "size": 10, "q": "heart"}Response — success (200)
Section titled “Response — success (200)”{ "status": 1000, "message": "ok", "data": [ { "dc_id": "uuid", "spec_en": "Cardiology (Heart Conditions)", "spec_ar": "أمراض القلب", "cond_en": ["Heart failure", "coronary artery disease"], "cond_ar": ["قصور القلب", "مرض الشريان التاجي"], "created_date": "2026-05-08T12:00:00.000Z" } ], "pagination": { "total": 1, "page": 1, "size": 10 }}Note: list uses pagination.size (not pageSize).
POST /admin/disease-category-details
Section titled “POST /admin/disease-category-details”Single active disease category by dc_id. Response uses the same short keys as list, plus audit fields.
Request body
Section titled “Request body”| Field | Type | Required |
|---|---|---|
dc_id | string | yes |
Example request
Section titled “Example request”{ "dc_id": "550e8400-e29b-41d4-a716-446655440000"}Response — success (200)
Section titled “Response — success (200)”{ "status": 1000, "message": "ok", "data": { "dc_id": "uuid", "spec_en": "Cardiology (Heart Conditions)", "spec_ar": "أمراض القلب", "cond_en": ["Heart failure", "coronary artery disease"], "cond_ar": ["قصور القلب", "مرض الشريان التاجي"], "created_by": "user-id", "created_date": "2026-05-08T12:00:00.000Z", "updated_date": null }}Response — not found (404)
Section titled “Response — not found (404)”{ "status": 1002, "message": "Disease category not found"}