{
  "openapi": "3.1.0",
  "info": {
    "title": "MedMinutes API: CDSS dan Medical Scribe",
    "version": "1.1.0",
    "description": "API MedMinutes untuk SIMRS rumah sakit: saran kode ICD-10 dan ICD-9-CM, verifikasi kode klaim, draf resume medis (CDSS), dan dokumen klinis final Medical Scribe (pratinjau).\n\nHasil CDSS adalah saran untuk ditinjau DPJP dan koder rumah sakit; bukan alat untuk menegakkan diagnosis atau menentukan terapi.\n\nAutentikasi: POST /api/v1/auth/token dengan header X-API-Key dan body {\"api_secret\": \"...\"}, lalu kirim X-API-Key dan Authorization: Bearer <token> di setiap panggilan. Token berlaku 3600 detik.\n\nBatas: Development 10/menit dan 500/hari; Production 100/menit dan 10.000/hari; sandbox 10/menit dan 100/hari. Panduan: https://medminutes.io/developers/ · Referensi: https://api.medminutes.io/",
    "contact": {
      "name": "MedMinutes",
      "url": "https://medminutes.io/developers/"
    }
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Gateway Health Check",
        "description": "Returns the health status of the API gateway itself.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/health/backends": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Backend Services Health",
        "description": "Pings all backend microservices and returns their status.",
        "operationId": "backend_health_health_backends_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/token": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Generate Access Token",
        "description": "Exchange API key + secret for a short-lived JWT access token. The token must be included in subsequent API calls as a Bearer token.",
        "operationId": "generate_token_api_v1_auth_token_post",
        "parameters": [
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cdss/icd-recommendation": {
      "post": {
        "tags": [
          "CDSS"
        ],
        "summary": "ICD-10 Recommendation",
        "description": "Suggest ICD-10 and ICD-9-CM codes for diagnoses and procedures documented in SOAP notes, for coder review.",
        "operationId": "icd_recommendation_api_v1_cdss_icd_recommendation_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ICDRecommendationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ICDRecommendationResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cdss/icd-guidance": {
      "post": {
        "tags": [
          "CDSS"
        ],
        "summary": "ICD-10 Guidance & Validation",
        "description": "Validate ICD-10 codes and retrieve coding guidelines, includes/excludes rules, and clinical notes. Send the optional clinical context (setting, umur_tahun, umur_hari, los, kelas_rawat, inacbg) to also receive `national_findings` — claim-level findings from the BPJS Kajian Potensi Ketidaksesuaian letters. Context that is not sent is treated as not met, so a rule stays silent rather than guess. Each result carries `formulir[]` for requirements that ask for a score (SOFA, PELOD-2, CURB-65, Downe): open `url` in an iframe and listen for the `mm.formulir.selesai` message. Send the optional `soap_data` (same shape as /icd-recommendation) to get `status` `ada` when the score is already written, plus `terisi_dari_soap`; SOAP is read in memory only.",
        "operationId": "icd_guidance_api_v1_cdss_icd_guidance_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ICDGuidanceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ICDGuidanceResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cdss/resume-extraction": {
      "post": {
        "tags": [
          "CDSS"
        ],
        "summary": "Clinical Resume Extraction",
        "description": "Extract and structure a clinical resume from raw SOAP notes. Returns a formatted medical resume with patient info, diagnosis, treatment plan, and more.",
        "operationId": "resume_extraction_api_v1_cdss_resume_extraction_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResumeExtractionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scribe/documents": {
      "get": {
        "tags": [
          "Medical Scribe (pratinjau)"
        ],
        "summary": "Daftar dokumen Scribe yang sudah final dan siap masuk RME",
        "operationId": "list_documents_api_v1_scribe_documents_get",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "soap",
                    "operative_report"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Saring jenis dokumen",
              "title": "Type"
            },
            "description": "Saring jenis dokumen"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Hanya yang difinalkan setelah waktu ini (ISO 8601)",
              "title": "Since"
            },
            "description": "Hanya yang difinalkan setelah waktu ini (ISO 8601)"
          },
          {
            "name": "delivered",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "false = hanya yang belum di-ack RME",
              "default": false,
              "title": "Delivered"
            },
            "description": "false = hanya yang belum di-ack RME"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scribe/documents/{document_id}": {
      "get": {
        "tags": [
          "Medical Scribe (pratinjau)"
        ],
        "summary": "Isi lengkap satu dokumen (SOAP atau laporan operasi)",
        "operationId": "get_document_api_v1_scribe_documents__document_id__get",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Document Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scribe/documents/{document_id}/ack": {
      "post": {
        "tags": [
          "Medical Scribe (pratinjau)"
        ],
        "summary": "Konfirmasi dari RME: dokumen tersimpan atau ditolak",
        "operationId": "ack_document_api_v1_scribe_documents__document_id__ack_post",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Document Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "APIErrorResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "default": false
          },
          "error": {
            "$ref": "#/components/schemas/ErrorDetail"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "provider": {
            "type": "string",
            "title": "Provider",
            "default": "MedMinutes.io"
          }
        },
        "type": "object",
        "required": [
          "error"
        ],
        "title": "APIErrorResponse",
        "description": "Standardised envelope for every error response."
      },
      "APIResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "default": true
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "data": {
            "title": "Data"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "provider": {
            "type": "string",
            "title": "Provider",
            "default": "MedMinutes.io"
          }
        },
        "type": "object",
        "title": "APIResponse",
        "description": "Standardised envelope for every successful response."
      },
      "AckRequest": {
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "saved",
              "rejected"
            ],
            "title": "Status"
          },
          "emr_record_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Emr Record Id",
            "description": "Id catatan di RME setelah tersimpan"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason",
            "description": "Wajib bila rejected"
          }
        },
        "type": "object",
        "required": [
          "status"
        ],
        "title": "AckRequest"
      },
      "ErrorDetail": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "details": {
            "additionalProperties": true,
            "type": "object",
            "title": "Details",
            "default": {}
          }
        },
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "title": "ErrorDetail"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ICDCode": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "confidence": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Confidence"
          },
          "rationale": {
            "type": "string",
            "title": "Rationale",
            "default": ""
          },
          "relevancy": {
            "type": "number",
            "maximum": 100.0,
            "minimum": 0.0,
            "title": "Relevancy",
            "default": 0
          },
          "is_principal_pick": {
            "type": "boolean",
            "title": "Is Principal Pick",
            "default": false
          },
          "can_be_principal": {
            "type": "boolean",
            "title": "Can Be Principal",
            "default": true
          },
          "is_indonesian_modification": {
            "type": "boolean",
            "title": "Is Indonesian Modification",
            "default": false
          },
          "is_manifestation": {
            "type": "boolean",
            "title": "Is Manifestation",
            "default": false
          },
          "validation_warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation Warning"
          },
          "severity_impact": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity Impact"
          },
          "diagnosis_klinis": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Diagnosis Klinis"
          }
        },
        "type": "object",
        "required": [
          "code",
          "description",
          "confidence"
        ],
        "title": "ICDCode"
      },
      "ICDGuidanceCitation": {
        "properties": {
          "sumber": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sumber"
          },
          "dokumen": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dokumen"
          },
          "tahun": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tahun"
          },
          "halaman": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Halaman",
            "default": []
          },
          "pasal": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Pasal",
            "default": []
          }
        },
        "type": "object",
        "title": "ICDGuidanceCitation"
      },
      "ICDGuidanceCombination": {
        "properties": {
          "codes": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Codes",
            "default": []
          },
          "label": {
            "type": "string",
            "title": "Label",
            "default": ""
          },
          "guidance": {
            "type": "string",
            "title": "Guidance",
            "default": ""
          },
          "ref": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SourceRef"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "ICDGuidanceCombination"
      },
      "ICDGuidanceData": {
        "properties": {
          "query": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Query",
            "default": []
          },
          "total": {
            "type": "integer",
            "title": "Total",
            "default": 0
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/ICDGuidanceResult"
            },
            "type": "array",
            "title": "Results",
            "default": []
          },
          "national_findings": {
            "items": {
              "$ref": "#/components/schemas/NationalFinding"
            },
            "type": "array",
            "title": "National Findings",
            "default": []
          },
          "pending_risk": {
            "items": {
              "$ref": "#/components/schemas/PendingRiskHit"
            },
            "type": "array",
            "title": "Pending Risk",
            "default": []
          },
          "topup_rs": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TopupRSInfo"
              },
              {
                "type": "null"
              }
            ]
          },
          "kelompok_usia_pasien": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Kelompok Usia Pasien",
            "default": []
          },
          "syarat_umum": {
            "items": {
              "$ref": "#/components/schemas/ICDGuidanceSyaratUmum"
            },
            "type": "array",
            "title": "Syarat Umum",
            "default": []
          },
          "invalid_codes": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Invalid Codes",
            "default": []
          }
        },
        "type": "object",
        "title": "ICDGuidanceData"
      },
      "ICDGuidanceFormulir": {
        "properties": {
          "form_id": {
            "type": "string",
            "title": "Form Id"
          },
          "nama": {
            "type": "string",
            "title": "Nama"
          },
          "aturan": {
            "type": "string",
            "title": "Aturan"
          },
          "tingkat": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tingkat"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "terisi_dari_soap": {
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "integer"
                },
                {
                  "type": "number"
                },
                {
                  "type": "string"
                }
              ]
            },
            "type": "object",
            "title": "Terisi Dari Soap",
            "default": {}
          },
          "url": {
            "type": "string",
            "title": "Url"
          }
        },
        "type": "object",
        "required": [
          "form_id",
          "nama",
          "aturan",
          "status",
          "url"
        ],
        "title": "ICDGuidanceFormulir"
      },
      "ICDGuidanceRequest": {
        "properties": {
          "codes": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "maxItems": 20,
            "minItems": 1,
            "title": "Codes"
          },
          "encounter_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Encounter Id"
          },
          "language": {
            "type": "string",
            "title": "Language",
            "default": "id"
          },
          "setting": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(rajal|ranap|igd)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Setting",
            "description": "\"rajal\", \"ranap\", atau \"igd\" sesuai kunjungan (kunjungan IGD = \"igd\"). Menyaring butir required_documents dan syarat_ringkas yang tidak berlaku di pelayanan itu, serta national_findings dan syarat_umum. Tanpa setting = semua."
          },
          "umur_tahun": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 130.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Umur Tahun",
            "description": "Umur pasien (tahun). Mengisi kelompok_usia_pasien untuk membaca required_documents_usia dan syarat_ringkas[].usia."
          },
          "umur_hari": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 47500.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Umur Hari",
            "description": "Umur dalam hari (opsional), membedakan neonatus (≤28 hari)."
          },
          "los": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 365.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Los"
          },
          "kelas_rawat": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[123]$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kelas Rawat",
            "description": "\"1\", \"2\", atau \"3\""
          },
          "inacbg": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20
              },
              {
                "type": "null"
              }
            ],
            "title": "Inacbg"
          },
          "hospital_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Hospital Id"
          },
          "soap_data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SOAPData"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "codes"
        ],
        "title": "ICDGuidanceRequest"
      },
      "ICDGuidanceResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "default": true
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ICDGuidanceData"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "provider": {
            "type": "string",
            "title": "Provider",
            "default": "MedMinutes.io"
          }
        },
        "type": "object",
        "title": "ICDGuidanceResponse"
      },
      "ICDGuidanceResult": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "default": ""
          },
          "type": {
            "type": "string",
            "title": "Type",
            "default": "icd10"
          },
          "valid": {
            "type": "boolean",
            "title": "Valid",
            "default": true
          },
          "severity": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ICDGuidanceSeverity"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity"
          },
          "definition": {
            "type": "string",
            "title": "Definition",
            "default": ""
          },
          "key_points": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Key Points",
            "default": []
          },
          "combinations": {
            "items": {
              "$ref": "#/components/schemas/ICDGuidanceCombination"
            },
            "type": "array",
            "title": "Combinations",
            "default": []
          },
          "pitfalls": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Pitfalls",
            "default": []
          },
          "required_documents": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Required Documents",
            "default": []
          },
          "key_points_ref": {
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/SourceRef"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array",
            "title": "Key Points Ref",
            "default": []
          },
          "pitfalls_ref": {
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/SourceRef"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array",
            "title": "Pitfalls Ref",
            "default": []
          },
          "required_documents_ref": {
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/SourceRef"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array",
            "title": "Required Documents Ref",
            "default": []
          },
          "required_documents_group": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Required Documents Group",
            "default": []
          },
          "citations": {
            "items": {
              "$ref": "#/components/schemas/ICDGuidanceCitation"
            },
            "type": "array",
            "title": "Citations",
            "default": []
          },
          "guidance_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Guidance Status"
          },
          "topup_rs": {
            "items": {
              "$ref": "#/components/schemas/TopupRSItem"
            },
            "type": "array",
            "title": "Topup Rs",
            "default": []
          },
          "required_documents_tingkat": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Required Documents Tingkat",
            "description": "Sejajar indeks dengan required_documents. wajib = dituntut aturan BPJS/Kemenkes; kondisional = dituntut bila required_documents_syarat terpenuhi; pendukung = memperkuat berkas, tidak dituntut; belum_dipilah = belum ditinjau (tampilkan tanpa label wajib).",
            "default": []
          },
          "required_documents_syarat": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array",
            "title": "Required Documents Syarat",
            "description": "Sejajar indeks. Kapan butir berlaku: syarat tuntutan (kondisional) atau konteks relevan (pendukung, mis. 'Kontrol pasca persalinan'). null = umum.",
            "default": []
          },
          "required_documents_usia": {
            "items": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "array",
            "title": "Required Documents Usia",
            "description": "Sejajar indeks. [] = semua usia; selain itu subset dewasa/anak/neonatus. Tampilkan butir bila kosong atau memuat kelompok_usia_pasien.",
            "default": []
          },
          "required_documents_setting": {
            "items": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "array",
            "title": "Required Documents Setting",
            "description": "Sejajar indeks. Jenis pelayanan tempat butir berlaku: [] = semua, selain itu subset rajal/ranap/igd. Bila permintaan membawa setting, butir yang tak berlaku sudah dibuang bersama semua larik sejajarnya.",
            "default": []
          },
          "required_documents_dasar": {
            "items": {
              "items": {
                "$ref": "#/components/schemas/SourceRef"
              },
              "type": "array"
            },
            "type": "array",
            "title": "Required Documents Dasar",
            "description": "Sejajar indeks. Rujukan yang menuntut butir wajib/kondisional, sampai halaman. Kosong untuk pendukung dan belum_dipilah.",
            "default": []
          },
          "required_documents_aturan": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array",
            "title": "Required Documents Aturan",
            "description": "Sejajar indeks. Id aturan penilai, sama dengan syarat_ringkas[].aturan; null = tingkat bawaan.",
            "default": []
          },
          "key_points_usia": {
            "items": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "array",
            "title": "Key Points Usia",
            "default": []
          },
          "pitfalls_usia": {
            "items": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "array",
            "title": "Pitfalls Usia",
            "default": []
          },
          "syarat_ringkas": {
            "items": {
              "$ref": "#/components/schemas/ICDGuidanceSyaratRingkas"
            },
            "type": "array",
            "title": "Syarat Ringkas",
            "description": "TIDAK sejajar indeks. Satu baris per syarat wajib/kondisional untuk tampilan dokter; hubungkan ke butir lewat `aturan`.",
            "default": []
          },
          "tingkat_status": {
            "type": "string",
            "title": "Tingkat Status",
            "description": "dipilah = semua butir kartu ini sudah ditinjau.",
            "default": "belum_dipilah"
          },
          "tingkat_topik": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tingkat Topik"
          },
          "kelompok_usia": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Kelompok Usia",
            "default": []
          },
          "formulir": {
            "items": {
              "$ref": "#/components/schemas/ICDGuidanceFormulir"
            },
            "type": "array",
            "title": "Formulir",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "ICDGuidanceResult"
      },
      "ICDGuidanceSeverity": {
        "properties": {
          "level": {
            "type": "string",
            "title": "Level",
            "default": ""
          },
          "indicator": {
            "type": "string",
            "title": "Indicator",
            "default": ""
          }
        },
        "type": "object",
        "title": "ICDGuidanceSeverity"
      },
      "ICDGuidanceSyaratRingkas": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "aturan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Aturan"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "tingkat": {
            "type": "string",
            "title": "Tingkat",
            "default": ""
          },
          "syarat": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Syarat"
          },
          "usia": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Usia",
            "default": []
          },
          "setting": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Setting",
            "default": []
          },
          "catatan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Catatan"
          },
          "dasar": {
            "items": {
              "$ref": "#/components/schemas/SourceRef"
            },
            "type": "array",
            "title": "Dasar",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "id",
          "label"
        ],
        "title": "ICDGuidanceSyaratRingkas"
      },
      "ICDGuidanceSyaratUmum": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "aturan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Aturan"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "tingkat": {
            "type": "string",
            "title": "Tingkat",
            "default": ""
          },
          "syarat": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Syarat"
          },
          "usia": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Usia",
            "default": []
          },
          "setting": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Setting",
            "default": []
          },
          "catatan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Catatan"
          },
          "dasar": {
            "items": {
              "$ref": "#/components/schemas/SourceRef"
            },
            "type": "array",
            "title": "Dasar",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "id",
          "label"
        ],
        "title": "ICDGuidanceSyaratUmum"
      },
      "ICDRecommendationData": {
        "properties": {
          "icd10_recommendations": {
            "items": {
              "$ref": "#/components/schemas/ICDCode"
            },
            "type": "array",
            "title": "Icd10 Recommendations",
            "default": []
          },
          "icd9_recommendations": {
            "items": {
              "$ref": "#/components/schemas/ICDCode"
            },
            "type": "array",
            "title": "Icd9 Recommendations",
            "default": []
          },
          "processing_time_ms": {
            "type": "number",
            "title": "Processing Time Ms",
            "default": 0
          },
          "tariff": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tariff"
          },
          "warnings": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Warnings"
          }
        },
        "type": "object",
        "title": "ICDRecommendationData"
      },
      "ICDRecommendationRequest": {
        "properties": {
          "patient_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Patient Id"
          },
          "encounter_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Encounter Id"
          },
          "soap_data": {
            "$ref": "#/components/schemas/SOAPData"
          },
          "language": {
            "type": "string",
            "title": "Language",
            "default": "id"
          },
          "max_recommendations": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 20.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Recommendations"
          },
          "kelas_rawat": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[123]$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kelas Rawat"
          },
          "jenis_rawat": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(rajal|igd|ranap)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Jenis Rawat"
          }
        },
        "type": "object",
        "required": [
          "soap_data"
        ],
        "title": "ICDRecommendationRequest"
      },
      "ICDRecommendationResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "default": true
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ICDRecommendationData"
              },
              {
                "$ref": "#/components/schemas/ErrorDetail"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "provider": {
            "type": "string",
            "title": "Provider",
            "default": "MedMinutes.io"
          }
        },
        "type": "object",
        "title": "ICDRecommendationResponse"
      },
      "NationalFinding": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "judul": {
            "type": "string",
            "title": "Judul",
            "default": ""
          },
          "dasar": {
            "type": "string",
            "title": "Dasar",
            "default": ""
          },
          "kepastian": {
            "type": "string",
            "title": "Kepastian",
            "default": ""
          },
          "pesan": {
            "type": "string",
            "title": "Pesan",
            "default": ""
          },
          "tindakan": {
            "type": "string",
            "title": "Tindakan",
            "default": ""
          }
        },
        "type": "object",
        "required": [
          "id"
        ],
        "title": "NationalFinding"
      },
      "PendingRiskHit": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "setting": {
            "type": "string",
            "title": "Setting",
            "default": ""
          },
          "status": {
            "type": "string",
            "title": "Status",
            "default": ""
          },
          "icd10": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Icd10",
            "default": []
          },
          "icd9": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Icd9",
            "default": []
          },
          "absent_icd10": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Absent Icd10",
            "default": []
          },
          "absent_icd9": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Absent Icd9",
            "default": []
          },
          "precision": {
            "type": "number",
            "title": "Precision",
            "default": 0.0
          },
          "support": {
            "type": "integer",
            "title": "Support",
            "default": 0
          },
          "pending": {
            "type": "integer",
            "title": "Pending",
            "default": 0
          },
          "reason_family": {
            "type": "string",
            "title": "Reason Family",
            "default": ""
          },
          "guidance": {
            "type": "string",
            "title": "Guidance",
            "default": ""
          },
          "dokumen_diminta": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Dokumen Diminta",
            "default": []
          },
          "dasar": {
            "type": "string",
            "title": "Dasar",
            "default": ""
          },
          "periods_seen": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Periods Seen",
            "default": []
          },
          "validated_in": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Validated In",
            "default": []
          },
          "faskes_seen": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Faskes Seen",
            "default": []
          },
          "faskes_precision": {
            "additionalProperties": {
              "type": "number"
            },
            "type": "object",
            "title": "Faskes Precision",
            "default": {}
          },
          "lintas_faskes": {
            "type": "boolean",
            "title": "Lintas Faskes",
            "default": false
          },
          "terbukti_pindah": {
            "type": "boolean",
            "title": "Terbukti Pindah",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "id"
        ],
        "title": "PendingRiskHit"
      },
      "ResumeExtractionRequest": {
        "properties": {
          "soap_text": {
            "type": "string",
            "title": "Soap Text",
            "description": "Raw SOAP text or HTML from EMR"
          },
          "patient_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Patient Id"
          },
          "encounter_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Encounter Id"
          },
          "format": {
            "type": "string",
            "title": "Format",
            "default": "structured"
          }
        },
        "type": "object",
        "required": [
          "soap_text"
        ],
        "title": "ResumeExtractionRequest"
      },
      "SOAPData": {
        "properties": {
          "subjective": {
            "type": "string",
            "title": "Subjective"
          },
          "objective": {
            "type": "string",
            "title": "Objective"
          },
          "assessment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assessment"
          },
          "planning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Planning"
          }
        },
        "type": "object",
        "required": [
          "subjective",
          "objective"
        ],
        "title": "SOAPData"
      },
      "SourceRef": {
        "properties": {
          "sumber": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sumber"
          },
          "dokumen": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dokumen"
          },
          "tahun": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tahun"
          },
          "halaman": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Halaman"
          },
          "halaman_pdf": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Halaman Pdf"
          },
          "pasal": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pasal"
          },
          "kutipan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kutipan"
          }
        },
        "type": "object",
        "title": "SourceRef"
      },
      "TokenRequest": {
        "properties": {
          "api_secret": {
            "type": "string",
            "title": "Api Secret"
          }
        },
        "type": "object",
        "required": [
          "api_secret"
        ],
        "title": "TokenRequest"
      },
      "TopupKelas": {
        "properties": {
          "median": {
            "type": "integer",
            "title": "Median"
          },
          "n": {
            "type": "integer",
            "title": "N"
          }
        },
        "type": "object",
        "required": [
          "median",
          "n"
        ],
        "title": "TopupKelas"
      },
      "TopupRSInfo": {
        "properties": {
          "hospital_id": {
            "type": "string",
            "title": "Hospital Id"
          },
          "kode_faskes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kode Faskes"
          },
          "ada_data": {
            "type": "boolean",
            "title": "Ada Data",
            "default": false
          },
          "tanggal_data_terakhir": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tanggal Data Terakhir"
          },
          "catatan": {
            "type": "string",
            "title": "Catatan",
            "default": ""
          }
        },
        "type": "object",
        "required": [
          "hospital_id"
        ],
        "title": "TopupRSInfo"
      },
      "TopupRSItem": {
        "properties": {
          "kode_special_cmg": {
            "type": "string",
            "title": "Kode Special Cmg"
          },
          "kode_pmk": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kode Pmk"
          },
          "nama": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Nama"
          },
          "jenis": {
            "type": "string",
            "title": "Jenis",
            "default": ""
          },
          "median": {
            "type": "integer",
            "title": "Median"
          },
          "min": {
            "type": "integer",
            "title": "Min"
          },
          "max": {
            "type": "integer",
            "title": "Max"
          },
          "n": {
            "type": "integer",
            "title": "N"
          },
          "tanggal_data_awal": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tanggal Data Awal"
          },
          "tanggal_data_terakhir": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tanggal Data Terakhir"
          },
          "per_kelas_rawat": {
            "additionalProperties": {
              "$ref": "#/components/schemas/TopupKelas"
            },
            "type": "object",
            "title": "Per Kelas Rawat",
            "default": {}
          }
        },
        "type": "object",
        "required": [
          "kode_special_cmg",
          "median",
          "min",
          "max",
          "n"
        ],
        "title": "TopupRSItem"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.medminutes.io"
    }
  ],
  "externalDocs": {
    "url": "https://medminutes.io/developers/",
    "description": "Panduan integrasi"
  }
}
