{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.gynaehub.com/schemas/emergency-protocol.json",
  "title": "Obstetric & Neonatal Emergency Protocol Specification",
  "description": "Clinical emergency action protocol schema for rapid response to Postpartum Hemorrhage (PPH) and Eclampsia/Severe Preeclampsia in maternal clinics.",
  "type": "object",
  "required": ["protocolId", "pphActiveManagement", "eclampsiaRegimen", "emergencyResuscitation"],
  "properties": {
    "protocolId": { "type": "string", "example": "SOP-EMERG-01" },
    "pphActiveManagement": {
      "type": "object",
      "required": ["firstLineDrugs", "mechanicalHemostasis", "volumeResuscitation", "surgicalReferralTriggers"],
      "properties": {
        "definition": {
          "type": "string",
          "default": "Blood loss >= 500 mL following vaginal birth or >= 1000 mL following cesarean, or any blood loss causing hemodynamic compromise."
        },
        "firstLineDrugs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["drugName", "dose", "route"],
            "properties": {
              "drugName": { "type": "string" },
              "dose": { "type": "string" },
              "route": { "type": "string" },
              "contraindications": { "type": "string" }
            }
          }
        },
        "mechanicalHemostasis": {
          "type": "array",
          "items": { "type": "string" },
          "example": [
            "Bimanual uterine compression",
            "Aortic compression",
            "Bakri uterine balloon tamponade / condom catheter tamponade"
          ]
        },
        "volumeResuscitation": {
          "type": "string",
          "example": "Wide-bore 16G/18G IV access x2, rapid infusion warmed Ringers Lactate or Normal Saline, call for emergency cross-match blood."
        },
        "surgicalReferralTriggers": {
          "type": "string"
        }
      }
    },
    "eclampsiaRegimen": {
      "type": "object",
      "required": ["magnesiumSulfatePritchardDose", "antihypertensiveEmergencyAgents"],
      "properties": {
        "magnesiumSulfatePritchardDose": {
          "type": "object",
          "required": ["loadingDose", "maintenanceDose", "monitoringRequirements", "antidote"],
          "properties": {
            "loadingDose": { "type": "string", "example": "4g IV 20% solution over 10-15 mins + 10g deep IM (5g in each buttock with 1ml 2% lidocaine)" },
            "maintenanceDose": { "type": "string", "example": "5g deep IM every 4 hours alternating buttocks, continued for 24h after delivery or last fit" },
            "monitoringRequirements": {
              "type": "array",
              "items": { "type": "string" },
              "example": ["Patellar tendon reflex present", "Respiratory rate >= 16 breaths/min", "Urine output >= 30 mL/hour"]
            },
            "antidote": { "type": "string", "example": "Calcium Gluconate 10% 10mL (1g) IV push slowly over 10 minutes" }
          }
        },
        "antihypertensiveEmergencyAgents": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "agent": { "type": "string" },
              "dose": { "type": "string" },
              "targetBp": { "type": "string", "example": "Systolic 130-150 mmHg, Diastolic 80-100 mmHg" }
            }
          }
        }
      }
    },
    "emergencyResuscitation": {
      "type": "object",
      "required": ["airwayBreathingCirculation", "ambulanceContact"],
      "properties": {
        "airwayBreathingCirculation": { "type": "string" },
        "ambulanceContact": { "type": "string", "example": "Rescue 1122 (Pakistan)" }
      }
    }
  }
}
