Skip to content

Commit

Permalink
Do not skip checking second row when it is empty
Browse files Browse the repository at this point in the history
Blank rows are allowed for the fourth row onwards. Any row before that
should not be skipped due to being blank.
  • Loading branch information
mint-thompson committed Jul 8, 2024
1 parent 0a7d6c2 commit dc9210f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export async function validateCsv(
],
})
parser.abort()
} else if (isEmpty) {
} else if (isEmpty && index !== 1) {
++index
return
}
Expand Down
9 changes: 9 additions & 0 deletions test/2.0/csv.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ test("validateCsvWideHeaderError", async (t) => {
])
})

test("validateCsvHeaderEmpty", async (t) => {
const result = await validateCsv(
loadFixtureStream("/2.0/sample-wide-header-empty.csv"),
"v2.0"
)
t.is(result.valid, false)
t.is(result.errors.length, 7)
})

test("validateCsvWideMissingValueError", async (t) => {
const result = await validateCsv(
loadFixtureStream("/2.0/sample-wide-error-missing-value.csv"),
Expand Down
13 changes: 13 additions & 0 deletions test/fixtures/2.0/sample-wide-header-empty.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
hospital_name,last_updated_on,version,hospital_location,hospital_address,license_number|AL,"To the best of its knowledge and belief, the hospital has included all applicable standard charge information in accordance with the requirements of 45 CFR 180.50, and the information encoded is true, accurate, and complete as of the date indicated.",,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,
description,code|1,code|1|type,code|2,code|2|type,modifiers,setting,drug_unit_of_measurement,drug_type_of_measurement,standard_charge|gross,standard_charge|discounted_cash,standard_charge|Platform_Health_Insurance|PPO|negotiated_dollar,standard_charge|Platform_Health_Insurance|PPO|negotiated_percentage,standard_charge|Platform_Health_Insurance|PPO|negotiated_algorithm,estimated_amount|Platform_Health_Insurance|PPO,standard_charge|Platform_Health_Insurance|PPO|methodology,additional_payer_notes|Platform_Health_Insurance|PPO,standard_charge|Region_Health_Insurance|HMO|negotiated_dollar,standard_charge|Region_Health_Insurance|HMO|negotiated_percentage,standard_charge|Region_Health_Insurance|HMO|negotiated_algorithm,estimated_amount|Region_Health_Insurance|HMO,standard_charge|Region_Health_Insurance|HMO|methodology,additional_payer_notes|Region_Health_Insurance|HMO,standard_charge|min,standard_charge|max,additional_generic_notes
Major hip and knee joint replacement or reattachment of lower extremity without mcc,470,MS-DRG,175869,LOCAL,,inpatient,,,,,20000,,MS-DRG,22243.34,case rate,,,50,,23145.98,percent of total billed charges,,20000,20000,
Major hip and knee joint replacement or reattachment of lower extremity without mcc,470,MS-DRG,175869,LOCAL,,inpatient,,,,,20000,,https://www.cms.gov/Outreach-and-Education/Medicare-Learning-Network-MLN/MLNProducts/html/images/OP.jpg,22243.34,case rate,,,50,,23145.98,percent of total billed charges,,20000,20000,
Major hip and knee joint replacement or reattachment of lower extremity without mcc,470,MS-DRG,175869,LOCAL,,inpatient,,,,,20000,,The adjusted base rate indicated (in dollars) may be further adjusted for transfers and outliers.,22243.34,case rate,,,50,,23145.98,percent of total billed charges,,20000,20000,
"Evaluation of hearing function to determine candidacy for, or postoperative status of, surgically implanted hearing device; first hour",92626,CPT,,,,outpatient,,,150,125,98.98,,,,fee schedule,110% of the Medicare fee schedule,,115,,105.34,fee schedule,115% of the state's workers' compensation amount,98.98,98.98,
"Behavioral health; residential (hospital residential treatment program), without room and board, per diem",H0017,HCPCS,,,,inpatient,,,2500,2250,1500,,,,per diem,,,,,,,,1500,1500,
"Behavioral health; residential (hospital residential treatment program), without room and board, per diem, days 1-3",H0017,HCPCS,,,,inpatient,,,2500,2250,,,,,,,2000,,,,per diem,,2000,2000,
"Behavioral health; residential (hospital residential treatment program), without room and board, per diem, days 4-5",H0017,HCPCS,,,,inpatient,,,2500,2250,,,,,,,1800,,,,per diem,,1800,1800,
"Behavioral health; residential (hospital residential treatment program), without room and board, per diem, days 6+",H0017,HCPCS,,,,inpatient,,,2500,2250,,,,,,,1200,,,,per diem,,1200,1200,
Treatment or observation room — observation room,762,RC,,,,outpatient,,,13000,12000,8000,,,,case rate,Negotiated standard charge without surgery and without rule out myocardial infarction,9000,,,,case rate,,8000,10000,
Treatment or observation room — observation room,762,RC,,,,outpatient,,,13000,12000,10000,,,,case rate,Negotiated standard charge without surgery and with rule out myocardial infarction,,,,,,,8000,10000,

0 comments on commit dc9210f

Please sign in to comment.