{
  "schemaVersion": 1,
  "synthetic": true,
  "city": "nairobi",
  "citizenId": "2737098",
  "asOf": "2026-09-01",
  "fieldCount": 24,
  "rawFields": [
    {
      "name": "CitizenId",
      "type": "string or null",
      "nullable": false,
      "description": "Synthetic citizen identifier linking this visit to the exported citizen."
    },
    {
      "name": "PatientId",
      "type": "string or null",
      "nullable": false,
      "description": "Patient identifier recorded in the health export."
    },
    {
      "name": "VisitId",
      "type": "string or null",
      "nullable": false,
      "description": "Visit identifier; join key for supplied diagnoses and prescriptions."
    },
    {
      "name": "VisitDate",
      "type": "string or null",
      "nullable": false,
      "format": "YYYY-MM-DD",
      "description": "Visit calendar date recorded in the export."
    },
    {
      "name": "VisitType",
      "type": "string or null",
      "nullable": false,
      "description": "Visit type exactly as recorded, including OPD, Emergency, IPD, MCH and Immunization."
    },
    {
      "name": "TriageLevel",
      "type": "string or null",
      "nullable": true,
      "description": "Triage level exactly as recorded; null where not supplied."
    },
    {
      "name": "AdmissionDate",
      "type": "string or null",
      "nullable": true,
      "format": "YYYY-MM-DD",
      "description": "Admission calendar date; null where not supplied."
    },
    {
      "name": "DischargeDate",
      "type": "string or null",
      "nullable": true,
      "format": "YYYY-MM-DD",
      "description": "Discharge calendar date; null where not supplied; does not establish outcome."
    },
    {
      "name": "WardId",
      "type": "string or null",
      "nullable": false,
      "description": "Ward identifier recorded on the visit."
    },
    {
      "name": "LengthOfStayDays",
      "type": "string or null",
      "nullable": true,
      "description": "Calendar stay value supplied by the SQL extraction for IPD; absent from the underlying raw health.Visit block and cross-checked against admission/discharge dates."
    },
    {
      "name": "FacilityId",
      "type": "string or null",
      "nullable": false,
      "description": "Facility identifier recorded on the visit."
    },
    {
      "name": "FacilityCode",
      "type": "string or null",
      "nullable": false,
      "description": "Facility code recorded on the visit."
    },
    {
      "name": "FacilityName",
      "type": "string or null",
      "nullable": false,
      "description": "Facility name recorded on the visit."
    },
    {
      "name": "FacilityLevel",
      "type": "string or null",
      "nullable": false,
      "description": "Facility level exactly as supplied by the joined facility extraction."
    },
    {
      "name": "FacilityType",
      "type": "string or null",
      "nullable": false,
      "description": "Facility type exactly as recorded in the export."
    },
    {
      "name": "OwnershipType",
      "type": "string or null",
      "nullable": false,
      "description": "Facility ownership type exactly as recorded in the export."
    },
    {
      "name": "BedCount",
      "type": "string or null",
      "nullable": false,
      "description": "Facility bed count exactly as supplied by the extraction."
    },
    {
      "name": "HasMaternity",
      "type": "string or null",
      "nullable": false,
      "description": "Facility maternity flag exactly as supplied; does not change recorded visit types."
    },
    {
      "name": "HasEmergency",
      "type": "string or null",
      "nullable": false,
      "description": "Facility emergency flag exactly as supplied; does not change recorded visit types."
    },
    {
      "name": "AttendingStaffId",
      "type": "string or null",
      "nullable": false,
      "description": "Recorded attending staff identifier joined in the visit extraction."
    },
    {
      "name": "AttendingStaffName",
      "type": "string or null",
      "nullable": false,
      "description": "Recorded attending staff name joined in the visit extraction."
    },
    {
      "name": "StaffCategory",
      "type": "string or null",
      "nullable": false,
      "description": "Recorded category of attending staff; no role or qualification is inferred."
    },
    {
      "name": "Specialization",
      "type": "string or null",
      "nullable": true,
      "description": "Recorded attending staff specialization, null where not supplied."
    },
    {
      "name": "CreatedUtc",
      "type": "string or null",
      "nullable": false,
      "description": "Creation timestamp exactly as supplied in SQL text format."
    }
  ],
  "derivedFields": [
    {
      "name": "DiagnosisCodes",
      "type": "array of strings",
      "csvRepresentation": "Semicolon-separated ICD10 codes; empty when no diagnosis row is supplied",
      "description": "ICD10Code values from supplied diagnosis rows, paired with DiseaseName and joined by CitizenId, PatientId and VisitId.",
      "source": {
        "table": "healthDiagnoses",
        "field": "ICD10Code",
        "join": [
          "CitizenId",
          "PatientId",
          "VisitId"
        ]
      }
    },
    {
      "name": "PrescriptionCount",
      "type": "integer",
      "csvRepresentation": "Non-negative integer",
      "description": "Count of supplied raw health.Prescription rows linked to VisitId. The empty joined prescription block is not used. This is not a procedure count.",
      "source": {
        "table": "healthPrescriptions",
        "join": [
          "VisitId"
        ]
      }
    },
    {
      "name": "DerivedStayCalendarDays",
      "type": "integer or null",
      "csvRepresentation": "Empty when not derivable",
      "description": "For IPD with both dates, UTC calendar-day difference DischargeDate minus AdmissionDate; cross-checked against the supplied extraction LengthOfStayDays. Does not establish an encounter outcome.",
      "source": {
        "table": "healthVisits",
        "fields": [
          "AdmissionDate",
          "DischargeDate"
        ],
        "derivation": "UTC calendar-day difference; IPD only"
      }
    },
    {
      "name": "DiagnosisDescriptions",
      "type": "array of strings",
      "csvRepresentation": "Semicolon-separated supplied disease names; empty when no diagnosis row is supplied",
      "description": "DiseaseName values exactly as supplied in the diagnosis extraction, paired with ICD10Code and DiagnosisId. No external interpretation or inferred diagnosis.",
      "source": {
        "table": "healthDiagnoses",
        "field": "DiseaseName",
        "join": [
          "CitizenId",
          "PatientId",
          "VisitId"
        ]
      }
    },
    {
      "name": "ProcedureCodes",
      "type": "array of strings",
      "csvRepresentation": "Semicolon-separated supplied procedure codes; empty where not supplied",
      "description": "ProcedureCode values from health.ProcedureEvent linked strictly by CitizenId, PatientId and VisitId. Does not infer diagnosis-to-procedure indication.",
      "source": {
        "table": "healthProcedureEvents",
        "field": "ProcedureCode",
        "join": [
          "CitizenId",
          "PatientId",
          "VisitId"
        ],
        "scope": "procedure"
      }
    },
    {
      "name": "ProcedureOutcomeCodes",
      "type": "array of strings",
      "csvRepresentation": "Semicolon-separated supplied procedure outcome codes; empty where not supplied",
      "description": "OutcomeCode values from health.ProcedureEvent, strictly procedure-scoped. These are not encounter, discharge or overall health outcomes. UI values must identify the procedure scope.",
      "source": {
        "table": "healthProcedureEvents",
        "field": "OutcomeCode",
        "join": [
          "CitizenId",
          "PatientId",
          "VisitId"
        ],
        "scope": "procedure"
      }
    }
  ],
  "missingFields": [
    "EncounterOutcome"
  ],
  "missingFieldNotes": {
    "EncounterOutcome": "No encounter or discharge outcome field is supplied. ProcedureOutcomeCodes identify recorded procedure results only."
  },
  "nullRepresentation": "Raw JSON uses null; CSV uses an empty field. Joined arrays use semicolon-separated source values.",
  "rowOrdering": "VisitDate ascending, then original source row index.",
  "source": {
    "path": "assets/data/citizens/source-records/2737098-health-complete.json",
    "sha256": "b61864dbf68280b06db4c655a52436f3979b0bdd974ffc5bbe5117ea65a9b441"
  },
  "downloadHref": "/downloads/citizens/nairobi-2737098-health.csv",
  "sourcePointer": "/tables/healthVisits/rows/{sourceIndex}/values",
  "joinPointers": {
    "DiagnosisCodes": "/tables/healthDiagnoses/rows/{index}/values/ICD10Code",
    "DiagnosisDescriptions": "/tables/healthDiagnoses/rows/{index}/values/DiseaseName",
    "ProcedureCodes": "/tables/healthProcedureEvents/rows/{index}/values/ProcedureCode",
    "ProcedureOutcomeCodes": "/tables/healthProcedureEvents/rows/{index}/values/OutcomeCode",
    "PrescriptionCount": "/tables/healthPrescriptions/rows/{index}/values/VisitId"
  },
  "displayEligibility": {
    "minimumPopulatedFields": 5,
    "displayedFields": 6,
    "eligibleVisitCount": 189,
    "totalExportedVisits": 234
  },
  "notes": [
    "The 24 visit extraction fields are preserved exactly; joined facility/staff fields and extraction LengthOfStayDays are distinguished from the underlying raw health.Visit schema.",
    "DiagnosisDescriptions are supplied DiseaseName values, not inferred labels.",
    "ProcedureOutcomeCodes are procedure results only; no encounter/discharge outcome is supplied.",
    "The full CSV contains all 234 supplied visits, including records outside the visible completeness filter.",
    "Repeated enriched/raw table blocks are preserved in source, but the nine underlying source tables contain 639 unique records."
  ]
}
