Skip to content

Commit

Permalink
Merge pull request #1160 from rcpch/eatyourpeas/issue1158
Browse files Browse the repository at this point in the history
fix-mri-unscored
  • Loading branch information
eatyourpeas authored Jan 11, 2025
2 parents 7951f59 + e957206 commit 8e5cd02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def score_kpi_5(registration_instance, age_at_first_paediatric_assessment) -> in

if investigations.mri_indicated is not None:
if any(mri_dates_are_none) and investigations.mri_indicated is True:
return KPI_SCORE["NOT_SCORED"]
return KPI_SCORE["FAIL"]
elif investigations.mri_indicated is False:
return KPI_SCORE["FAIL"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- [ x] Measure 5 passed (registration.kpi.mri == 1) if MRI done in 6 weeks and are NOT JME or JAE or CAE or CECTS/Rolandic or Epilepsy with generalized tonic–clonic seizures alone (lines 270-324)
- [ x] Measure 5 failed (registration.kpi.mri == 0) if MRI not done in 6 weeks and are NOT JME or JAE or CAE or CECTS/Rolandic or Epilepsy with generalized tonic–clonic seizures alone (lines 270-324)
- [ x] Measure 5 ineligible (registration.kpi.mri == 0) if JME or JAE or CAE or CECTS/Rolandic or Epilepsy with generalized tonic–clonic seizures alone
- [ x] Measure 5 ineligible (registration.kpi.mri ==2) if JME or JAE or CAE or CECTS/Rolandic or Epilepsy with generalized tonic–clonic seizures alone
"""

# Standard imports
Expand Down Expand Up @@ -183,6 +183,16 @@ def test_measure_5_mri_syndromes_pass_fail(
kpi_score == EXPECTED_SCORE
), f"None of JME or JAE or CAE or CECTS/Rolandi present, MRI booked > 6 weeks but not failing measure"

registration.investigations.mri_brain_requested_date = None
registration.investigations.mri_brain_reported_date = None
registration.investigations.mri_indicated = True
registration.investigations.save()

calculate_kpis(registration_instance=registration)

kpi_score = KPI.objects.get(pk=registration.kpi.pk).mri
assert kpi_score == KPI_SCORE["FAIL"], "MRI indicated but no dates should fail."


@pytest.mark.parametrize(
"SYNDROME_TYPE_PRESENT",
Expand Down

0 comments on commit 8e5cd02

Please sign in to comment.