Skip to content

Commit

Permalink
Merge pull request #311 from rcpch/anchit/kpis/implement-pdu-vs-patie…
Browse files Browse the repository at this point in the history
…nt-calc-methods

Anchit/kpis/implement-pdu-vs-patient-calc-methods
  • Loading branch information
anchit-chandran authored Oct 9, 2024
2 parents 1d1df5f + 66dc4e2 commit 423c2f4
Show file tree
Hide file tree
Showing 17 changed files with 684 additions and 440 deletions.
7 changes: 3 additions & 4 deletions project/constants/types/kpi_types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Object types
from dataclasses import dataclass
from datetime import date, datetime
from typing import Dict, Union
from typing import Dict


@dataclass
Expand All @@ -14,12 +14,11 @@ class KPIResult:

@dataclass
class KPICalculationsObject:
pz_code: str
calculation_datetime: datetime
audit_start_date: date
audit_end_date: date
total_patients_count: int
calculated_kpi_values: Dict[
str,
Union[KPIResult, str],
] # looks like { 'kpi_name' : KPIResult OR "Not implemented"}
KPIResult,
]
31 changes: 13 additions & 18 deletions project/npda/forms/patient_form.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
# python imports
from datetime import date
import logging
from datetime import date

# project imports
import nhs_number
# third-party imports
from dateutil.relativedelta import relativedelta
from django import forms
# django imports
from django.apps import apps
from django.core.exceptions import ValidationError
from django import forms

# third-party imports
from dateutil.relativedelta import relativedelta
from requests import RequestException

# project imports
import nhs_number
from ..models import Patient
from ...constants.styles.form_styles import *
from ..general_functions import (
validate_postcode,
gp_ods_code_for_postcode,
gp_details_for_ods_code,
imd_for_postcode
)
from ..general_functions import (gp_details_for_ods_code,
gp_ods_code_for_postcode, imd_for_postcode,
validate_postcode)
from ..models import Patient
from ..validators import not_in_the_future_validator


logger = logging.getLogger(__name__)


Expand All @@ -34,7 +29,7 @@ class DateInput(forms.DateInput):
class NHSNumberField(forms.CharField):
def to_python(self, value):
number = super().to_python(value)
normalised = nhs_number.normalise_number(number)
normalised = nhs_number.standardise_format(number)

# For some combinations we get back an empty string (eg '719-573 0220')
return normalised or value
Expand Down Expand Up @@ -103,13 +98,13 @@ def clean_date_of_birth(self):
)

return date_of_birth

def clean_postcode(self):
postcode = self.cleaned_data["postcode"]

try:
result = validate_postcode(postcode)

if not result:
self.add_error(
"postcode",
Expand Down
Loading

0 comments on commit 423c2f4

Please sign in to comment.