{
  "openapi": "3.1.0",
  "info": {
    "title": "ProtectMum API",
    "version": "1.0.0",
    "summary": "Free maternal and child health calculators for Ghana",
    "description": "Calculators built on WHO and Ghana Health Service guidance: pregnancy dating and ANC visits, the GHS child vaccine schedule, a danger-sign screen for messages, and a draft antenatal risk score (sandbox only).\n\nEvery response is information only, not a diagnosis. Never send names, phone numbers or hospital numbers: no endpoint needs them, and request bodies are not stored.",
    "contact": {
      "name": "ProtectMum developers",
      "url": "https://protectmum.org/developers",
      "email": "developers@protectmum.org"
    },
    "license": {
      "name": "Terms of use",
      "url": "https://protectmum.org/developers#terms"
    }
  },
  "servers": [
    {
      "url": "https://protectmum.org",
      "description": "Production (use pm_test_ keys for the sandbox)"
    }
  ],
  "security": [
    {
      "bearerKey": []
    }
  ],
  "tags": [
    {
      "name": "Pregnancy"
    },
    {
      "name": "Vaccines"
    },
    {
      "name": "Triage"
    },
    {
      "name": "Risk (shadow)"
    },
    {
      "name": "Status"
    }
  ],
  "paths": {
    "/v1/health": {
      "get": {
        "tags": [
          "Status"
        ],
        "summary": "Service status",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "status": "ok",
                  "version": "v1"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pregnancy/calculate": {
      "post": {
        "tags": [
          "Pregnancy"
        ],
        "summary": "EDD, gestational age and the 8 WHO ANC contacts",
        "description": "Send exactly one of `lmp`, `edd` or `scan`. Scope: `pregnancy`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "lmp": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-01",
                    "description": "First day of the last menstrual period"
                  },
                  "edd": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-01",
                    "description": "Clinic EDD"
                  },
                  "scan": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "date",
                      "ga_weeks"
                    ],
                    "properties": {
                      "date": {
                        "type": "string",
                        "format": "date",
                        "example": "2026-06-01"
                      },
                      "ga_weeks": {
                        "type": "integer",
                        "minimum": 4,
                        "maximum": 42
                      },
                      "ga_days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 6,
                        "default": 0
                      }
                    }
                  },
                  "today": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-01",
                    "description": "Defaults to today in Ghana (UTC)"
                  }
                }
              },
              "example": {
                "lmp": "2026-06-01"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/Remaining"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pregnancy"
                },
                "example": {
                  "edd": "2027-03-08",
                  "dating_method": "lmp",
                  "today": "2026-11-26",
                  "gestational_age": {
                    "weeks": 25,
                    "days": 3,
                    "label": "25+3"
                  },
                  "trimester": 2,
                  "days_to_edd": 102,
                  "post_dates": false,
                  "anc_contacts": [
                    {
                      "contact": 1,
                      "week": 12,
                      "date": "2026-08-24",
                      "status": "past"
                    },
                    {
                      "contact": 2,
                      "week": 20,
                      "date": "2026-10-19",
                      "status": "past"
                    },
                    {
                      "contact": 3,
                      "week": 26,
                      "date": "2026-11-30",
                      "status": "next"
                    },
                    {
                      "contact": 4,
                      "week": 30,
                      "date": "2026-12-28",
                      "status": "upcoming"
                    },
                    {
                      "contact": 5,
                      "week": 34,
                      "date": "2027-01-25",
                      "status": "upcoming"
                    },
                    {
                      "contact": 6,
                      "week": 36,
                      "date": "2027-02-08",
                      "status": "upcoming"
                    },
                    {
                      "contact": 7,
                      "week": 38,
                      "date": "2027-02-22",
                      "status": "upcoming"
                    },
                    {
                      "contact": 8,
                      "week": 40,
                      "date": "2027-03-08",
                      "status": "upcoming"
                    }
                  ],
                  "notes": [
                    "EDD from LMP uses Naegele's rule (LMP + 280 days). An early scan is more accurate.",
                    "ANC contacts follow the WHO 2016 eight-contact model.",
                    "Information only. Not a diagnosis and not a substitute for a health worker."
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/vaccines/schedule": {
      "get": {
        "tags": [
          "Vaccines"
        ],
        "summary": "The Ghana EPI schedule ProtectMum uses",
        "description": "Scope: `vaccines`. Example shortened to four doses.",
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/Remaining"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "schedule_id": "ghs-epi",
                  "version": "2026-11-25",
                  "source": "https://ghs.gov.gh/immunisation",
                  "notes": [
                    "Ages are offsets from the child's date of birth. Weeks = 7 days; months and years are calendar offsets (31 Jan + 1 month = 28/29 Feb).",
                    "Entries with requires_clinic_check = true are only reminded after the mother confirms her clinic offers them (malaria vaccine is a phased introduction since 2019).",
                    "Vitamin A after 24 months: GHS says every 6 months until age 5. Doses at 30-54 months are listed here; confirm the final dose with Prof Bonsaffoh.",
                    "HPV at 9 years: confirm eligibility rules (sex, age band) before reminding."
                  ],
                  "doses": [
                    {
                      "code": "BCG",
                      "name": "BCG",
                      "dose": 1,
                      "age": {
                        "days": 0
                      },
                      "requires_clinic_check": false
                    },
                    {
                      "code": "OPV",
                      "name": "Oral polio vaccine",
                      "dose": 0,
                      "age": {
                        "days": 0
                      },
                      "requires_clinic_check": false
                    },
                    {
                      "code": "HEPB_BIRTH",
                      "name": "Hepatitis B birth dose",
                      "dose": 1,
                      "age": {
                        "days": 0
                      },
                      "requires_clinic_check": false
                    },
                    {
                      "code": "PENTA",
                      "name": "DPT-HepB-Hib",
                      "dose": 1,
                      "age": {
                        "weeks": 6
                      },
                      "requires_clinic_check": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/vaccines/child": {
      "post": {
        "tags": [
          "Vaccines"
        ],
        "summary": "One child's doses, statuses and next visit",
        "description": "Scope: `vaccines`. Dose keys are `CODE:dose`, as in GET /v1/vaccines/schedule. Example shortened.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "dob"
                ],
                "properties": {
                  "dob": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-01"
                  },
                  "given": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "format": "date"
                    },
                    "description": "Doses already given, e.g. {\"BCG:1\": \"2026-10-01\"}"
                  },
                  "clinic_offers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Codes of vaccines with phased introduction that the clinic offers, e.g. [\"MALARIA\"]"
                  },
                  "today": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-01"
                  }
                }
              },
              "example": {
                "dob": "2026-10-01",
                "given": {
                  "BCG:1": "2026-10-01",
                  "OPV:0": "2026-10-01",
                  "HEPB_BIRTH:1": "2026-10-02"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/Remaining"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "dob": "2026-10-01",
                  "today": "2026-11-26",
                  "schedule_version": "2026-11-25",
                  "next_visit": {
                    "date": "2026-11-12",
                    "doses": [
                      {
                        "code": "OPV",
                        "name": "Oral polio vaccine",
                        "dose": 1,
                        "status": "overdue"
                      },
                      {
                        "code": "PCV",
                        "name": "Pneumococcal vaccine",
                        "dose": 1,
                        "status": "overdue"
                      },
                      {
                        "code": "PENTA",
                        "name": "DPT-HepB-Hib",
                        "dose": 1,
                        "status": "overdue"
                      },
                      {
                        "code": "ROTA",
                        "name": "Rotavirus vaccine",
                        "dose": 1,
                        "status": "overdue"
                      }
                    ]
                  },
                  "doses": [
                    {
                      "code": "BCG",
                      "name": "BCG",
                      "dose": 1,
                      "due_date": "2026-10-01",
                      "status": "given",
                      "given_date": "2026-10-01",
                      "reminder_dates": []
                    },
                    {
                      "code": "HEPB_BIRTH",
                      "name": "Hepatitis B birth dose",
                      "dose": 1,
                      "due_date": "2026-10-01",
                      "status": "given",
                      "given_date": "2026-10-02",
                      "reminder_dates": []
                    },
                    {
                      "code": "OPV",
                      "name": "Oral polio vaccine",
                      "dose": 0,
                      "due_date": "2026-10-01",
                      "status": "given",
                      "given_date": "2026-10-01",
                      "reminder_dates": []
                    },
                    {
                      "code": "OPV",
                      "name": "Oral polio vaccine",
                      "dose": 1,
                      "due_date": "2026-11-12",
                      "status": "overdue",
                      "given_date": null,
                      "reminder_dates": [
                        "2026-11-09",
                        "2026-11-12"
                      ]
                    }
                  ],
                  "notes": [
                    "Statuses: given, overdue, due_today, due_soon, upcoming, needs_clinic_check.",
                    "Information only. Not a diagnosis and not a substitute for a health worker."
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/triage/message": {
      "post": {
        "tags": [
          "Triage"
        ],
        "summary": "Screen a message for pregnancy and newborn danger signs",
        "description": "Scope: `triage`. A keyword screen in English (Twi, Ga and Ewe rules coming). `danger_sign: false` does not mean safe. The text is not stored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "tw",
                      "gaa",
                      "ee"
                    ],
                    "default": "en"
                  }
                }
              },
              "example": {
                "text": "I am bleeding and my head is paining me seriously"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/Remaining"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Triage"
                },
                "example": {
                  "danger_sign": true,
                  "codes": [
                    "bleeding",
                    "severe_headache"
                  ],
                  "advice": "This could be a danger sign. Please go to the nearest health facility now. If you cannot get there, call 112. Do not wait.",
                  "rules_version": "draft-2026-11-26",
                  "notes": [
                    "This is a keyword screen. danger_sign = false does NOT mean the person is safe: always let them reach a health worker.",
                    "Information only. Not a diagnosis and not a substitute for a health worker."
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/risk/antenatal": {
      "post": {
        "tags": [
          "Risk (shadow)"
        ],
        "summary": "Draft antenatal risk score (sandbox keys only)",
        "description": "Scope: `risk`, granted on request to research partners. **Shadow mode**: not validated, not for care decisions, refused for live keys. Every field is optional; send `null` or leave out what is not known. Missing data never lowers the band.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "age_years": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 10,
                    "maximum": 60
                  },
                  "gravida": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 25,
                    "description": "Number of pregnancies including this one"
                  },
                  "parity": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 20,
                    "description": "Previous births"
                  },
                  "ga_weeks": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 4,
                    "maximum": 44
                  },
                  "previous_caesareans": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10
                  },
                  "consecutive_miscarriages": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 20
                  },
                  "last_baby_weight_g": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 300,
                    "maximum": 7000
                  },
                  "systolic_bp": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 60,
                    "maximum": 260
                  },
                  "diastolic_bp": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 30,
                    "maximum": 180
                  },
                  "hb_g_dl": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 2,
                    "maximum": 20
                  },
                  "height_cm": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 120,
                    "maximum": 200
                  },
                  "bmi": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 12,
                    "maximum": 70
                  },
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "diabetes",
                        "chronic_hypertension",
                        "renal_disease",
                        "cardiac_disease",
                        "sickle_cell_disease",
                        "epilepsy",
                        "substance_use",
                        "hiv",
                        "other_severe"
                      ]
                    }
                  },
                  "proteinuria": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "previous_stillbirth_or_neonatal_death": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "previous_preeclampsia": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "previous_uterine_surgery": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "previous_pph": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "multiple_pregnancy": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "rh_sensitised": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "vaginal_bleeding": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "pelvic_mass": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "malpresentation": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                }
              },
              "example": {
                "age_years": 37,
                "gravida": 4,
                "parity": 3,
                "systolic_bp": 142,
                "diastolic_bp": 92,
                "proteinuria": false,
                "hb_g_dl": 9.8,
                "previous_caesareans": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/Remaining"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Risk"
                },
                "example": {
                  "band": "high",
                  "score": 6,
                  "factors": [
                    {
                      "code": "hypertension",
                      "level": "high",
                      "label": "Blood pressure 140/90 or higher"
                    },
                    {
                      "code": "age_16_17_or_35_40",
                      "level": "moderate",
                      "label": "Age 16-17 or 35-40"
                    },
                    {
                      "code": "one_previous_caesarean",
                      "level": "moderate",
                      "label": "One previous caesarean section"
                    },
                    {
                      "code": "moderate_anaemia",
                      "level": "moderate",
                      "label": "Haemoglobin 7 to 9.9 g/dL"
                    }
                  ],
                  "missing": [],
                  "advice": "Doctor-led antenatal care. Plan birth where caesarean section and blood transfusion are available.",
                  "model_version": "antenatal-risk-v0-draft",
                  "mode": "shadow",
                  "for_clinical_use": false,
                  "notes": [
                    "Draft rule-based score, not validated. Do not use it to make care decisions.",
                    "Missing data never lowers the band; with key items missing and no factor found the band is \"incomplete\"."
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer pm_test_...` (sandbox) or `pm_live_...`. `X-Api-Key` also works."
      }
    },
    "headers": {
      "Limit": {
        "schema": {
          "type": "integer"
        },
        "description": "Requests allowed per minute"
      },
      "Remaining": {
        "schema": {
          "type": "integer"
        },
        "description": "Requests left this minute"
      },
      "RequestId": {
        "schema": {
          "type": "string"
        },
        "description": "Quote this when reporting a problem"
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "invalid": {
                "value": {
                  "error": {
                    "code": "date_out_of_range",
                    "message": "The dates do not give a current pregnancy (0 to 44 weeks). Check them.",
                    "request_id": "9f2c4e1a7b3d5c60"
                  }
                }
              },
              "missing_key": {
                "value": {
                  "error": {
                    "code": "missing_key",
                    "message": "Send your key as  Authorization: Bearer pm_test_...",
                    "request_id": "9f2c4e1a7b3d5c60"
                  }
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "not_found",
                  "method_not_allowed",
                  "missing_key",
                  "invalid_key",
                  "scope_missing",
                  "not_available",
                  "rate_limited",
                  "too_large",
                  "unsupported_media_type",
                  "invalid_json",
                  "invalid_input",
                  "date_out_of_range",
                  "server_error"
                ]
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "Pregnancy": {
        "type": "object",
        "properties": {
          "edd": {
            "type": "string",
            "format": "date",
            "example": "2026-06-01"
          },
          "dating_method": {
            "type": "string",
            "enum": [
              "lmp",
              "clinic_edd",
              "scan"
            ]
          },
          "today": {
            "type": "string",
            "format": "date",
            "example": "2026-06-01"
          },
          "gestational_age": {
            "type": "object",
            "properties": {
              "weeks": {
                "type": "integer"
              },
              "days": {
                "type": "integer"
              },
              "label": {
                "type": "string"
              }
            }
          },
          "trimester": {
            "type": "integer",
            "enum": [
              1,
              2,
              3
            ]
          },
          "days_to_edd": {
            "type": "integer"
          },
          "post_dates": {
            "type": "boolean"
          },
          "anc_contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact": {
                  "type": "integer"
                },
                "week": {
                  "type": "integer"
                },
                "date": {
                  "type": "string",
                  "format": "date",
                  "example": "2026-06-01"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "past",
                    "next",
                    "upcoming"
                  ]
                }
              }
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Triage": {
        "type": "object",
        "properties": {
          "danger_sign": {
            "type": "boolean"
          },
          "codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "advice": {
            "type": [
              "string",
              "null"
            ]
          },
          "rules_version": {
            "type": "string"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Risk": {
        "type": "object",
        "properties": {
          "band": {
            "type": "string",
            "enum": [
              "urgent",
              "high",
              "moderate",
              "low",
              "incomplete"
            ]
          },
          "score": {
            "type": "integer"
          },
          "factors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "level": {
                  "type": "string",
                  "enum": [
                    "urgent",
                    "high",
                    "moderate",
                    "info"
                  ]
                },
                "label": {
                  "type": "string"
                }
              }
            }
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "advice": {
            "type": "string"
          },
          "model_version": {
            "type": "string"
          },
          "mode": {
            "const": "shadow"
          },
          "for_clinical_use": {
            "const": false
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}