This document describes the database schema used by the XRayVision application.
The XRayVision application uses a SQLite database to store patient information, exam metadata, AI-generated reports, and radiologist reports. The schema is designed to be normalized to reduce data redundancy and improve query performance.
Stores patient demographic information.
| Column | Type | Description |
|---|---|---|
| cnp | TEXT (PRIMARY KEY) | Romanian personal identification number |
| id | TEXT | Patient ID from hospital system |
| name | TEXT | Patient full name |
| age | INTEGER | Patient age in years |
| sex | TEXT | Patient sex ('M', 'F', or 'O') |
Stores exam metadata and processing status.
| Column | Type | Description |
|---|---|---|
| uid | TEXT (PRIMARY KEY) | Unique exam identifier (SOP Instance UID) |
| cnp | TEXT (FOREIGN KEY) | References patients.cnp |
| id | TEXT | Imaging study ID from HIS |
| created | TIMESTAMP | Exam timestamp from DICOM |
| protocol | TEXT | Imaging protocol name from DICOM |
| region | TEXT | Anatomic region identified from protocol |
| type | TEXT | Exam type/modality |
| status | TEXT | Processing status ('none', 'queued', 'processing', 'done', 'error', 'ignore') |
| study | TEXT | Study Instance UID |
| series | TEXT | Series Instance UID |
Stores AI-generated reports and analysis results.
| Column | Type | Description |
|---|---|---|
| uid | TEXT (PRIMARY KEY, FOREIGN KEY) | References exams.uid |
| created | TIMESTAMP | Report creation timestamp (default: CURRENT_TIMESTAMP) |
| updated | TIMESTAMP | Report last update timestamp (default: CURRENT_TIMESTAMP) |
| text | TEXT | AI-generated report content |
| positive | INTEGER | Binary indicator (-1=not assessed, 0=no findings, 1=findings) |
| confidence | INTEGER | AI self-confidence score (0-100, -1 if not assessed) |
| model | TEXT | Name of the model used to analyze the image |
| latency | INTEGER | Time in seconds needed to analyze the image by the AI (-1 if not assessed) |
Stores radiologist reports and clinical information.
| Column | Type | Description |
|---|---|---|
| uid | TEXT (PRIMARY KEY, FOREIGN KEY) | References exams.uid |
| id | TEXT | Diagnostic report ID from HIS |
| created | TIMESTAMP | Report creation timestamp (default: CURRENT_TIMESTAMP) |
| updated | TIMESTAMP | Report last update timestamp (default: CURRENT_TIMESTAMP) |
| text | TEXT | Radiologist report content |
| positive | INTEGER | Binary indicator (-1=not assessed, 0=no findings, 1=findings) |
| severity | INTEGER | Severity score (0-10, -1 if not assessed) |
| summary | TEXT | Brief summary of findings |
| type | TEXT | Exam type |
| radiologist | TEXT | Identifier for the radiologist |
| justification | TEXT | Clinical diagnostic text |
| model | TEXT | Name of the model used to summarize the radiologist report |
| latency | INTEGER | Time in seconds needed by the radiologist to fill in the report (-1 if not assessed) |
To optimize query performance, the following indexes are created:
idx_exams_status: Fast filtering by exam statusidx_exams_region: Quick regional analysisidx_exams_cnp: Efficient patient lookupidx_exams_created: Fast sorting by exam creation timeidx_exams_study: Efficient study-based queriesidx_ai_reports_created: Fast sorting by AI report creation timeidx_rad_reports_created: Fast sorting by radiologist report creation timeidx_patients_name: Fast patient name searches
exams.cnpreferencespatients.cnpai_reports.uidreferencesexams.uidrad_reports.uidreferencesexams.uid
- Foreign key constraints are enabled to maintain referential integrity
- The
sexcolumn in thepatientstable is constrained to values 'M', 'F', or 'O' - The
positivecolumn inai_reportsis constrained to values -1, 0, or 1 - The
confidencecolumn inai_reportsis constrained to values between -1 and 100 - The
positivecolumn inrad_reportsis constrained to values -1, 0, or 1 - The
severitycolumn inrad_reportsis constrained to values between -1 and 10