Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Handling Missing Data During Ingestion
00:00
5 left

Handling Missing Data During Ingestion

MediumSQL · PostgreSQL

Problem

Tell me how you handle missing or malformed data during ingestion.

Inspect the provided raw records and allowed event types. Return one validation result for every raw record. Treat trimmed blank values as missing, accept only calendar-valid dates in YYYY-MM-DD form, accept nonnegative decimal measurements, and require a recognized event type. Do not allow malformed values to abort the query.

Output

  1. Columns: source_line, record_id, ingestion_status, rejection_reason, normalized_visit_date, normalized_measurement
  2. One row per raw record, ordered by source_line
  3. Include accepted and rejected records; rejected records must identify each applicable reason

Schema

raw_ingestion_records
ColumnTypeDescription
source_linePKINTEGERSource row number from the ingestion file
record_idVARCHAR(30)Raw record identifier
raw_visit_dateVARCHAR(30)Raw visit date text
raw_measurementVARCHAR(30)Raw numeric measurement text
event_typeVARCHAR(30)Raw event type code
subject_codeVARCHAR(30)Subject identifier
allowed_event_types
ColumnTypeDescription
event_typePKVARCHAR(30)Recognized event type code
event_descriptionVARCHAR(100)Description of the recognized event type
Tablesraw_ingestion_recordsallowed_event_types
Interviewer

Your question is Handling Missing Data During Ingestion. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.