Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Friday 21 Feb 2025 #631

Open
anchit-chandran opened this issue Feb 18, 2025 · 0 comments
Open

Friday 21 Feb 2025 #631

anchit-chandran opened this issue Feb 18, 2025 · 0 comments

Comments

@anchit-chandran
Copy link
Contributor

anchit-chandran commented Feb 18, 2025

I asked chatgpt to summarise and succinct-ize:

Transfer Behaviour

Current Implementation

A "transfer" currently works as follows:

  1. patient_1 is associated with PDU_old.
  2. When moving out of the area, PDU_old marks date_leaving_service and reason_leaving_service in the Transfer model (via Edit Child Details form).
  3. Once patient_1 appears in a Submission under PDU_new, they are included in KPI calculations.

Key Concern

This implementation doesn't explicitly "transfer" a child but relies on:

  • PDU_old marking them as left (to be excluded from KPIs).
  • PDU_new including them in a Submission (to be counted in KPIs).
  • This process is user-dependent, making it non-guaranteed but previously accepted.

KPI Calculation Issue

Currently, KPI calculations ignore Transfer.date_leaving_service and Transfer.reason_leaving_service, meaning patient_1 may still be included in PDU_old's KPIs even after being marked as left.

Proposed Fix: Exclude Patients Marked as Left

Modify the base queryset for KPI calculations to exclude patients with a date_leaving_service and reason_leaving_service:

self.patients = Patient.objects.filter(
    paediatric_diabetes_units__paediatric_diabetes_unit__pz_code__in=pz_codes,
    paediatric_diabetes_units__date_leaving_service__isnull=True,
    paediatric_diabetes_units__reason_leaving_service__isnull=True,
)

Example Impact of This Change

PDU KPI1 (Current) KPI1 (Updated) KPI5
PDU_old Included Excluded Excluded
PDU_new Included Included Included
  • Currently, PDU_old includes patient_1 in KPI1 even after leaving.
  • The proposed change ensures patient_1 is excluded from all calculations in PDU_old once marked as left.
  • KPIs like KPI5 already exclude these patients correctly.
  • A change to this base patient queryset will have knock on effects on almost all subsequent KPIs: essentially, if filtered out, they are ignored for almost all KPI calculations

Discussion Points

  • Does this fix align with expected transfer behaviour?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant