{
  "format": "dataset-manifest/1",
  "slug": "hospital-sample-database",
  "version": 1,
  "seed": "flagship:hospital-sample-database:1k",
  "engine": 2,
  "engineVersion": "1.0.0",
  "spec": {
    "format": "dataset/1",
    "engine": 2,
    "slug": "hospital-sample-database",
    "name": "Hospital sample database",
    "tagline": "Patients, doctors, appointments, records, prescriptions, lab tests, admissions and bills for a general hospital.",
    "description": "A general hospital over five years, entirely synthetic: patients book appointments with doctors, visits leave medical records, prescriptions and lab requests, some patients are admitted to a bed and some of those go to surgery, and every visit is billed. A lab result comes after its request and the request after its record; a discharge comes after its admission and surgery after admission; a bill is the sum of its lines, a payment settles a bill in full after it was issued, and what a bill shows as paid is the sum of its payments. No row describes a real person.",
    "domain": "healthcare",
    "shape": "transactional",
    "useCases": [
      "sql-practice",
      "bi-dashboards",
      "test-fixtures"
    ],
    "keywords": [
      "hospital",
      "patients",
      "appointments",
      "electronic health records",
      "sample database"
    ],
    "locale": "en_US",
    "license": "CC0-1.0",
    "version": 1,
    "seed": "flagship:hospital-sample-database",
    "tables": {
      "admissions": {
        "description": "Rows for the admissions table.",
        "rows": 20,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "admission_date": {
            "kind": "datetime",
            "from": "2021-01-01",
            "to": "2025-12-31"
          },
          "bed_id": {
            "kind": "fk",
            "ref": "beds.id",
            "skew": "long-tail"
          },
          "discharge_date": {
            "kind": "datetime",
            "after": "admission_date",
            "withinDays": 14,
            "dayProfile": "business"
          },
          "patient_id": {
            "kind": "fk",
            "ref": "patients.id",
            "skew": "long-tail"
          },
          "primary_diagnosis": {
            "kind": "enum",
            "values": [
              "Pneumonia",
              "Heart failure",
              "Hip fracture",
              "Appendicitis",
              "Sepsis",
              "Stroke",
              "Childbirth",
              "COPD exacerbation",
              "Kidney stones",
              "Chest pain, observation"
            ]
          }
        }
      },
      "allergies": {
        "description": "Rows for the allergies table.",
        "rows": 20,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Drug",
              "Food",
              "Environmental",
              "Contact"
            ]
          },
          "name": {
            "kind": "enum",
            "values": [
              "Penicillin",
              "Amoxicillin",
              "Sulfa drugs",
              "Aspirin",
              "Ibuprofen",
              "Codeine",
              "Latex",
              "Peanuts",
              "Tree nuts",
              "Shellfish",
              "Eggs",
              "Milk",
              "Soy",
              "Wheat",
              "Bee stings",
              "Pollen",
              "Dust mites",
              "Cat dander",
              "Iodine contrast",
              "Adhesive tape"
            ],
            "unique": true
          }
        }
      },
      "appointments": {
        "description": "Rows for the appointments table.",
        "rows": 1000,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "appointment_date": {
            "kind": "datetime",
            "from": "2021-01-01",
            "to": "2025-12-31",
            "trend": "growing",
            "dayProfile": "business"
          },
          "doctor_id": {
            "kind": "fk",
            "ref": "doctors.id",
            "skew": "long-tail"
          },
          "notes": {
            "kind": "enum",
            "values": [
              "Follow-up in four weeks",
              "Referred to a specialist",
              "Routine check, no concerns",
              "Medication adjusted",
              "Tests ordered",
              "Patient advised to rest"
            ],
            "nullable": true,
            "nullRate": 0.3
          },
          "patient_id": {
            "kind": "fk",
            "ref": "patients.id",
            "skew": "long-tail"
          },
          "status": {
            "kind": "enum",
            "values": [
              "completed",
              "cancelled",
              "no_show"
            ],
            "weights": [
              84,
              11,
              5
            ]
          }
        }
      },
      "beds": {
        "description": "Rows for the beds table.",
        "rows": 600,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "bed_number": {
            "kind": "pattern",
            "pattern": "[B-]####",
            "unique": true
          },
          "room_id": {
            "kind": "fk",
            "ref": "rooms.id",
            "skew": "long-tail"
          },
          "status": {
            "kind": "enum",
            "values": [
              "occupied",
              "available",
              "cleaning",
              "maintenance"
            ],
            "weights": [
              62,
              28,
              7,
              3
            ]
          }
        }
      },
      "billing": {
        "description": "Rows for the billing table.",
        "rows": 200,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "billing_date": {
            "kind": "date",
            "from": "2021-01-01",
            "to": "2025-12-31",
            "trend": "growing"
          },
          "paid_amount": {
            "kind": "decimal",
            "min": 0,
            "max": 10000,
            "scale": 2,
            "distribution": "long-tail"
          },
          "patient_id": {
            "kind": "fk",
            "ref": "patients.id",
            "skew": "long-tail"
          },
          "status": {
            "kind": "constant",
            "value": "issued"
          },
          "total_amount": {
            "kind": "decimal",
            "min": 0,
            "max": 10000,
            "scale": 2,
            "distribution": "long-tail"
          }
        }
      },
      "billing_items": {
        "description": "Rows for the billing_items table.",
        "rows": 400,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "amount": {
            "kind": "decimal",
            "min": 20,
            "max": 2500,
            "scale": 2,
            "distribution": "long-tail"
          },
          "billing_id": {
            "kind": "fk",
            "ref": "billing.id",
            "skew": "flat"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Consultation",
              "Lab test",
              "Medication",
              "Room charge",
              "Procedure",
              "Imaging",
              "Emergency visit"
            ],
            "weights": [
              30,
              20,
              18,
              8,
              8,
              10,
              6
            ]
          }
        }
      },
      "departments": {
        "description": "Rows for the departments table.",
        "rows": 12,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Open 24 hours",
              "Weekdays only",
              "By referral",
              "Outpatient and inpatient"
            ]
          },
          "name": {
            "kind": "enum",
            "values": [
              "Emergency",
              "Internal Medicine",
              "Cardiology",
              "Pediatrics",
              "Obstetrics",
              "Orthopedics",
              "Neurology",
              "Oncology",
              "Radiology",
              "General Surgery",
              "Psychiatry",
              "Laboratory"
            ],
            "unique": true
          },
          "phone": {
            "kind": "place.phone"
          }
        }
      },
      "doctors": {
        "description": "Rows for the doctors table.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "biography": {
            "kind": "enum",
            "values": [
              "Board certified",
              "Fellowship trained",
              "Accepting new patients",
              "Teaching faculty"
            ]
          },
          "license_number": {
            "kind": "pattern",
            "pattern": "[MD]-######",
            "unique": true
          },
          "specialty": {
            "kind": "enum",
            "values": [
              "family_medicine",
              "internal_medicine",
              "cardiology",
              "pediatrics",
              "obstetrics",
              "orthopedics",
              "neurology",
              "oncology",
              "general_surgery",
              "psychiatry"
            ],
            "weights": [
              22,
              18,
              9,
              10,
              7,
              8,
              6,
              6,
              8,
              6
            ]
          },
          "staff_id": {
            "kind": "fk",
            "ref": "staff.id",
            "unique": true
          }
        }
      },
      "insurance_policies": {
        "description": "Rows for the insurance_policies table.",
        "rows": 40,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "coverage_details": {
            "kind": "enum",
            "values": [
              "Inpatient and outpatient",
              "Outpatient only",
              "Inpatient only",
              "Catastrophic"
            ],
            "weights": [
              60,
              20,
              10,
              10
            ]
          },
          "expiry_date": {
            "kind": "date",
            "from": "2024-01-01",
            "to": "2028-12-31"
          },
          "patient_id": {
            "kind": "fk",
            "ref": "patients.id",
            "unique": true
          },
          "policy_number": {
            "kind": "pattern",
            "pattern": "[POL]-#########",
            "unique": true
          },
          "provider_id": {
            "kind": "fk",
            "ref": "insurance_providers.id",
            "skew": "long-tail"
          }
        }
      },
      "insurance_providers": {
        "description": "Rows for the insurance_providers table.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "address": {
            "kind": "location.streetAddress"
          },
          "contact_person": {
            "kind": "person.fullName"
          },
          "email": {
            "kind": "internet.email"
          },
          "name": {
            "kind": "company.name"
          },
          "phone": {
            "kind": "phone.number"
          }
        }
      },
      "inventory_categories": {
        "description": "Rows for the inventory_categories table.",
        "rows": 8,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Single use",
              "Reusable",
              "Sterile"
            ]
          },
          "name": {
            "kind": "enum",
            "values": [
              "dressings",
              "syringes",
              "gloves",
              "linens",
              "iv_supplies",
              "cleaning",
              "surgical_instruments",
              "office"
            ],
            "unique": true
          }
        }
      },
      "inventory_items": {
        "description": "Rows for the inventory_items table.",
        "rows": 150,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "category_id": {
            "kind": "fk",
            "ref": "inventory_categories.id",
            "skew": "long-tail"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Box of 100",
              "Box of 50",
              "Case of 12",
              "Single unit"
            ]
          },
          "name": {
            "kind": "enum",
            "values": [
              "Gauze pads",
              "Adhesive bandages",
              "Nitrile gloves",
              "Surgical masks",
              "Syringes 5 ml",
              "Syringes 10 ml",
              "IV cannulas",
              "Saline bags",
              "Bed sheets",
              "Pillowcases",
              "Hand sanitizer",
              "Disinfectant wipes",
              "Scalpel blades",
              "Sutures",
              "Specimen cups",
              "Printer paper"
            ]
          },
          "quantity_in_stock": {
            "kind": "int",
            "min": 0,
            "max": 2000,
            "distribution": "long-tail"
          },
          "unit_price": {
            "kind": "decimal",
            "min": 0.5,
            "max": 120,
            "scale": 2,
            "distribution": "long-tail"
          }
        }
      },
      "lab_requests": {
        "description": "Rows for the lab_requests table.",
        "rows": 120,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "doctor_id": {
            "kind": "fk",
            "ref": "doctors.id",
            "skew": "long-tail"
          },
          "medical_record_id": {
            "kind": "fk",
            "ref": "medical_records.id",
            "skew": "long-tail"
          },
          "request_date": {
            "kind": "datetime",
            "after": "medical_record_id.created_at",
            "withinSeconds": 7200
          },
          "status": {
            "kind": "enum",
            "values": [
              "completed",
              "in_progress",
              "cancelled"
            ],
            "weights": [
              90,
              4,
              6
            ]
          },
          "test_id": {
            "kind": "fk",
            "ref": "lab_tests.id",
            "skew": "long-tail"
          }
        }
      },
      "lab_results": {
        "description": "Rows for the lab_results table.",
        "rows": 110,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "performed_date": {
            "kind": "datetime",
            "after": "request_id.request_date",
            "withinDays": 3,
            "dayProfile": "business"
          },
          "request_id": {
            "kind": "fk",
            "ref": "lab_requests.id",
            "unique": true
          },
          "result_details": {
            "kind": "enum",
            "values": [
              "Within normal range",
              "Slightly elevated",
              "Below normal range",
              "Markedly elevated",
              "Inconclusive, repeat advised"
            ],
            "weights": [
              62,
              18,
              10,
              6,
              4
            ]
          },
          "technician_id": {
            "kind": "fk",
            "ref": "staff.id",
            "skew": "long-tail"
          }
        }
      },
      "lab_tests": {
        "description": "Rows for the lab_tests table.",
        "rows": 40,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "cost": {
            "kind": "decimal",
            "min": 15,
            "max": 400,
            "scale": 2,
            "distribution": "long-tail"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Blood sample",
              "Urine sample",
              "Swab",
              "Stool sample"
            ],
            "weights": [
              70,
              15,
              10,
              5
            ]
          },
          "name": {
            "kind": "enum",
            "values": [
              "Complete blood count",
              "Basic metabolic panel",
              "Comprehensive metabolic panel",
              "Lipid panel",
              "Hemoglobin A1c",
              "Thyroid stimulating hormone",
              "Free T4",
              "Liver function panel",
              "Kidney function panel",
              "Urinalysis",
              "Urine culture",
              "Blood culture",
              "C-reactive protein",
              "Erythrocyte sedimentation rate",
              "Prothrombin time",
              "D-dimer",
              "Troponin",
              "B-type natriuretic peptide",
              "Vitamin D",
              "Vitamin B12",
              "Ferritin",
              "Iron panel",
              "Folate",
              "Magnesium",
              "Phosphate",
              "Calcium",
              "Uric acid",
              "Amylase",
              "Lipase",
              "Pregnancy test",
              "Strep A rapid test",
              "Influenza rapid test",
              "COVID-19 PCR",
              "Stool culture",
              "Hepatitis panel",
              "HIV screen",
              "Blood type and screen",
              "Arterial blood gas",
              "Lactate",
              "Glucose tolerance test"
            ],
            "unique": true
          }
        }
      },
      "medical_records": {
        "description": "Rows for the medical_records table.",
        "rows": 250,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "created_at": {
            "kind": "datetime",
            "from": "2021-01-01",
            "to": "2025-12-31",
            "trend": "growing",
            "dayProfile": "business"
          },
          "diagnosis": {
            "kind": "enum",
            "values": [
              "Hypertension",
              "Type 2 diabetes",
              "Upper respiratory infection",
              "Lower back pain",
              "Anxiety",
              "Asthma",
              "Urinary tract infection",
              "Migraine",
              "Hyperlipidemia",
              "Osteoarthritis",
              "Gastroenteritis",
              "Sprained ankle"
            ]
          },
          "doctor_id": {
            "kind": "fk",
            "ref": "doctors.id",
            "skew": "long-tail"
          },
          "patient_id": {
            "kind": "fk",
            "ref": "patients.id",
            "skew": "long-tail"
          },
          "treatment_plan": {
            "kind": "enum",
            "values": [
              "Medication and follow-up",
              "Lifestyle changes",
              "Physical therapy",
              "Watchful waiting",
              "Referral to specialist",
              "Further tests"
            ]
          }
        }
      },
      "medications": {
        "description": "Rows for the medications table.",
        "rows": 120,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "brand": {
            "kind": "company.name"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Prescription only",
              "Over the counter",
              "Hospital use only"
            ],
            "weights": [
              60,
              25,
              15
            ]
          },
          "dosage_form": {
            "kind": "enum",
            "values": [
              "tablet",
              "capsule",
              "syrup",
              "injection",
              "inhaler",
              "cream"
            ],
            "weights": [
              45,
              25,
              8,
              8,
              6,
              8
            ]
          },
          "name": {
            "kind": "enum",
            "values": [
              "Amoxicillin",
              "Ibuprofen",
              "Paracetamol",
              "Metformin",
              "Atorvastatin",
              "Omeprazole",
              "Lisinopril",
              "Amlodipine",
              "Simvastatin",
              "Levothyroxine",
              "Metoprolol",
              "Losartan",
              "Azithromycin",
              "Cetirizine",
              "Loratadine",
              "Prednisone",
              "Sertraline",
              "Fluoxetine",
              "Gabapentin",
              "Hydrochlorothiazide",
              "Pantoprazole",
              "Montelukast",
              "Salbutamol",
              "Insulin Glargine",
              "Clopidogrel",
              "Warfarin",
              "Furosemide",
              "Ciprofloxacin",
              "Doxycycline",
              "Naproxen",
              "Diclofenac",
              "Esomeprazole",
              "Rosuvastatin",
              "Escitalopram",
              "Bupropion",
              "Tamsulosin",
              "Finasteride",
              "Allopurinol",
              "Ondansetron",
              "Loperamide",
              "Famotidine",
              "Cholecalciferol",
              "Folic Acid",
              "Ferrous Sulfate",
              "Melatonin",
              "Zinc Sulfate",
              "Hydrocortisone",
              "Clotrimazole",
              "Fluticasone",
              "Budesonide"
            ]
          },
          "strength": {
            "kind": "enum",
            "values": [
              "5 mg",
              "10 mg",
              "20 mg",
              "40 mg",
              "100 mg",
              "250 mg",
              "500 mg",
              "1 g"
            ]
          }
        }
      },
      "patient_allergies": {
        "description": "Rows for the patient_allergies table.",
        "rows": 30,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "allergy_id": {
            "kind": "fk",
            "ref": "allergies.id",
            "skew": "long-tail"
          },
          "patient_id": {
            "kind": "fk",
            "ref": "patients.id",
            "skew": "long-tail"
          },
          "severity": {
            "kind": "enum",
            "values": [
              "low",
              "medium",
              "high"
            ],
            "weights": [
              55,
              33,
              12
            ]
          }
        }
      },
      "patients": {
        "description": "Rows for the patients table.",
        "rows": 80,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "address": {
            "kind": "location.streetAddress"
          },
          "date_of_birth": {
            "kind": "date",
            "from": "1935-01-01",
            "to": "2024-12-31"
          },
          "email": {
            "kind": "internet.email",
            "from": {
              "firstName": "first_name",
              "lastName": "last_name"
            }
          },
          "emergency_contact": {
            "kind": "person.fullName"
          },
          "first_name": {
            "kind": "person.firstName"
          },
          "gender": {
            "kind": "enum",
            "values": [
              "female",
              "male",
              "unspecified"
            ],
            "weights": [
              51,
              47,
              2
            ]
          },
          "last_name": {
            "kind": "person.lastName"
          },
          "phone": {
            "kind": "phone.number"
          }
        }
      },
      "payments": {
        "description": "Rows for the payments table.",
        "rows": 180,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "amount": {
            "kind": "decimal",
            "min": 0,
            "max": 7907,
            "scale": 2,
            "distribution": "long-tail"
          },
          "billing_id": {
            "kind": "fk",
            "ref": "billing.id",
            "unique": true
          },
          "payment_date": {
            "kind": "datetime",
            "from": "2023-01-01",
            "to": "2025-12-31"
          },
          "payment_method": {
            "kind": "enum",
            "values": [
              "insurance",
              "card",
              "cash",
              "bank_transfer"
            ],
            "weights": [
              55,
              30,
              5,
              10
            ]
          }
        }
      },
      "prescription_items": {
        "description": "Rows for the prescription_items table.",
        "rows": 220,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "dosage": {
            "kind": "enum",
            "values": [
              "1 tablet",
              "2 tablets",
              "5 ml",
              "10 ml",
              "1 puff",
              "2 puffs",
              "1 application"
            ]
          },
          "duration": {
            "kind": "enum",
            "values": [
              "3 days",
              "5 days",
              "7 days",
              "10 days",
              "14 days",
              "30 days",
              "ongoing"
            ],
            "weights": [
              8,
              14,
              22,
              12,
              10,
              20,
              14
            ]
          },
          "frequency": {
            "kind": "enum",
            "values": [
              "once daily",
              "twice daily",
              "three times daily",
              "every 8 hours",
              "as needed",
              "at night"
            ],
            "weights": [
              35,
              25,
              12,
              8,
              12,
              8
            ]
          },
          "medication_id": {
            "kind": "fk",
            "ref": "medications.id",
            "skew": "long-tail"
          },
          "prescription_id": {
            "kind": "fk",
            "ref": "prescriptions.id",
            "skew": "long-tail"
          }
        }
      },
      "prescriptions": {
        "description": "Rows for the prescriptions table.",
        "rows": 150,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "doctor_id": {
            "kind": "fk",
            "ref": "doctors.id",
            "skew": "long-tail"
          },
          "instructions": {
            "kind": "enum",
            "values": [
              "Take with food",
              "Take on an empty stomach",
              "Avoid alcohol",
              "Do not drive if drowsy",
              "Finish the full course"
            ]
          },
          "medical_record_id": {
            "kind": "fk",
            "ref": "medical_records.id",
            "skew": "long-tail"
          },
          "prescribed_date": {
            "kind": "date",
            "after": "medical_record_id.created_at",
            "withinDays": 1
          }
        }
      },
      "purchase_order_items": {
        "description": "Rows for the purchase_order_items table.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "item_id": {
            "kind": "fk",
            "ref": "inventory_items.id",
            "skew": "long-tail"
          },
          "purchase_order_id": {
            "kind": "fk",
            "ref": "purchase_orders.id",
            "skew": "long-tail"
          },
          "quantity": {
            "kind": "int",
            "min": 1,
            "max": 40
          },
          "unit_price": {
            "kind": "decimal",
            "min": 0.5,
            "max": 120,
            "scale": 2
          }
        }
      },
      "purchase_orders": {
        "description": "Rows for the purchase_orders table.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "order_date": {
            "kind": "date",
            "from": "2021-01-01",
            "to": "2025-12-31"
          },
          "status": {
            "kind": "enum",
            "values": [
              "received",
              "ordered",
              "cancelled"
            ],
            "weights": [
              85,
              10,
              5
            ]
          },
          "total_cost": {
            "kind": "decimal",
            "min": 1,
            "max": 10000,
            "scale": 2,
            "distribution": "long-tail"
          },
          "vendor_id": {
            "kind": "fk",
            "ref": "vendors.id",
            "skew": "long-tail"
          }
        }
      },
      "rooms": {
        "description": "Rows for the rooms table.",
        "rows": 200,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "room_number": {
            "kind": "pattern",
            "pattern": "###",
            "unique": true
          },
          "status": {
            "kind": "enum",
            "values": [
              "in_use",
              "cleaning",
              "closed"
            ],
            "weights": [
              88,
              8,
              4
            ]
          },
          "type": {
            "kind": "enum",
            "values": [
              "single",
              "double",
              "four_bed",
              "icu"
            ],
            "weights": [
              30,
              35,
              25,
              10
            ]
          },
          "ward_id": {
            "kind": "fk",
            "ref": "wards.id",
            "skew": "long-tail"
          }
        }
      },
      "schedules": {
        "description": "Rows for the schedules table.",
        "rows": 20,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "day_of_week": {
            "kind": "enum",
            "values": [
              "monday"
            ],
            "nullable": true,
            "nullRate": 1
          },
          "shift_end": {
            "kind": "datetime",
            "after": "shift_start",
            "withinSeconds": 43200
          },
          "shift_start": {
            "kind": "datetime",
            "from": "2021-01-01",
            "to": "2025-12-31",
            "dayProfile": "business"
          },
          "staff_id": {
            "kind": "fk",
            "ref": "staff.id",
            "skew": "long-tail"
          }
        }
      },
      "staff": {
        "description": "Rows for the staff table.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "department_id": {
            "kind": "fk",
            "ref": "departments.id",
            "skew": "long-tail"
          },
          "email": {
            "kind": "internet.email",
            "from": {
              "firstName": "first_name",
              "lastName": "last_name"
            },
            "unique": true
          },
          "first_name": {
            "kind": "person.firstName"
          },
          "hire_date": {
            "kind": "date",
            "from": "2005-01-01",
            "to": "2025-06-30"
          },
          "last_name": {
            "kind": "person.lastName"
          },
          "phone": {
            "kind": "phone.number"
          },
          "role_id": {
            "kind": "fk",
            "ref": "staff_roles.id",
            "skew": "long-tail"
          }
        }
      },
      "staff_roles": {
        "description": "Rows for the staff_roles table.",
        "rows": 8,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Clinical",
              "Clinical support",
              "Administrative"
            ]
          },
          "title": {
            "kind": "enum",
            "values": [
              "physician",
              "nurse",
              "surgeon",
              "lab_technician",
              "pharmacist",
              "receptionist",
              "administrator",
              "radiologist"
            ],
            "unique": true
          }
        }
      },
      "surgeries": {
        "description": "Rows for the surgeries table.",
        "rows": 30,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "description": {
            "kind": "enum",
            "values": [
              "Day case",
              "One to three nights",
              "Longer stay"
            ]
          },
          "name": {
            "kind": "enum",
            "values": [
              "Appendectomy",
              "Cholecystectomy",
              "Hernia repair",
              "Hip replacement",
              "Knee replacement",
              "Cesarean section",
              "Coronary bypass",
              "Angioplasty",
              "Cataract surgery",
              "Tonsillectomy",
              "Spinal fusion",
              "Mastectomy",
              "Hysterectomy",
              "Prostatectomy",
              "Carpal tunnel release",
              "Arthroscopy",
              "Colectomy",
              "Gastric bypass",
              "Thyroidectomy",
              "Lumpectomy",
              "Pacemaker insertion",
              "Fracture fixation",
              "Skin graft",
              "Amputation",
              "Craniotomy",
              "Kidney transplant",
              "Liver resection",
              "Varicose vein surgery",
              "Rotator cuff repair",
              "Sinus surgery"
            ],
            "unique": true
          },
          "risk_level": {
            "kind": "enum",
            "values": [
              "low",
              "moderate",
              "high"
            ],
            "weights": [
              40,
              40,
              20
            ]
          }
        }
      },
      "surgical_procedures": {
        "description": "Rows for the surgical_procedures table.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "admission_id": {
            "kind": "fk",
            "ref": "admissions.id",
            "unique": true
          },
          "duration_minutes": {
            "kind": "int",
            "min": 30,
            "max": 360,
            "distribution": "long-tail"
          },
          "lead_surgeon_id": {
            "kind": "fk",
            "ref": "doctors.id",
            "skew": "long-tail"
          },
          "scheduled_time": {
            "kind": "datetime",
            "after": "admission_id.admission_date",
            "withinDays": 2,
            "dayProfile": "business"
          },
          "surgery_id": {
            "kind": "fk",
            "ref": "surgeries.id",
            "skew": "long-tail"
          }
        }
      },
      "vendors": {
        "description": "Rows for the vendors table.",
        "rows": 20,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "address": {
            "kind": "location.streetAddress"
          },
          "contact_name": {
            "kind": "person.fullName"
          },
          "email": {
            "kind": "internet.email"
          },
          "name": {
            "kind": "company.name"
          },
          "phone": {
            "kind": "phone.number"
          }
        }
      },
      "visitors": {
        "description": "Rows for the visitors table.",
        "rows": 30,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "name": {
            "kind": "person.fullName"
          },
          "patient_id": {
            "kind": "fk",
            "ref": "patients.id",
            "skew": "long-tail"
          },
          "relationship": {
            "kind": "enum",
            "values": [
              "spouse",
              "parent",
              "child",
              "sibling",
              "friend"
            ],
            "weights": [
              30,
              20,
              25,
              15,
              10
            ]
          },
          "visit_time_in": {
            "kind": "datetime",
            "from": "2021-01-01",
            "to": "2025-12-31",
            "dayProfile": "waking"
          },
          "visit_time_out": {
            "kind": "datetime",
            "after": "visit_time_in",
            "withinSeconds": 7200
          }
        }
      },
      "wards": {
        "description": "Rows for the wards table.",
        "rows": 20,
        "columns": {
          "id": {
            "kind": "pk"
          },
          "capacity": {
            "kind": "int",
            "min": 10,
            "max": 40
          },
          "department_id": {
            "kind": "fk",
            "ref": "departments.id",
            "skew": "long-tail"
          },
          "name": {
            "kind": "pattern",
            "pattern": "[Ward ]A",
            "unique": true
          },
          "type": {
            "kind": "enum",
            "values": [
              "general",
              "icu",
              "maternity",
              "pediatric",
              "surgical",
              "oncology"
            ],
            "weights": [
              40,
              10,
              12,
              12,
              16,
              10
            ]
          }
        }
      }
    }
  },
  "counts": {
    "allergies": 20,
    "departments": 12,
    "insurance_providers": 10,
    "inventory_categories": 8,
    "inventory_items": 150,
    "lab_tests": 40,
    "medications": 120,
    "patients": 80,
    "billing": 200,
    "billing_items": 400,
    "insurance_policies": 40,
    "patient_allergies": 30,
    "payments": 180,
    "staff_roles": 8,
    "staff": 10,
    "doctors": 10,
    "appointments": 1000,
    "medical_records": 250,
    "lab_requests": 120,
    "lab_results": 110,
    "prescriptions": 150,
    "prescription_items": 220,
    "schedules": 20,
    "surgeries": 30,
    "vendors": 20,
    "purchase_orders": 10,
    "purchase_order_items": 10,
    "visitors": 30,
    "wards": 20,
    "rooms": 200,
    "beds": 600,
    "admissions": 20,
    "surgical_procedures": 10
  },
  "artifacts": [
    {
      "file": "csv/allergies.csv",
      "format": "csv",
      "table": "allergies",
      "key": "datasets/hospital-sample-database/v1/csv/allergies.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/allergies.csv",
      "bytes": 452,
      "sha256": "d6edeced4ae65aa6027e563b48d32cd084a10b49b8bde909dcd21f116dc5e7ef",
      "rows": 20,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/departments.csv",
      "format": "csv",
      "table": "departments",
      "key": "datasets/hospital-sample-database/v1/csv/departments.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/departments.csv",
      "bytes": 585,
      "sha256": "114086573c82834b939a749afc5115964580e8ab9031c7e6946e833ca890606d",
      "rows": 12,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/insurance_providers.csv",
      "format": "csv",
      "table": "insurance_providers",
      "key": "datasets/hospital-sample-database/v1/csv/insurance_providers.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/insurance_providers.csv",
      "bytes": 1053,
      "sha256": "70fdda0821ef9f29995a10e93b4882aeb5248f5bc9048d7e2dd0c126e528345c",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/inventory_categories.csv",
      "format": "csv",
      "table": "inventory_categories",
      "key": "datasets/hospital-sample-database/v1/csv/inventory_categories.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/inventory_categories.csv",
      "bytes": 198,
      "sha256": "df4426fde3644ba663751db8b1a7d3718e19a3de4164f1bba1a0a26d2c7dea61",
      "rows": 8,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/inventory_items.csv",
      "format": "csv",
      "table": "inventory_items",
      "key": "datasets/hospital-sample-database/v1/csv/inventory_items.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/inventory_items.csv",
      "bytes": 6175,
      "sha256": "46f268137409aab4cf7c074cd9084316f4f23715c834ba3983aa9041b438ae22",
      "rows": 150,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/lab_tests.csv",
      "format": "csv",
      "table": "lab_tests",
      "key": "datasets/hospital-sample-database/v1/csv/lab_tests.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/lab_tests.csv",
      "bytes": 1536,
      "sha256": "3a883c82df21f80173c9ac00d7dc0550f78902f04ab377be7604a215182efd21",
      "rows": 40,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/medications.csv",
      "format": "csv",
      "table": "medications",
      "key": "datasets/hospital-sample-database/v1/csv/medications.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/medications.csv",
      "bytes": 8244,
      "sha256": "893894a5eb9a0858727b57040a86ce741cab028fdf43f596344d1ce8173e07f5",
      "rows": 120,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/patients.csv",
      "format": "csv",
      "table": "patients",
      "key": "datasets/hospital-sample-database/v1/csv/patients.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/patients.csv",
      "bytes": 9070,
      "sha256": "6b8b63a836ef3fe8eaca794346d55320d2546324f51703b9b43f0bc65b650bfb",
      "rows": 80,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/billing.csv",
      "format": "csv",
      "table": "billing",
      "key": "datasets/hospital-sample-database/v1/csv/billing.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/billing.csv",
      "bytes": 7729,
      "sha256": "5498362ebf09065167d2128209f6543529771cd7651c833baa20646a7079e677",
      "rows": 200,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/billing_items.csv",
      "format": "csv",
      "table": "billing_items",
      "key": "datasets/hospital-sample-database/v1/csv/billing_items.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/billing_items.csv",
      "bytes": 10668,
      "sha256": "eab91b6ce1bd0a48a1850a254e769b143bce11f4362c5f20b9b56df72c783e49",
      "rows": 400,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/insurance_policies.csv",
      "format": "csv",
      "table": "insurance_policies",
      "key": "datasets/hospital-sample-database/v1/csv/insurance_policies.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/insurance_policies.csv",
      "bytes": 2283,
      "sha256": "98132ec684ff285a7da022e4c7c3f165b315d793a414c603aa149a15eb7ea74c",
      "rows": 40,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/patient_allergies.csv",
      "format": "csv",
      "table": "patient_allergies",
      "key": "datasets/hospital-sample-database/v1/csv/patient_allergies.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/patient_allergies.csv",
      "bytes": 435,
      "sha256": "e6873170548f277f9565f1b42a814fd194cb9ce7200360446271ad2e0628917a",
      "rows": 30,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/payments.csv",
      "format": "csv",
      "table": "payments",
      "key": "datasets/hospital-sample-database/v1/csv/payments.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/payments.csv",
      "bytes": 7837,
      "sha256": "5f1c4ecc87b19281a4bb483054fb246f9acde63ecf37638f31e66322c1cdef52",
      "rows": 180,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/staff_roles.csv",
      "format": "csv",
      "table": "staff_roles",
      "key": "datasets/hospital-sample-database/v1/csv/staff_roles.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/staff_roles.csv",
      "bytes": 233,
      "sha256": "3a05a7143efb3d32b83757c0e192ff4cae271d97d255725490edb572cba374fe",
      "rows": 8,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/staff.csv",
      "format": "csv",
      "table": "staff",
      "key": "datasets/hospital-sample-database/v1/csv/staff.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/staff.csv",
      "bytes": 791,
      "sha256": "2dfa60c45b2397da5cbae800cc8a1ff7a8ff7958989ce18c7974b502704bab9a",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/doctors.csv",
      "format": "csv",
      "table": "doctors",
      "key": "datasets/hospital-sample-database/v1/csv/doctors.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/doctors.csv",
      "bytes": 515,
      "sha256": "7bd404137ec26d932e8dc6b4b92227b5c2ca5d0dad62a4514d4c00dad75dbbd4",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/appointments.csv",
      "format": "csv",
      "table": "appointments",
      "key": "datasets/hospital-sample-database/v1/csv/appointments.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/appointments.csv",
      "bytes": 55879,
      "sha256": "548f42887546d0c0cdff85e5dea6f0dd0529fde33f86abba40f860ffa80e71da",
      "rows": 1000,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/medical_records.csv",
      "format": "csv",
      "table": "medical_records",
      "key": "datasets/hospital-sample-database/v1/csv/medical_records.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/medical_records.csv",
      "bytes": 16016,
      "sha256": "3d051f96dbc933c79d963d224edebecb209cbf2d7bd297fb678a2fc4ad0d131d",
      "rows": 250,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/lab_requests.csv",
      "format": "csv",
      "table": "lab_requests",
      "key": "datasets/hospital-sample-database/v1/csv/lab_requests.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/lab_requests.csv",
      "bytes": 5081,
      "sha256": "9442fdde47b0ce7914aec86a9a58edcf7caaaba583bf2a80e27dca200160b97d",
      "rows": 120,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/lab_results.csv",
      "format": "csv",
      "table": "lab_results",
      "key": "datasets/hospital-sample-database/v1/csv/lab_results.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/lab_results.csv",
      "bytes": 5446,
      "sha256": "437d9a2e53962937a37c8605b696cd1ceb9c85245330eeafc772567421f74125",
      "rows": 110,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/prescriptions.csv",
      "format": "csv",
      "table": "prescriptions",
      "key": "datasets/hospital-sample-database/v1/csv/prescriptions.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/prescriptions.csv",
      "bytes": 6170,
      "sha256": "0771364528031f173bdd269b01fb20552d7532a4d66037b7faa952d30d6c4bbb",
      "rows": 150,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/prescription_items.csv",
      "format": "csv",
      "table": "prescription_items",
      "key": "datasets/hospital-sample-database/v1/csv/prescription_items.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/prescription_items.csv",
      "bytes": 8411,
      "sha256": "f3ea4c09b75317700c074fa533bae97d24b6072361e1bca3d781a883d92ad499",
      "rows": 220,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/schedules.csv",
      "format": "csv",
      "table": "schedules",
      "key": "datasets/hospital-sample-database/v1/csv/schedules.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/schedules.csv",
      "bytes": 979,
      "sha256": "1d58bbbe93413da6211ca2bed376623da64f4a01e862d1506fd5ab61ab284a2e",
      "rows": 20,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/surgeries.csv",
      "format": "csv",
      "table": "surgeries",
      "key": "datasets/hospital-sample-database/v1/csv/surgeries.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/surgeries.csv",
      "bytes": 1144,
      "sha256": "bfa636897717f715aadadf9d9e13f6a22d9f3c16f2c27a80bdef226ec747b1ce",
      "rows": 30,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/vendors.csv",
      "format": "csv",
      "table": "vendors",
      "key": "datasets/hospital-sample-database/v1/csv/vendors.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/vendors.csv",
      "bytes": 2049,
      "sha256": "c9b018cbf0f54991d7938f597a38581b91c2ef0ea74d749a598e0e19afa7174a",
      "rows": 20,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/purchase_orders.csv",
      "format": "csv",
      "table": "purchase_orders",
      "key": "datasets/hospital-sample-database/v1/csv/purchase_orders.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/purchase_orders.csv",
      "bytes": 374,
      "sha256": "c8a7e11b22635dabb9531c4b7daddb10aa88362af1f177780a4f8b609d76a92f",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/purchase_order_items.csv",
      "format": "csv",
      "table": "purchase_order_items",
      "key": "datasets/hospital-sample-database/v1/csv/purchase_order_items.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/purchase_order_items.csv",
      "bytes": 218,
      "sha256": "9d1e20abfb3771e22cab76dda85d9d6952eea98eb18eddf14f9b530c2c0b4f48",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/visitors.csv",
      "format": "csv",
      "table": "visitors",
      "key": "datasets/hospital-sample-database/v1/csv/visitors.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/visitors.csv",
      "bytes": 2139,
      "sha256": "92a9c434d84d5c14d440d3b56c455d425a520916c50e2cb820291fc5bbb795ba",
      "rows": 30,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/wards.csv",
      "format": "csv",
      "table": "wards",
      "key": "datasets/hospital-sample-database/v1/csv/wards.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/wards.csv",
      "bytes": 517,
      "sha256": "975adba879232e5b130e79d0021a0e0d74d228aa3d2ac095bcf6fa785bec402c",
      "rows": 20,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/rooms.csv",
      "format": "csv",
      "table": "rooms",
      "key": "datasets/hospital-sample-database/v1/csv/rooms.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/rooms.csv",
      "bytes": 5053,
      "sha256": "545b0c1fe8a5e39200867cfc702b012128e0a040d2ca5fc4c5fbbf1f626651ca",
      "rows": 200,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/beds.csv",
      "format": "csv",
      "table": "beds",
      "key": "datasets/hospital-sample-database/v1/csv/beds.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/beds.csv",
      "bytes": 14589,
      "sha256": "446ececf34c627a7f68254c989870aad4aa860345c53fbc87ee5025eb67410a8",
      "rows": 600,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/admissions.csv",
      "format": "csv",
      "table": "admissions",
      "key": "datasets/hospital-sample-database/v1/csv/admissions.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/admissions.csv",
      "bytes": 1360,
      "sha256": "b42d3be4893566e6207da300b78f6be0b86d96bc81b2d3128a38a6f6bbcd5963",
      "rows": 20,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/surgical_procedures.csv",
      "format": "csv",
      "table": "surgical_procedures",
      "key": "datasets/hospital-sample-database/v1/csv/surgical_procedures.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/csv/surgical_procedures.csv",
      "bytes": 413,
      "sha256": "dc2c57dc68a579b4293b558de7240afa67c1440116e6cbf6915fa518a1c0130c",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "hospital-sample-database.json",
      "format": "json",
      "table": null,
      "key": "datasets/hospital-sample-database/v1/hospital-sample-database.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/hospital-sample-database.json",
      "bytes": 670027,
      "sha256": "e82b9ce2ef88a2d1209fa04b3958378556604a2bf96af0e9aa36ed840ee27a82",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/hospital-sample-database/v1/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/sql/postgres.sql",
      "bytes": 267511,
      "sha256": "ea4f8340cdde08f529c96c5abe6389a38cb43e67e7493588a6473f6880ad7f02",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/hospital-sample-database/v1/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/sql/mysql.sql",
      "bytes": 264329,
      "sha256": "e346af61a3d92da341cf444b4ea1cadd35d47571a2c9763c4ae31f9b1a65aca7",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/hospital-sample-database/v1/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/sql/mssql.sql",
      "bytes": 276233,
      "sha256": "d5138e494941a93b708428b028e4444ec159a9926922ef24fd7d7914837f0afd",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/hospital-sample-database/v1/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/sql/sqlite.sql",
      "bytes": 261488,
      "sha256": "69d2a15b3181c8344d84895290e7535a9e1917fbf362b96d629b16e67d90818c",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/hospital-sample-database/v1/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/prisma/seed.ts",
      "bytes": 534003,
      "sha256": "e47df53f405e790632dfc65f969c5762b895e079c89b66a6b8fc050ba945b2cd",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/hospital-sample-database/v1/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/django/fixtures.json",
      "bytes": 846393,
      "sha256": "53a565525885ce31358a742620ad2a7a741147ab707ed8dc65b4c9912e322c77",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "flagship": {
    "sizes": {
      "1k": {
        "rows": 4138,
        "counts": {
          "allergies": 20,
          "departments": 12,
          "insurance_providers": 10,
          "inventory_categories": 8,
          "inventory_items": 150,
          "lab_tests": 40,
          "medications": 120,
          "patients": 80,
          "billing": 200,
          "billing_items": 400,
          "insurance_policies": 40,
          "patient_allergies": 30,
          "payments": 180,
          "staff_roles": 8,
          "staff": 10,
          "doctors": 10,
          "appointments": 1000,
          "medical_records": 250,
          "lab_requests": 120,
          "lab_results": 110,
          "prescriptions": 150,
          "prescription_items": 220,
          "schedules": 20,
          "surgeries": 30,
          "vendors": 20,
          "purchase_orders": 10,
          "purchase_order_items": 10,
          "visitors": 30,
          "wards": 20,
          "rooms": 200,
          "beds": 600,
          "admissions": 20,
          "surgical_procedures": 10
        },
        "notes": [],
        "downloads": [
          {
            "format": "sql-postgres",
            "label": "PostgreSQL",
            "file": "flagship/1k/postgres.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/1k/postgres.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1k/postgres.sql.gz",
            "bytes": 63567,
            "sha256": "c99603444be1c202e473852a90bab2241e6858b7038f7c6b9f6529bb9a83c0dc",
            "raw": {
              "bytes": 276789,
              "sha256": "399544cdd8147035cb2643e794718e214ae9b6e5922c23d456bdc4a40af29527"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "sql-mysql",
            "label": "MySQL",
            "file": "flagship/1k/mysql.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/1k/mysql.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1k/mysql.sql.gz",
            "bytes": 63110,
            "sha256": "43241c06efca26914e5ef366ebc4d1cce41bd4d41804c4c8ae2bd61229f85688",
            "raw": {
              "bytes": 273607,
              "sha256": "c0fe48ae43b46b9ae611fc404c282cab2cb6a36a79db2788c613a6988e498c9d"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "sql-sqlite",
            "label": "SQLite",
            "file": "flagship/1k/sqlite.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/1k/sqlite.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1k/sqlite.sql.gz",
            "bytes": 62545,
            "sha256": "4e0a5f71c042b244d0b40e40d2109b47bda31d1c9a9248de52d52b5a86dddf28",
            "raw": {
              "bytes": 270766,
              "sha256": "2e44793489705dc47e020a2627f2a07403cc2b3bb4d4ccef79f40f88349a5633"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "csv",
            "label": "CSV",
            "file": "flagship/1k/csv.zip",
            "key": "datasets/hospital-sample-database/v1/flagship/1k/csv.zip",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1k/csv.zip",
            "bytes": 64222,
            "sha256": "5e18de6c80350479a7ad3e925475243b0f22f56503e14eb4dd57f4ed60642389",
            "tables": {
              "admissions": {
                "bytes": 1360,
                "sha256": "b42d3be4893566e6207da300b78f6be0b86d96bc81b2d3128a38a6f6bbcd5963"
              },
              "allergies": {
                "bytes": 452,
                "sha256": "d6edeced4ae65aa6027e563b48d32cd084a10b49b8bde909dcd21f116dc5e7ef"
              },
              "appointments": {
                "bytes": 55879,
                "sha256": "548f42887546d0c0cdff85e5dea6f0dd0529fde33f86abba40f860ffa80e71da"
              },
              "beds": {
                "bytes": 14589,
                "sha256": "446ececf34c627a7f68254c989870aad4aa860345c53fbc87ee5025eb67410a8"
              },
              "billing": {
                "bytes": 7729,
                "sha256": "5498362ebf09065167d2128209f6543529771cd7651c833baa20646a7079e677"
              },
              "billing_items": {
                "bytes": 10668,
                "sha256": "eab91b6ce1bd0a48a1850a254e769b143bce11f4362c5f20b9b56df72c783e49"
              },
              "departments": {
                "bytes": 585,
                "sha256": "114086573c82834b939a749afc5115964580e8ab9031c7e6946e833ca890606d"
              },
              "doctors": {
                "bytes": 515,
                "sha256": "7bd404137ec26d932e8dc6b4b92227b5c2ca5d0dad62a4514d4c00dad75dbbd4"
              },
              "insurance_policies": {
                "bytes": 2283,
                "sha256": "98132ec684ff285a7da022e4c7c3f165b315d793a414c603aa149a15eb7ea74c"
              },
              "insurance_providers": {
                "bytes": 1053,
                "sha256": "70fdda0821ef9f29995a10e93b4882aeb5248f5bc9048d7e2dd0c126e528345c"
              },
              "inventory_categories": {
                "bytes": 198,
                "sha256": "df4426fde3644ba663751db8b1a7d3718e19a3de4164f1bba1a0a26d2c7dea61"
              },
              "inventory_items": {
                "bytes": 6175,
                "sha256": "46f268137409aab4cf7c074cd9084316f4f23715c834ba3983aa9041b438ae22"
              },
              "lab_requests": {
                "bytes": 5081,
                "sha256": "9442fdde47b0ce7914aec86a9a58edcf7caaaba583bf2a80e27dca200160b97d"
              },
              "lab_results": {
                "bytes": 5446,
                "sha256": "437d9a2e53962937a37c8605b696cd1ceb9c85245330eeafc772567421f74125"
              },
              "lab_tests": {
                "bytes": 1536,
                "sha256": "3a883c82df21f80173c9ac00d7dc0550f78902f04ab377be7604a215182efd21"
              },
              "medical_records": {
                "bytes": 16016,
                "sha256": "3d051f96dbc933c79d963d224edebecb209cbf2d7bd297fb678a2fc4ad0d131d"
              },
              "medications": {
                "bytes": 8244,
                "sha256": "893894a5eb9a0858727b57040a86ce741cab028fdf43f596344d1ce8173e07f5"
              },
              "patient_allergies": {
                "bytes": 435,
                "sha256": "e6873170548f277f9565f1b42a814fd194cb9ce7200360446271ad2e0628917a"
              },
              "patients": {
                "bytes": 9070,
                "sha256": "6b8b63a836ef3fe8eaca794346d55320d2546324f51703b9b43f0bc65b650bfb"
              },
              "payments": {
                "bytes": 7837,
                "sha256": "5f1c4ecc87b19281a4bb483054fb246f9acde63ecf37638f31e66322c1cdef52"
              },
              "prescription_items": {
                "bytes": 8411,
                "sha256": "f3ea4c09b75317700c074fa533bae97d24b6072361e1bca3d781a883d92ad499"
              },
              "prescriptions": {
                "bytes": 6170,
                "sha256": "0771364528031f173bdd269b01fb20552d7532a4d66037b7faa952d30d6c4bbb"
              },
              "purchase_order_items": {
                "bytes": 218,
                "sha256": "9d1e20abfb3771e22cab76dda85d9d6952eea98eb18eddf14f9b530c2c0b4f48"
              },
              "purchase_orders": {
                "bytes": 374,
                "sha256": "c8a7e11b22635dabb9531c4b7daddb10aa88362af1f177780a4f8b609d76a92f"
              },
              "rooms": {
                "bytes": 5053,
                "sha256": "545b0c1fe8a5e39200867cfc702b012128e0a040d2ca5fc4c5fbbf1f626651ca"
              },
              "schedules": {
                "bytes": 979,
                "sha256": "1d58bbbe93413da6211ca2bed376623da64f4a01e862d1506fd5ab61ab284a2e"
              },
              "staff": {
                "bytes": 791,
                "sha256": "2dfa60c45b2397da5cbae800cc8a1ff7a8ff7958989ce18c7974b502704bab9a"
              },
              "staff_roles": {
                "bytes": 233,
                "sha256": "3a05a7143efb3d32b83757c0e192ff4cae271d97d255725490edb572cba374fe"
              },
              "surgeries": {
                "bytes": 1144,
                "sha256": "bfa636897717f715aadadf9d9e13f6a22d9f3c16f2c27a80bdef226ec747b1ce"
              },
              "surgical_procedures": {
                "bytes": 413,
                "sha256": "dc2c57dc68a579b4293b558de7240afa67c1440116e6cbf6915fa518a1c0130c"
              },
              "vendors": {
                "bytes": 2049,
                "sha256": "c9b018cbf0f54991d7938f597a38581b91c2ef0ea74d749a598e0e19afa7174a"
              },
              "visitors": {
                "bytes": 2139,
                "sha256": "92a9c434d84d5c14d440d3b56c455d425a520916c50e2cb820291fc5bbb795ba"
              },
              "wards": {
                "bytes": 517,
                "sha256": "975adba879232e5b130e79d0021a0e0d74d228aa3d2ac095bcf6fa785bec402c"
              }
            },
            "contentType": "application/zip"
          }
        ],
        "checks": {
          "postgres": {
            "version": "18.3",
            "ok": true
          },
          "sqlite": {
            "version": "3.53.1",
            "ok": true
          },
          "notRun": [
            {
              "engine": "MySQL",
              "note": "Written from the same rows; not loaded here, no MySQL server runs in the build."
            }
          ]
        },
        "rules": [
          {
            "name": "A lab result comes after its request, and the request after its record",
            "violations": 0
          },
          {
            "name": "A discharge comes after its admission, and surgery after admission",
            "violations": 0
          },
          {
            "name": "A bill is the sum of its lines",
            "violations": 0
          },
          {
            "name": "A payment settles its bill in full, after the bill was issued",
            "violations": 0
          },
          {
            "name": "What a bill shows as paid is the sum of its payments",
            "violations": 0
          },
          {
            "name": "A prescription is written on the day of its record, or the day after",
            "violations": 0
          },
          {
            "name": "One doctor profile per staff member, one result per lab request",
            "violations": 0
          }
        ],
        "dirty": {
          "report": {
            "rates": {
              "missing": 0.03,
              "typos": 0.03,
              "outliers": 0.005,
              "duplicates": 0.01
            },
            "tables": {
              "allergies": {
                "duplicates": 0,
                "columns": {
                  "description": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 0,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "departments": {
                "duplicates": 0,
                "columns": {
                  "description": {
                    "missing": 2,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "insurance_providers": {
                "duplicates": 0,
                "columns": {
                  "name": {
                    "missing": 1,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "inventory_categories": {
                "duplicates": 0,
                "columns": {
                  "description": {
                    "missing": 0,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "inventory_items": {
                "duplicates": 1,
                "columns": {
                  "description": {
                    "missing": 8,
                    "typos": 5,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 5,
                    "typos": 3,
                    "outliers": 0
                  },
                  "quantity_in_stock": {
                    "missing": 4,
                    "typos": 0,
                    "outliers": 0
                  },
                  "unit_price": {
                    "missing": 7,
                    "typos": 0,
                    "outliers": 1
                  }
                }
              },
              "lab_tests": {
                "duplicates": 1,
                "columns": {
                  "description": {
                    "missing": 1,
                    "typos": 1,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 1,
                    "typos": 2,
                    "outliers": 0
                  }
                }
              },
              "medications": {
                "duplicates": 1,
                "columns": {
                  "brand": {
                    "missing": 1,
                    "typos": 4,
                    "outliers": 0
                  },
                  "description": {
                    "missing": 7,
                    "typos": 5,
                    "outliers": 0
                  },
                  "dosage_form": {
                    "missing": 2,
                    "typos": 3,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 5,
                    "typos": 3,
                    "outliers": 0
                  },
                  "strength": {
                    "missing": 1,
                    "typos": 4,
                    "outliers": 0
                  }
                }
              },
              "patients": {
                "duplicates": 0,
                "columns": {
                  "address": {
                    "missing": 2,
                    "typos": 2,
                    "outliers": 0
                  },
                  "date_of_birth": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "email": {
                    "missing": 3,
                    "typos": 4,
                    "outliers": 0
                  },
                  "emergency_contact": {
                    "missing": 4,
                    "typos": 3,
                    "outliers": 0
                  },
                  "first_name": {
                    "missing": 3,
                    "typos": 1,
                    "outliers": 0
                  },
                  "gender": {
                    "missing": 0,
                    "typos": 2,
                    "outliers": 0
                  },
                  "last_name": {
                    "missing": 2,
                    "typos": 3,
                    "outliers": 0
                  },
                  "phone": {
                    "missing": 0,
                    "typos": 3,
                    "outliers": 0
                  }
                }
              },
              "billing": {
                "duplicates": 1,
                "columns": {
                  "billing_date": {
                    "missing": 11,
                    "typos": 0,
                    "outliers": 0
                  },
                  "paid_amount": {
                    "missing": 7,
                    "typos": 0,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 3,
                    "typos": 11,
                    "outliers": 0
                  },
                  "total_amount": {
                    "missing": 6,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "billing_items": {
                "duplicates": 4,
                "columns": {
                  "amount": {
                    "missing": 12,
                    "typos": 0,
                    "outliers": 1
                  },
                  "description": {
                    "missing": 13,
                    "typos": 12,
                    "outliers": 0
                  }
                }
              },
              "insurance_policies": {
                "duplicates": 0,
                "columns": {
                  "expiry_date": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "policy_number": {
                    "missing": 3,
                    "typos": 2,
                    "outliers": 0
                  }
                }
              },
              "patient_allergies": {
                "duplicates": 0,
                "columns": {
                  "severity": {
                    "missing": 0,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "payments": {
                "duplicates": 1,
                "columns": {
                  "amount": {
                    "missing": 3,
                    "typos": 0,
                    "outliers": 0
                  },
                  "payment_date": {
                    "missing": 6,
                    "typos": 0,
                    "outliers": 0
                  },
                  "payment_method": {
                    "missing": 7,
                    "typos": 5,
                    "outliers": 0
                  }
                }
              },
              "staff": {
                "duplicates": 0,
                "columns": {
                  "email": {
                    "missing": 2,
                    "typos": 0,
                    "outliers": 0
                  },
                  "first_name": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "last_name": {
                    "missing": 0,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "doctors": {
                "duplicates": 0,
                "columns": {
                  "license_number": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "specialty": {
                    "missing": 2,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "appointments": {
                "duplicates": 7,
                "columns": {
                  "appointment_date": {
                    "missing": 25,
                    "typos": 0,
                    "outliers": 0
                  },
                  "notes": {
                    "missing": 20,
                    "typos": 21,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 25,
                    "typos": 32,
                    "outliers": 0
                  }
                }
              },
              "medical_records": {
                "duplicates": 1,
                "columns": {
                  "created_at": {
                    "missing": 5,
                    "typos": 0,
                    "outliers": 0
                  },
                  "diagnosis": {
                    "missing": 8,
                    "typos": 5,
                    "outliers": 0
                  },
                  "treatment_plan": {
                    "missing": 7,
                    "typos": 5,
                    "outliers": 0
                  }
                }
              },
              "lab_requests": {
                "duplicates": 0,
                "columns": {
                  "request_date": {
                    "missing": 5,
                    "typos": 0,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 3,
                    "typos": 2,
                    "outliers": 0
                  }
                }
              },
              "lab_results": {
                "duplicates": 1,
                "columns": {
                  "performed_date": {
                    "missing": 3,
                    "typos": 0,
                    "outliers": 0
                  },
                  "result_details": {
                    "missing": 0,
                    "typos": 4,
                    "outliers": 0
                  }
                }
              },
              "prescriptions": {
                "duplicates": 0,
                "columns": {
                  "instructions": {
                    "missing": 5,
                    "typos": 5,
                    "outliers": 0
                  },
                  "prescribed_date": {
                    "missing": 6,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "prescription_items": {
                "duplicates": 1,
                "columns": {
                  "dosage": {
                    "missing": 4,
                    "typos": 4,
                    "outliers": 0
                  },
                  "duration": {
                    "missing": 10,
                    "typos": 8,
                    "outliers": 0
                  },
                  "frequency": {
                    "missing": 7,
                    "typos": 7,
                    "outliers": 0
                  }
                }
              },
              "schedules": {
                "duplicates": 1,
                "columns": {}
              },
              "surgeries": {
                "duplicates": 2,
                "columns": {
                  "name": {
                    "missing": 1,
                    "typos": 2,
                    "outliers": 0
                  },
                  "risk_level": {
                    "missing": 3,
                    "typos": 2,
                    "outliers": 0
                  }
                }
              },
              "vendors": {
                "duplicates": 0,
                "columns": {
                  "address": {
                    "missing": 1,
                    "typos": 1,
                    "outliers": 0
                  },
                  "email": {
                    "missing": 1,
                    "typos": 2,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 3,
                    "typos": 2,
                    "outliers": 0
                  },
                  "phone": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "purchase_orders": {
                "duplicates": 0,
                "columns": {
                  "status": {
                    "missing": 2,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "purchase_order_items": {
                "duplicates": 0,
                "columns": {
                  "quantity": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "unit_price": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "visitors": {
                "duplicates": 0,
                "columns": {
                  "name": {
                    "missing": 1,
                    "typos": 1,
                    "outliers": 0
                  },
                  "visit_time_out": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "wards": {
                "duplicates": 0,
                "columns": {
                  "capacity": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 1
                  },
                  "name": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "type": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "rooms": {
                "duplicates": 3,
                "columns": {
                  "room_number": {
                    "missing": 10,
                    "typos": 1,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 5,
                    "typos": 7,
                    "outliers": 0
                  },
                  "type": {
                    "missing": 7,
                    "typos": 7,
                    "outliers": 0
                  }
                }
              },
              "beds": {
                "duplicates": 11,
                "columns": {
                  "bed_number": {
                    "missing": 21,
                    "typos": 10,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 21,
                    "typos": 19,
                    "outliers": 0
                  }
                }
              },
              "admissions": {
                "duplicates": 0,
                "columns": {
                  "admission_date": {
                    "missing": 2,
                    "typos": 0,
                    "outliers": 0
                  },
                  "discharge_date": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "primary_diagnosis": {
                    "missing": 2,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "surgical_procedures": {
                "duplicates": 0,
                "columns": {
                  "duration_minutes": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "scheduled_time": {
                    "missing": 2,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              }
            },
            "totals": {
              "missing": 363,
              "typos": 232,
              "outliers": 3,
              "duplicates": 36
            }
          },
          "downloads": [
            {
              "format": "dirty-sql-postgres",
              "label": "PostgreSQL, with faults",
              "file": "flagship/1k/dirty-postgres.sql.gz",
              "key": "datasets/hospital-sample-database/v1/flagship/1k/dirty-postgres.sql.gz",
              "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1k/dirty-postgres.sql.gz",
              "bytes": 61795,
              "sha256": "017bba9a29fb090fc84ec034700c8172ba0810c6f262421e8ef18db5f54bc47f",
              "raw": {
                "bytes": 265222,
                "sha256": "c16dd0956fbdcebf5dcdd19c1d600cecd3c7478666bdb9f2fcbbe48c5737503c"
              },
              "contentType": "application/gzip"
            },
            {
              "format": "dirty-csv",
              "label": "CSV, with faults",
              "file": "flagship/1k/dirty-csv.zip",
              "key": "datasets/hospital-sample-database/v1/flagship/1k/dirty-csv.zip",
              "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1k/dirty-csv.zip",
              "bytes": 64972,
              "sha256": "ff96f75090e6b49a90af36383f37e51e840e5def3dafcc7522ea3ff74cf9b007",
              "tables": {
                "admissions": {
                  "bytes": 1277,
                  "sha256": "4b6136613ad5e09d8b4e977e77b57bcfc135bae8083754bff3ec71a74b8c1864"
                },
                "allergies": {
                  "bytes": 445,
                  "sha256": "7ffd4d35e690b9d19ed13c29fb76eb8cbbfcf444d3528adbbde833757514b1bd"
                },
                "appointments": {
                  "bytes": 55267,
                  "sha256": "7b8e5a38ecd61d71ca1fbc318d1798a9faeb667aaa26824331783fc92f416d80"
                },
                "beds": {
                  "bytes": 14588,
                  "sha256": "9ea5aa272f333b5ed3d868164e8784dfb11283fc11d308967092e5acb3deda8c"
                },
                "billing": {
                  "bytes": 7581,
                  "sha256": "2e778b321e36f427d319228c6b25e052766326496f717f2c2898571e8b59cab1"
                },
                "billing_items": {
                  "bytes": 10586,
                  "sha256": "1c1526df7cb79174d436bdf507d51cd4cfd9afd7e431dc58f22b0e62ab23b6e8"
                },
                "departments": {
                  "bytes": 551,
                  "sha256": "f18d3ed5d2e4291ad3b25090e19e30e062cdae1f808a167404d5cb56bfee2307"
                },
                "doctors": {
                  "bytes": 486,
                  "sha256": "ef9c21b7db9080480d04df25def0ecb13488c82d5ef4733ce72a3e9222faf450"
                },
                "insurance_policies": {
                  "bytes": 2234,
                  "sha256": "2cdebc08613b5c84228107458ad9e8d5d452572d72a459c57b7d6632dec7ffb4"
                },
                "insurance_providers": {
                  "bytes": 1045,
                  "sha256": "f49c718b3c37d1bcbfc365805d9515302ef985562ac16c7df51329b6d9f81770"
                },
                "inventory_categories": {
                  "bytes": 198,
                  "sha256": "9ca88dde3607a65cd72c8b9f114aa748ca3124e7a258f9b8cf490532dfbe79c1"
                },
                "inventory_items": {
                  "bytes": 6046,
                  "sha256": "b7112beda34b4ef17e81f59f99bfb7a7428c568a17719aca742778dad96d64d9"
                },
                "lab_requests": {
                  "bytes": 4962,
                  "sha256": "a84a92d06e2f41fae1e6ffb59aaab1bbfe59084b67a9cabec7a427ae58da5268"
                },
                "lab_results": {
                  "bytes": 5462,
                  "sha256": "88227be18ee690ce73de6dff427e19ae238af0782772254007ef5cc99fbb33ff"
                },
                "lab_tests": {
                  "bytes": 1560,
                  "sha256": "9474c35445ee839faead0228a49533b8ae050610e303cb5de45fa4f519be2396"
                },
                "medical_records": {
                  "bytes": 15772,
                  "sha256": "0028f6e30def6ff37179ef57b0e56cb72a3ffe085520601760beeb5613e8588b"
                },
                "medications": {
                  "bytes": 8131,
                  "sha256": "aebe32e14e133581386ce22bba1422569989207ec00502de7ea83356400f9f43"
                },
                "patient_allergies": {
                  "bytes": 435,
                  "sha256": "106ce0b2cb6c4f010158f018dda2dff552eadbf7478d649f8bc0854df6de9d4b"
                },
                "patients": {
                  "bytes": 8907,
                  "sha256": "28619a7416a101588c02e88048ed0e9bfe00db4e94902e17e471e6914f121794"
                },
                "payments": {
                  "bytes": 7706,
                  "sha256": "518dcc9444fd3053cfa3f09edf32dd2490ab68e0e72284e8cdcd8b40bb457bd8"
                },
                "prescription_items": {
                  "bytes": 8312,
                  "sha256": "f0e73998a3af74037e6f7bac3194ee324161a3e385cc780dc3e00ebf9305230a"
                },
                "prescriptions": {
                  "bytes": 6027,
                  "sha256": "e0b37f3a8e2f696904793dda66b8346edeafeb6183241f8c4d4dacc1dda64830"
                },
                "purchase_order_items": {
                  "bytes": 211,
                  "sha256": "5a59849356688d06ed00c858ae5ebc96617abb11885032446c156c5061229dd1"
                },
                "purchase_orders": {
                  "bytes": 358,
                  "sha256": "2f28f14affea3ebddc03355d101dd61228bdd7961cc2d55c9318bf52f0612b0a"
                },
                "rooms": {
                  "bytes": 5042,
                  "sha256": "f3da1301656332a9e965b0e0c5cf603453e7e0876c2fcb272034af04b4376b88"
                },
                "schedules": {
                  "bytes": 1026,
                  "sha256": "0dfbf4da495e6ff5588bca4a2c159133785882715492a362850de97c5d51d7c8"
                },
                "staff": {
                  "bytes": 742,
                  "sha256": "ce7de6baf11bf469a203757ce083698778fc2574f5536d60588d4b8f1a27dbab"
                },
                "staff_roles": {
                  "bytes": 233,
                  "sha256": "3a05a7143efb3d32b83757c0e192ff4cae271d97d255725490edb572cba374fe"
                },
                "surgeries": {
                  "bytes": 1206,
                  "sha256": "57227dbad1fa69b12b410440be6e28c5c78ca277f27d2cd1a455af244ea31a50"
                },
                "surgical_procedures": {
                  "bytes": 373,
                  "sha256": "7b3d09e8500ce02c6871d4b1a6d7047bf8a244cd228051693e9e57a5d784aea5"
                },
                "vendors": {
                  "bytes": 1937,
                  "sha256": "5e0a29e70d0d9b97be2268a1c1f9e10cd5f3fdd08d5627f67938dd6638f09ee4"
                },
                "visitors": {
                  "bytes": 2108,
                  "sha256": "1a803d764cb785fbd1098e0c4066299a8228cbe5e300e89d1e561abdbc4fc33f"
                },
                "wards": {
                  "bytes": 501,
                  "sha256": "2bc9a689b689ac4aac6624b30208490fc22c9542556e62f86c2c1ead4b113ed6"
                }
              },
              "contentType": "application/zip"
            }
          ]
        }
      },
      "100k": {
        "rows": 287518,
        "counts": {
          "allergies": 20,
          "departments": 12,
          "insurance_providers": 10,
          "inventory_categories": 8,
          "inventory_items": 150,
          "lab_tests": 40,
          "medications": 120,
          "patients": 8000,
          "billing": 20000,
          "billing_items": 40000,
          "insurance_policies": 4000,
          "patient_allergies": 3000,
          "payments": 18000,
          "staff_roles": 8,
          "staff": 200,
          "doctors": 80,
          "appointments": 100000,
          "medical_records": 25000,
          "lab_requests": 12000,
          "lab_results": 11000,
          "prescriptions": 15000,
          "prescription_items": 22000,
          "schedules": 2000,
          "surgeries": 30,
          "vendors": 20,
          "purchase_orders": 100,
          "purchase_order_items": 500,
          "visitors": 3000,
          "wards": 20,
          "rooms": 200,
          "beds": 600,
          "admissions": 2000,
          "surgical_procedures": 400
        },
        "notes": [],
        "downloads": [
          {
            "format": "sql-postgres",
            "label": "PostgreSQL",
            "file": "flagship/100k/postgres.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/100k/postgres.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/100k/postgres.sql.gz",
            "bytes": 4229533,
            "sha256": "96a4babe1523310a8b31ad579c058d8bb806faa940db536076491f5edcdfaee9",
            "raw": {
              "bytes": 19873421,
              "sha256": "6d5bad67d76a3cb60bbf52e3ecaad1d5ed8278ed9e3f22dcec7e44dfca5636d1"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "sql-mysql",
            "label": "MySQL",
            "file": "flagship/100k/mysql.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/100k/mysql.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/100k/mysql.sql.gz",
            "bytes": 4227661,
            "sha256": "51043701f3c24b23b1568f3da16d1ee0b9b5fdd8ff774f39425365ff08f2ec58",
            "raw": {
              "bytes": 19870239,
              "sha256": "a0cb07585730973672bf754cd0214edd7ac459956fc204bed161de84d9ab910f"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "sql-sqlite",
            "label": "SQLite",
            "file": "flagship/100k/sqlite.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/100k/sqlite.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/100k/sqlite.sql.gz",
            "bytes": 4227066,
            "sha256": "ace5e7c9e5a6f3de86047dee84991490a58588e20e6270f1ea1f3277b09654a6",
            "raw": {
              "bytes": 19867398,
              "sha256": "1e4e50652746676d3d27c84aa4eaa4436f5471318153ca59574f242947efc9e1"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "csv",
            "label": "CSV",
            "file": "flagship/100k/csv.zip",
            "key": "datasets/hospital-sample-database/v1/flagship/100k/csv.zip",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/100k/csv.zip",
            "bytes": 4349456,
            "sha256": "e84659122c138351ff18150d01d99948c47e35a5904c69a1ea1daa9ad7af5c97",
            "tables": {
              "admissions": {
                "bytes": 133580,
                "sha256": "d12a10d6b70fae1aab8d38d24d9d8eed2e013342f810420747d42007c72e24ab"
              },
              "allergies": {
                "bytes": 434,
                "sha256": "0672a547a123e3414df3c2bd7d647cfc80b6eb545051d82f27459fe5fc9ecaf5"
              },
              "appointments": {
                "bytes": 6012834,
                "sha256": "52278f9d228c4d7a226507e0c748cc76f0da65b79a54a0eff5edc7658000581b"
              },
              "beds": {
                "bytes": 14588,
                "sha256": "754802bb216aba0970067220f7c019f385b194c0f333112ea4ab7ff1b18f46b3"
              },
              "billing": {
                "bytes": 839802,
                "sha256": "757ddcd311a6bdfc2c71d6f17daf8927ca8c377d654f224f9fb147052b6dcf1c"
              },
              "billing_items": {
                "bytes": 1222856,
                "sha256": "159906f8e52f46bc5a3d7497befeab47e77eb3010ba693d3709a40b9d27bc0d4"
              },
              "departments": {
                "bytes": 570,
                "sha256": "e981898a7c0aa4729c488b95bc7612a7cefe1ac8fd1bb75077c16f1b6ce611d9"
              },
              "doctors": {
                "bytes": 4043,
                "sha256": "909ea6e423b6d6777385939e3c7a12aec6aa2abe17fd8655ef045225b503f450"
              },
              "insurance_policies": {
                "bytes": 234522,
                "sha256": "20874cf5a409e7f4490d8742c4d26a578dce70e12d15e9377de5c2199cca54a9"
              },
              "insurance_providers": {
                "bytes": 1062,
                "sha256": "3ea4dcbf6f3d706d02dbee28de61a9961f77bebe7870535a52214e36630cfec7"
              },
              "inventory_categories": {
                "bytes": 196,
                "sha256": "a8d7fc83cb53198f151d46a8ffeb85e16937f36a828193630844cdd808211278"
              },
              "inventory_items": {
                "bytes": 6174,
                "sha256": "5f22007ffb64f2ecc1f5af406f2add9686a93eaac3cbfaaf34094d6e08b6b5b6"
              },
              "lab_requests": {
                "bytes": 557300,
                "sha256": "c895952515dc8156b49795d7c2d7b0cf3f185cc030d3c6df999941aa412224d0"
              },
              "lab_results": {
                "bytes": 594072,
                "sha256": "f443d2e2244d0f22254f8405c36a65a89675dc2c4bd2d088d4c8cf1306ada7bc"
              },
              "lab_tests": {
                "bytes": 1508,
                "sha256": "aa1b623ef8db26c7ed09c28c5188e889094ce9a337eb741d1dd7131c9fd975f4"
              },
              "medical_records": {
                "bytes": 1699367,
                "sha256": "54ee0e246cd14b25d90397ce15c1d4dae078cf2a00af83c2a68a3396a10e5ead"
              },
              "medications": {
                "bytes": 8140,
                "sha256": "745bcb77fc3c9a6d988d9cbe8cfc1ea285ca8dada6a96dd95084cbbc47f65536"
              },
              "patient_allergies": {
                "bytes": 52787,
                "sha256": "10d432fefa9a8f2a28286897c7d076f55362ef3ef37cd2e182915e4d4af7ca56"
              },
              "patients": {
                "bytes": 914208,
                "sha256": "70216247dcbc2e9841e6e9640f056dc4d5986c4bd59f6bc661a1f194abd5d8b4"
              },
              "payments": {
                "bytes": 850462,
                "sha256": "3ed2eb1b5d273afac25ff9d77c6067b1d3d5f766e07d398b012da47daf944034"
              },
              "prescription_items": {
                "bytes": 926619,
                "sha256": "b9db4d2cf7187a020881f2c42bdc91e140130d2317d5dffd3391ad63a991c4f4"
              },
              "prescriptions": {
                "bytes": 676111,
                "sha256": "36e286af1e320f8f57fdd76feed6563e90fa12a2fc130135894c80cb58956f77"
              },
              "purchase_order_items": {
                "bytes": 9674,
                "sha256": "4d3655f1572ed325dd6f468e2179c7c07f14511c7c2f3f490b45d3f0d4ac2ede"
              },
              "purchase_orders": {
                "bytes": 3412,
                "sha256": "3101296f6cb1127d0c691ab265767aa0b5001825b49ecaa470602255772ef4e2"
              },
              "rooms": {
                "bytes": 5069,
                "sha256": "cfef97c4bf703260a6386eecaab456d549d0b566c016819c36e56627f33b933c"
              },
              "schedules": {
                "bytes": 99192,
                "sha256": "21457c68a9921e6bc70e817df8f8e643e1208c20b940652b3d7f90658032f7b3"
              },
              "staff": {
                "bytes": 15171,
                "sha256": "1d64e0b29ee1203e093c8b95628b294c217df9e179dcb71dfe90949320663edb"
              },
              "staff_roles": {
                "bytes": 239,
                "sha256": "cb1962e1dba2a992b9202dedf24a4f48cfd0e3c329000f029fea34b5d617ff96"
              },
              "surgeries": {
                "bytes": 1188,
                "sha256": "713984be0ba0a3a0377415433103f587622651d18c22252a966bf285cbb122f6"
              },
              "surgical_procedures": {
                "bytes": 15207,
                "sha256": "889978e693e3ebbfe0a4546f04e9cc7ff5b0ee8f54c8f3e1bc8bdff761e6f144"
              },
              "vendors": {
                "bytes": 2045,
                "sha256": "695f578ff511c17a0102f2e4a44a76e3599d50f840ca1701848b12ef8e4ed5cd"
              },
              "visitors": {
                "bytes": 218523,
                "sha256": "7e603ada8ef4469407f1c46d313069df943488aa8cff57a0c93a0ead72582e0f"
              },
              "wards": {
                "bytes": 514,
                "sha256": "9396a7550788ac627194d40dcd142a369e6117d78b9176ff7d1f52bc3e024774"
              }
            },
            "contentType": "application/zip"
          }
        ],
        "checks": {
          "postgres": {
            "version": "18.3",
            "ok": true
          },
          "sqlite": {
            "version": "3.53.1",
            "ok": true
          },
          "notRun": [
            {
              "engine": "MySQL",
              "note": "Written from the same rows; not loaded here, no MySQL server runs in the build."
            }
          ]
        },
        "rules": [
          {
            "name": "A lab result comes after its request, and the request after its record",
            "violations": 0
          },
          {
            "name": "A discharge comes after its admission, and surgery after admission",
            "violations": 0
          },
          {
            "name": "A bill is the sum of its lines",
            "violations": 0
          },
          {
            "name": "A payment settles its bill in full, after the bill was issued",
            "violations": 0
          },
          {
            "name": "What a bill shows as paid is the sum of its payments",
            "violations": 0
          },
          {
            "name": "A prescription is written on the day of its record, or the day after",
            "violations": 0
          },
          {
            "name": "One doctor profile per staff member, one result per lab request",
            "violations": 0
          }
        ],
        "dirty": {
          "report": {
            "rates": {
              "missing": 0.03,
              "typos": 0.03,
              "outliers": 0.005,
              "duplicates": 0.01
            },
            "tables": {
              "allergies": {
                "duplicates": 0,
                "columns": {
                  "description": {
                    "missing": 0,
                    "typos": 2,
                    "outliers": 0
                  }
                }
              },
              "departments": {
                "duplicates": 0,
                "columns": {
                  "description": {
                    "missing": 0,
                    "typos": 1,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "insurance_providers": {
                "duplicates": 0,
                "columns": {
                  "address": {
                    "missing": 0,
                    "typos": 1,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 0,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "inventory_items": {
                "duplicates": 4,
                "columns": {
                  "description": {
                    "missing": 3,
                    "typos": 7,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 4,
                    "typos": 4,
                    "outliers": 0
                  },
                  "quantity_in_stock": {
                    "missing": 9,
                    "typos": 0,
                    "outliers": 2
                  },
                  "unit_price": {
                    "missing": 6,
                    "typos": 0,
                    "outliers": 1
                  }
                }
              },
              "lab_tests": {
                "duplicates": 0,
                "columns": {
                  "cost": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "description": {
                    "missing": 5,
                    "typos": 2,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "medications": {
                "duplicates": 0,
                "columns": {
                  "brand": {
                    "missing": 5,
                    "typos": 5,
                    "outliers": 0
                  },
                  "description": {
                    "missing": 4,
                    "typos": 6,
                    "outliers": 0
                  },
                  "dosage_form": {
                    "missing": 4,
                    "typos": 5,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 2,
                    "typos": 6,
                    "outliers": 0
                  },
                  "strength": {
                    "missing": 4,
                    "typos": 3,
                    "outliers": 0
                  }
                }
              },
              "patients": {
                "duplicates": 74,
                "columns": {
                  "address": {
                    "missing": 238,
                    "typos": 255,
                    "outliers": 0
                  },
                  "date_of_birth": {
                    "missing": 244,
                    "typos": 0,
                    "outliers": 0
                  },
                  "email": {
                    "missing": 212,
                    "typos": 234,
                    "outliers": 0
                  },
                  "emergency_contact": {
                    "missing": 237,
                    "typos": 267,
                    "outliers": 0
                  },
                  "first_name": {
                    "missing": 265,
                    "typos": 253,
                    "outliers": 0
                  },
                  "gender": {
                    "missing": 260,
                    "typos": 224,
                    "outliers": 0
                  },
                  "last_name": {
                    "missing": 243,
                    "typos": 260,
                    "outliers": 0
                  },
                  "phone": {
                    "missing": 240,
                    "typos": 78,
                    "outliers": 0
                  }
                }
              },
              "billing": {
                "duplicates": 192,
                "columns": {
                  "billing_date": {
                    "missing": 558,
                    "typos": 0,
                    "outliers": 0
                  },
                  "paid_amount": {
                    "missing": 607,
                    "typos": 0,
                    "outliers": 78
                  },
                  "status": {
                    "missing": 590,
                    "typos": 547,
                    "outliers": 0
                  },
                  "total_amount": {
                    "missing": 637,
                    "typos": 0,
                    "outliers": 91
                  }
                }
              },
              "billing_items": {
                "duplicates": 394,
                "columns": {
                  "amount": {
                    "missing": 1164,
                    "typos": 0,
                    "outliers": 201
                  },
                  "description": {
                    "missing": 1158,
                    "typos": 1249,
                    "outliers": 0
                  }
                }
              },
              "insurance_policies": {
                "duplicates": 49,
                "columns": {
                  "coverage_details": {
                    "missing": 117,
                    "typos": 123,
                    "outliers": 0
                  },
                  "expiry_date": {
                    "missing": 125,
                    "typos": 0,
                    "outliers": 0
                  },
                  "policy_number": {
                    "missing": 124,
                    "typos": 136,
                    "outliers": 0
                  }
                }
              },
              "patient_allergies": {
                "duplicates": 31,
                "columns": {
                  "severity": {
                    "missing": 89,
                    "typos": 103,
                    "outliers": 0
                  }
                }
              },
              "payments": {
                "duplicates": 194,
                "columns": {
                  "amount": {
                    "missing": 512,
                    "typos": 0,
                    "outliers": 80
                  },
                  "payment_date": {
                    "missing": 572,
                    "typos": 0,
                    "outliers": 0
                  },
                  "payment_method": {
                    "missing": 538,
                    "typos": 528,
                    "outliers": 0
                  }
                }
              },
              "staff": {
                "duplicates": 2,
                "columns": {
                  "email": {
                    "missing": 3,
                    "typos": 4,
                    "outliers": 0
                  },
                  "first_name": {
                    "missing": 7,
                    "typos": 2,
                    "outliers": 0
                  },
                  "hire_date": {
                    "missing": 3,
                    "typos": 0,
                    "outliers": 0
                  },
                  "last_name": {
                    "missing": 9,
                    "typos": 5,
                    "outliers": 0
                  },
                  "phone": {
                    "missing": 9,
                    "typos": 2,
                    "outliers": 0
                  }
                }
              },
              "doctors": {
                "duplicates": 3,
                "columns": {
                  "biography": {
                    "missing": 3,
                    "typos": 2,
                    "outliers": 0
                  },
                  "license_number": {
                    "missing": 2,
                    "typos": 0,
                    "outliers": 0
                  },
                  "specialty": {
                    "missing": 1,
                    "typos": 1,
                    "outliers": 0
                  }
                }
              },
              "appointments": {
                "duplicates": 1026,
                "columns": {
                  "appointment_date": {
                    "missing": 2985,
                    "typos": 0,
                    "outliers": 0
                  },
                  "notes": {
                    "missing": 2090,
                    "typos": 2027,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 3015,
                    "typos": 2983,
                    "outliers": 0
                  }
                }
              },
              "medical_records": {
                "duplicates": 245,
                "columns": {
                  "created_at": {
                    "missing": 748,
                    "typos": 0,
                    "outliers": 0
                  },
                  "diagnosis": {
                    "missing": 761,
                    "typos": 768,
                    "outliers": 0
                  },
                  "treatment_plan": {
                    "missing": 734,
                    "typos": 704,
                    "outliers": 0
                  }
                }
              },
              "lab_requests": {
                "duplicates": 138,
                "columns": {
                  "request_date": {
                    "missing": 368,
                    "typos": 0,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 347,
                    "typos": 361,
                    "outliers": 0
                  }
                }
              },
              "lab_results": {
                "duplicates": 114,
                "columns": {
                  "performed_date": {
                    "missing": 369,
                    "typos": 0,
                    "outliers": 0
                  },
                  "result_details": {
                    "missing": 336,
                    "typos": 360,
                    "outliers": 0
                  }
                }
              },
              "prescriptions": {
                "duplicates": 159,
                "columns": {
                  "instructions": {
                    "missing": 436,
                    "typos": 471,
                    "outliers": 0
                  },
                  "prescribed_date": {
                    "missing": 488,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "prescription_items": {
                "duplicates": 211,
                "columns": {
                  "dosage": {
                    "missing": 645,
                    "typos": 683,
                    "outliers": 0
                  },
                  "duration": {
                    "missing": 685,
                    "typos": 706,
                    "outliers": 0
                  },
                  "frequency": {
                    "missing": 676,
                    "typos": 682,
                    "outliers": 0
                  }
                }
              },
              "schedules": {
                "duplicates": 22,
                "columns": {
                  "shift_end": {
                    "missing": 52,
                    "typos": 0,
                    "outliers": 0
                  },
                  "shift_start": {
                    "missing": 68,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "surgeries": {
                "duplicates": 1,
                "columns": {
                  "description": {
                    "missing": 1,
                    "typos": 1,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 3,
                    "typos": 1,
                    "outliers": 0
                  },
                  "risk_level": {
                    "missing": 0,
                    "typos": 2,
                    "outliers": 0
                  }
                }
              },
              "vendors": {
                "duplicates": 0,
                "columns": {
                  "address": {
                    "missing": 3,
                    "typos": 1,
                    "outliers": 0
                  },
                  "contact_name": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "email": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 0,
                    "typos": 3,
                    "outliers": 0
                  },
                  "phone": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "purchase_orders": {
                "duplicates": 1,
                "columns": {
                  "order_date": {
                    "missing": 4,
                    "typos": 0,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 2,
                    "typos": 5,
                    "outliers": 0
                  },
                  "total_cost": {
                    "missing": 3,
                    "typos": 0,
                    "outliers": 1
                  }
                }
              },
              "purchase_order_items": {
                "duplicates": 7,
                "columns": {
                  "quantity": {
                    "missing": 19,
                    "typos": 0,
                    "outliers": 3
                  },
                  "unit_price": {
                    "missing": 16,
                    "typos": 0,
                    "outliers": 4
                  }
                }
              },
              "visitors": {
                "duplicates": 30,
                "columns": {
                  "name": {
                    "missing": 96,
                    "typos": 85,
                    "outliers": 0
                  },
                  "relationship": {
                    "missing": 97,
                    "typos": 96,
                    "outliers": 0
                  },
                  "visit_time_in": {
                    "missing": 82,
                    "typos": 0,
                    "outliers": 0
                  },
                  "visit_time_out": {
                    "missing": 102,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "wards": {
                "duplicates": 0,
                "columns": {
                  "capacity": {
                    "missing": 2,
                    "typos": 0,
                    "outliers": 0
                  },
                  "name": {
                    "missing": 1,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              },
              "rooms": {
                "duplicates": 5,
                "columns": {
                  "room_number": {
                    "missing": 6,
                    "typos": 3,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 7,
                    "typos": 7,
                    "outliers": 0
                  },
                  "type": {
                    "missing": 5,
                    "typos": 4,
                    "outliers": 0
                  }
                }
              },
              "beds": {
                "duplicates": 10,
                "columns": {
                  "bed_number": {
                    "missing": 12,
                    "typos": 12,
                    "outliers": 0
                  },
                  "status": {
                    "missing": 14,
                    "typos": 14,
                    "outliers": 0
                  }
                }
              },
              "admissions": {
                "duplicates": 19,
                "columns": {
                  "admission_date": {
                    "missing": 66,
                    "typos": 0,
                    "outliers": 0
                  },
                  "discharge_date": {
                    "missing": 71,
                    "typos": 0,
                    "outliers": 0
                  },
                  "primary_diagnosis": {
                    "missing": 69,
                    "typos": 54,
                    "outliers": 0
                  }
                }
              },
              "surgical_procedures": {
                "duplicates": 7,
                "columns": {
                  "duration_minutes": {
                    "missing": 7,
                    "typos": 0,
                    "outliers": 6
                  },
                  "scheduled_time": {
                    "missing": 13,
                    "typos": 0,
                    "outliers": 0
                  }
                }
              }
            },
            "totals": {
              "missing": 24323,
              "typos": 14349,
              "outliers": 467,
              "duplicates": 2938
            }
          },
          "downloads": [
            {
              "format": "dirty-sql-postgres",
              "label": "PostgreSQL, with faults",
              "file": "flagship/100k/dirty-postgres.sql.gz",
              "key": "datasets/hospital-sample-database/v1/flagship/100k/dirty-postgres.sql.gz",
              "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/100k/dirty-postgres.sql.gz",
              "bytes": 4306206,
              "sha256": "5765c91a167484cf8e8788d94035dd612c30aed7157d3c310d816c5dc9bcd236",
              "raw": {
                "bytes": 19811795,
                "sha256": "934fc1da61fe80237d16b60a7cfab22d80359ce37279be70a6095513cbf0661d"
              },
              "contentType": "application/gzip"
            },
            {
              "format": "dirty-csv",
              "label": "CSV, with faults",
              "file": "flagship/100k/dirty-csv.zip",
              "key": "datasets/hospital-sample-database/v1/flagship/100k/dirty-csv.zip",
              "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/100k/dirty-csv.zip",
              "bytes": 4406365,
              "sha256": "e80be6be26b79805336bb3cebde2510440d018e53889738ca8d5239c92cfa80b",
              "tables": {
                "admissions": {
                  "bytes": 131391,
                  "sha256": "c884c8de16ba7666dc9c994aecd94fe8c50d1c178cad2c35344019cdb40125b5"
                },
                "allergies": {
                  "bytes": 434,
                  "sha256": "41bd8d9c3008ba8ac943799bca4ceafc619463fd4b04484292e3c9833e55e331"
                },
                "appointments": {
                  "bytes": 5952211,
                  "sha256": "b3ce94d55f21711747bb9895a7508bab57ca560fce3a2bfda5daca6dd90fd933"
                },
                "beds": {
                  "bytes": 14675,
                  "sha256": "3629247a8d3023cce9217e9fa7a591ff262a4b8565df9a3e2546eaaa5c57af74"
                },
                "billing": {
                  "bytes": 832646,
                  "sha256": "223f6fa34b57bfa56d8b851dc401cebbefc74aac8785cec4e8f0a7cb3ce9c8fb"
                },
                "billing_items": {
                  "bytes": 1217832,
                  "sha256": "277428ff020acb18a7db6fa7b78b5248aeec8a8eb03a75f1b05e22e810dc18c4"
                },
                "departments": {
                  "bytes": 563,
                  "sha256": "442950a1815713e67614193593603ea18b752392851b9be3ae35cf3ccc51e789"
                },
                "doctors": {
                  "bytes": 4117,
                  "sha256": "5667e5ab11718113f4551d300cae9f4cae671ffeb28b96d6a3ad3d869f2cb21d"
                },
                "insurance_policies": {
                  "bytes": 232569,
                  "sha256": "04dc635801b83d5adfca56f80b9ed012b57df7db0eac47fd2073a21d9254a871"
                },
                "insurance_providers": {
                  "bytes": 1062,
                  "sha256": "3983cbe7026cc8c01a9d6797857cd1d43826c73343ea0ccac8f04d5696f187fa"
                },
                "inventory_categories": {
                  "bytes": 196,
                  "sha256": "a8d7fc83cb53198f151d46a8ffeb85e16937f36a828193630844cdd808211278"
                },
                "inventory_items": {
                  "bytes": 6227,
                  "sha256": "6cd081fa6c3afaee2ec72b548cae4d30d37b5cf08ccfe80a8ac2fc57cd158c4a"
                },
                "lab_requests": {
                  "bytes": 554102,
                  "sha256": "b7e719c1359cf106f861ebdd8f9e020717f996238f1ea6fced1f537e170d7174"
                },
                "lab_results": {
                  "bytes": 587213,
                  "sha256": "029429040d6016b6e9c12af523318fe436073596b95deb12eeb2446ef20ac1bc"
                },
                "lab_tests": {
                  "bytes": 1440,
                  "sha256": "8a8f15c69802c92d56dc815ff734070655e301276b98e6699bed35ca296e02c0"
                },
                "medical_records": {
                  "bytes": 1679905,
                  "sha256": "5695e8179d456d14e88e078c81c2931e4ddecfcdd7a6cdb39b5841df2f9d4755"
                },
                "medications": {
                  "bytes": 7945,
                  "sha256": "a40f27b4147edc826b356e6f677f2a8ed6e3b962bbae472a9aedd85d833ce42c"
                },
                "patient_allergies": {
                  "bytes": 53116,
                  "sha256": "b8da63973e397ba15875181d86fd86dfa9b3f400d7610df6c0b3834c5edd9881"
                },
                "patients": {
                  "bytes": 900754,
                  "sha256": "354d5799b18cf5010d747c17a36c62a13237a5b35d5730d9e1d5d79569c156a1"
                },
                "payments": {
                  "bytes": 842407,
                  "sha256": "647f6a5eb363e4439ae10c0818323b45b44e932ea7233158c2344efaae789992"
                },
                "prescription_items": {
                  "bytes": 921608,
                  "sha256": "40b41cf899fd4169e9f48d752585efee2f89da9c44e9f6ca98e071e222de7189"
                },
                "prescriptions": {
                  "bytes": 670685,
                  "sha256": "7ed724b6eea8fa833adcdc986f4ae8937413780d818cb13fe969fd8f6273d3e6"
                },
                "purchase_order_items": {
                  "bytes": 9701,
                  "sha256": "df0f6df7879492a711588343431739d1ef3f7d61c738ffe40cfe5c12998dd46d"
                },
                "purchase_orders": {
                  "bytes": 3382,
                  "sha256": "9195741d8f582a3b4af359d991274f417e505ea71164268bafdec829d9863bc3"
                },
                "rooms": {
                  "bytes": 5119,
                  "sha256": "f4ee0a6603bdbb8cf93e004910b0cd0e14fd1fe9ebf2a420bfceaf45ea37ccf1"
                },
                "schedules": {
                  "bytes": 97996,
                  "sha256": "939c7f87b8e54c554af5f73d45eb8212887d1846b9a1aaa66677fa2d66cc3f65"
                },
                "staff": {
                  "bytes": 14998,
                  "sha256": "5728d3bf8374807b38df212f0c1ec2e8b7ff6e754dee9660fb1bda77e3a5600e"
                },
                "staff_roles": {
                  "bytes": 239,
                  "sha256": "cb1962e1dba2a992b9202dedf24a4f48cfd0e3c329000f029fea34b5d617ff96"
                },
                "surgeries": {
                  "bytes": 1182,
                  "sha256": "f28af82f0e749cd27f8179134081f048f38aafbb4700bcb3193653bb644ba073"
                },
                "surgical_procedures": {
                  "bytes": 15220,
                  "sha256": "cfafc24c8216c8dd70372c4cc76373f45ac8a76d6b15d988d9c01b34e74d8093"
                },
                "vendors": {
                  "bytes": 1939,
                  "sha256": "db900d475af9016e6e7b465370627be24387190144e54522c16b39e9c9b937f8"
                },
                "visitors": {
                  "bytes": 215465,
                  "sha256": "595b854c5c7397a7b0a15e80c3441b8431c9bf1ae9a436c3fdcc34f9002e19c8"
                },
                "wards": {
                  "bytes": 504,
                  "sha256": "e20b0b60679ca8b8f0ae6f19ab69faaa3d4b070933a5a79abfafaad347c769b1"
                }
              },
              "contentType": "application/zip"
            }
          ]
        }
      },
      "1m": {
        "rows": 2864038,
        "counts": {
          "allergies": 20,
          "departments": 12,
          "insurance_providers": 10,
          "inventory_categories": 8,
          "inventory_items": 150,
          "lab_tests": 40,
          "medications": 120,
          "patients": 80000,
          "billing": 200000,
          "billing_items": 400000,
          "insurance_policies": 40000,
          "patient_allergies": 30000,
          "payments": 180000,
          "staff_roles": 8,
          "staff": 2000,
          "doctors": 800,
          "appointments": 1000000,
          "medical_records": 250000,
          "lab_requests": 120000,
          "lab_results": 110000,
          "prescriptions": 150000,
          "prescription_items": 220000,
          "schedules": 20000,
          "surgeries": 30,
          "vendors": 20,
          "purchase_orders": 1000,
          "purchase_order_items": 5000,
          "visitors": 30000,
          "wards": 20,
          "rooms": 200,
          "beds": 600,
          "admissions": 20000,
          "surgical_procedures": 4000
        },
        "notes": [],
        "downloads": [
          {
            "format": "sql-postgres",
            "label": "PostgreSQL",
            "file": "flagship/1m/postgres.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/1m/postgres.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1m/postgres.sql.gz",
            "bytes": 44796574,
            "sha256": "94ecb42067b15774fa21ce0070c47f228ce792328fb5ff128f7405cfe5b8e0fa",
            "raw": {
              "bytes": 204967323,
              "sha256": "ef80b2d21ea784226b07e3524a52ff2fad2a9ce9d2ba69ba27b95c7542cce15f"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "sql-mysql",
            "label": "MySQL",
            "file": "flagship/1m/mysql.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/1m/mysql.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1m/mysql.sql.gz",
            "bytes": 44794218,
            "sha256": "1f34e8130f6d9b8dd12c8d54b7c87fff0216ed79113e61b4280e74f2e7fc182c",
            "raw": {
              "bytes": 204964141,
              "sha256": "fcde8f4e4aff049c0a156f01c65540427d246235cd7b315ad9a7e5cf5db7a108"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "sql-sqlite",
            "label": "SQLite",
            "file": "flagship/1m/sqlite.sql.gz",
            "key": "datasets/hospital-sample-database/v1/flagship/1m/sqlite.sql.gz",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1m/sqlite.sql.gz",
            "bytes": 44793477,
            "sha256": "24b133095ba757ba1746a028e18029933fa79e0a3980b2a4dc152e16ed187607",
            "raw": {
              "bytes": 204961300,
              "sha256": "08c03b18f051408dd499ff372f7bf97feaa69f7fdaa33bb9f532e7d8baadc7a2"
            },
            "contentType": "application/gzip"
          },
          {
            "format": "csv",
            "label": "CSV",
            "file": "flagship/1m/csv.zip",
            "key": "datasets/hospital-sample-database/v1/flagship/1m/csv.zip",
            "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/hospital-sample-database/v1/flagship/1m/csv.zip",
            "bytes": 46236853,
            "sha256": "dc2de62dd71b425c7e9a86419cc5fef545675c7eba5d6f8eff3bded54a77dd9e",
            "tables": {
              "admissions": {
                "bytes": 1374251,
                "sha256": "a31178973a588677a31c1c2dab6bf7c3dcf688e694dccdd987bc7958a60bca00"
              },
              "allergies": {
                "bytes": 431,
                "sha256": "0de44cb24e6a25197ac84f91663d0d9c0bd655e5e8cc8920a2736c4871a9b9dd"
              },
              "appointments": {
                "bytes": 62992278,
                "sha256": "54f4766916805de48d2fc49a412bc67127f0fd2b2d26daf98615d25aeecc8e0a"
              },
              "beds": {
                "bytes": 14608,
                "sha256": "4c00ea1bc8457ffab0c670d1e1936f623cd1a49233990919e9afa27609b5216b"
              },
              "billing": {
                "bytes": 8790374,
                "sha256": "7ea3bc4d5f379fe57d2ad0d9eb89da8ab0ed7810df07726c28ceb850cbe3ce32"
              },
              "billing_items": {
                "bytes": 13022709,
                "sha256": "1243145dcceb8cb8e4bed533a3402f1ca514e521ffd922566f24184cbc1cf048"
              },
              "departments": {
                "bytes": 627,
                "sha256": "5319a61b1547e2dfd4dcb23d308a165dd2040376b95f9bb96a4782fc67cd11f7"
              },
              "doctors": {
                "bytes": 41477,
                "sha256": "8783203530d905c0e2ba17dbcffd554acf7accc1f96d48df225b11e4aa3fdfc3"
              },
              "insurance_policies": {
                "bytes": 2423792,
                "sha256": "bc1164bb0a70276fc774954829aebe117083d44696d1f2f50b372bf5afd420bc"
              },
              "insurance_providers": {
                "bytes": 1034,
                "sha256": "f7c72a96589c70a4a0916882a87dd03ec33a2295a09b68f0cc1a3d1ea6be18f9"
              },
              "inventory_categories": {
                "bytes": 202,
                "sha256": "96e071508087d6d0e92e85cfbdb0310a81eb63a9b8a5696f70c2067a91944889"
              },
              "inventory_items": {
                "bytes": 6204,
                "sha256": "d736b705adfd1912bd02ecc3d8b0e49e8f804125b4af968783c23f794ae2b4e9"
              },
              "lab_requests": {
                "bytes": 5915564,
                "sha256": "dfec0e8d1ff781ffdd6aeefee69704c92564a6228ede21690b6d51be98c2ea86"
              },
              "lab_results": {
                "bytes": 6261201,
                "sha256": "37a9a76587645bb93326f7b13a655f67fad904cedfaf2a6727574827bf93aaf2"
              },
              "lab_tests": {
                "bytes": 1526,
                "sha256": "8278c88b45a7d3d90cb70d0c7d8d51cd79dd1fa5dd20ae46936a1f7e320c245b"
              },
              "medical_records": {
                "bytes": 17687457,
                "sha256": "109230d9c6edd7d2c62da06948520102add89967c96da7de72d8d6b65fef6b84"
              },
              "medications": {
                "bytes": 8282,
                "sha256": "566dd67ba34f1df0dad4341f9aa5a50013816d72726231a856b826fed8505069"
              },
              "patient_allergies": {
                "bytes": 587098,
                "sha256": "971c26f196d64346a7bca990e320fac6395ff4fdce4a3e575a1e000bb5439651"
              },
              "patients": {
                "bytes": 9223874,
                "sha256": "65ef3418351b9f3498251948ebefea9471ba77dce5758fab3ab66985eab1e36c"
              },
              "payments": {
                "bytes": 8859955,
                "sha256": "7deb2f8b7a2606be01b2053093f5d6a4cba50655af72ef6dd9b0ab2bd00dfb28"
              },
              "prescription_items": {
                "bytes": 9710678,
                "sha256": "c7a8fb2d1d995b72d17e56ce905aa210d1840b42c63238c42858a193e7c717dc"
              },
              "prescriptions": {
                "bytes": 7183508,
                "sha256": "5570050f7dac71686c7690345ea3fec61b56074820ce2e22c977f9ade1f300df"
              },
              "purchase_order_items": {
                "bytes": 105796,
                "sha256": "805bf1988980d5943f0054f81c81c82be70e06f745f09bb4c14891a5b068e6ec"
              },
              "purchase_orders": {
                "bytes": 34798,
                "sha256": "3f35d5ed654d083eec64fab840e2312cb0f01b4578a3ecf6a4c79e8803655a7c"
              },
              "rooms": {
                "bytes": 5036,
                "sha256": "afb36334a67b80034abfb18e8aa9187dcdaf1a967b987947a8432498a9d36f12"
              },
              "schedules": {
                "bytes": 1029055,
                "sha256": "ac2ae17242e12a7d6898de98f60526d283b48155238a876532e276246e5d338c"
              },
              "staff": {
                "bytes": 153794,
                "sha256": "60ce5b827b0e74c462db66a87611aa3bf1a5595e09b80c39c06caf1691f3702e"
              },
              "staff_roles": {
                "bytes": 257,
                "sha256": "427e5d57bf185bf4ce528d9cbdb99a6f1cc4c78984ddb4eb6628839ba426f07f"
              },
              "surgeries": {
                "bytes": 1211,
                "sha256": "e57ea03dd51ea4c3494afbacb8d7cc490e7263a93c2ef4ac91f12315d211583d"
              },
              "surgical_procedures": {
                "bytes": 162902,
                "sha256": "01df19c219d40c4df7e12ac518de53f8da2f07f1aebb1343b49afac46a5793ba"
              },
              "vendors": {
                "bytes": 2019,
                "sha256": "11eaef9ccdbab9f2f6141faa0f31e9735a64599ea7dcc594d4579751b8af6262"
              },
              "visitors": {
                "bytes": 2244757,
                "sha256": "b61808608f7ca0d747676203620a5901125ebfa499fddf1863b0c10c51257877"
              },
              "wards": {
                "bytes": 506,
                "sha256": "814dd984c78e3af576f0d947ea7f95e975fe53d2cd10e46714ebfe79eb79b950"
              }
            },
            "contentType": "application/zip"
          }
        ],
        "checks": {
          "postgres": {
            "version": "18.3",
            "ok": true
          },
          "sqlite": {
            "version": "3.53.1",
            "ok": true
          },
          "notRun": [
            {
              "engine": "MySQL",
              "note": "Written from the same rows; not loaded here, no MySQL server runs in the build."
            }
          ]
        },
        "rules": [
          {
            "name": "A lab result comes after its request, and the request after its record",
            "violations": 0
          },
          {
            "name": "A discharge comes after its admission, and surgery after admission",
            "violations": 0
          },
          {
            "name": "A bill is the sum of its lines",
            "violations": 0
          },
          {
            "name": "A payment settles its bill in full, after the bill was issued",
            "violations": 0
          },
          {
            "name": "What a bill shows as paid is the sum of its payments",
            "violations": 0
          },
          {
            "name": "A prescription is written on the day of its record, or the day after",
            "violations": 0
          },
          {
            "name": "One doctor profile per staff member, one result per lab request",
            "violations": 0
          }
        ]
      }
    },
    "rules": [
      {
        "name": "A lab result comes after its request, and the request after its record",
        "sql": "SELECT count(*) AS violations FROM lab_results res JOIN lab_requests req ON req.id = res.request_id JOIN medical_records mr ON mr.id = req.medical_record_id WHERE res.performed_date < req.request_date OR req.request_date < mr.created_at"
      },
      {
        "name": "A discharge comes after its admission, and surgery after admission",
        "sql": "SELECT (SELECT count(*) FROM admissions WHERE discharge_date < admission_date) + (SELECT count(*) FROM surgical_procedures s JOIN admissions a ON a.id = s.admission_id WHERE s.scheduled_time < a.admission_date) AS violations"
      },
      {
        "name": "A bill is the sum of its lines",
        "sql": "SELECT count(*) AS violations FROM billing b LEFT JOIN (SELECT billing_id, sum(amount) AS lines FROM billing_items GROUP BY billing_id) i ON i.billing_id = b.id WHERE b.total_amount <> COALESCE(i.lines, 0)"
      },
      {
        "name": "A payment settles its bill in full, after the bill was issued",
        "sql": "SELECT count(*) AS violations FROM payments p JOIN billing b ON b.id = p.billing_id WHERE p.amount <> b.total_amount OR p.payment_date::date < b.billing_date"
      },
      {
        "name": "What a bill shows as paid is the sum of its payments",
        "sql": "SELECT count(*) AS violations FROM billing b LEFT JOIN (SELECT billing_id, sum(amount) AS paid FROM payments GROUP BY billing_id) p ON p.billing_id = b.id WHERE b.paid_amount <> COALESCE(p.paid, 0)"
      },
      {
        "name": "A prescription is written on the day of its record, or the day after",
        "sql": "SELECT count(*) AS violations FROM prescriptions p JOIN medical_records mr ON mr.id = p.medical_record_id WHERE p.prescribed_date < mr.created_at::date OR p.prescribed_date > mr.created_at::date + 1"
      },
      {
        "name": "One doctor profile per staff member, one result per lab request",
        "sql": "SELECT (SELECT count(*) - count(DISTINCT staff_id) FROM doctors) + (SELECT count(*) - count(DISTINCT request_id) FROM lab_results) AS violations"
      }
    ]
  },
  "publishedAt": 1791325551966,
  "updatedAt": 1791325551966
}
