Patients with Condition

ASKED IN INTERVIEW
2pts
Healthcare

Problem Statement

Health service providers use specific prefixes to categorize chronic illnesses. You are tasked with identifying patients who have a diagnosis related to Type I Diabetes, which is represented by the code prefix DIAB1.

A patient can have multiple conditions listed in a single string, separated by spaces. You must find patients whose conditions string contains a word starting with DIAB1.

Rules:

  • A valid match is a condition that starts with DIAB1 (e.g., DIAB100) or a condition where DIAB1 appears after a space (e.g., SNOTIC DIAB110).
  • Output columns: patient_id, patient_name, conditions.
  • Results must be sorted by patient_id in ascending order.
Tests your understanding of
String Matching, Filtering and Healthcare Analytics

Input Tables

patients
patient_id(INTEGER)patient_name(VARCHAR)conditions(VARCHAR)
1DanielYFEV COUGH
2AliceDIAB100 MYOP
3BobDIAB201
4GeorgeACNE DIAB110
5AlainDIAB103
6MariyaSADIAB100
doctors
doctor_id(INTEGER)doctor_name(VARCHAR)specialty(VARCHAR)
10Dr. SmithEndocrinology
11Dr. JonesPediatrics
12Dr. AdamsGeneral Medicine
appointments
appointment_id(INTEGER)patient_id(INTEGER)appointment_date(DATE)
50122026-01-10
50242026-01-12
50352026-02-01

Expected Output

patient_id(INTEGER)patient_name(VARCHAR)conditions(VARCHAR)
2AliceDIAB100 MYOP
4GeorgeACNE DIAB110
5AlainDIAB103

Tags

EasyASKED IN INTERVIEWString MatchingFilteringHealthcare Analytics
10-15 min
72%

Hints