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

jersey-joins-epilepsy12 #1105

Open
wants to merge 15 commits into
base: live
Choose a base branch
from
Open

jersey-joins-epilepsy12 #1105

wants to merge 15 commits into from

Conversation

eatyourpeas
Copy link
Member

@eatyourpeas eatyourpeas commented Nov 24, 2024

Overview

Jersey is in the Channel Islands and part of the UK but does not participate in the NHS. There are reciprocal agreements about some hospital treatment, but inpatient care is free only to people who have been resident for 6 months and have a Health Card.

Adding Jersey General Hospital to Epilepsy12 has implications for 7 parts of the audit

  • Organisational structure: the E12 structure is that organisations have a Trust or Local Health Board as their parent. There is a hierarchy above this which varies between England and Wales. Organisations and Trusts in England might have the same name, but will always have separate ODS codes, which are often similar. Jersey General Hospital in St Helier is a Trust which provides medical care directly. To work around this, Jersey General Hospital has been created both as an Organisation and a Trust, each with the same ODS code, so that it is its own parent.
  • Levels of Abstraction: Jersey has been added as a separate country, so that it can report at the level of organisation, trust, OPEN UK Network, and country, though the numbers for 3 of these 4 hierarchies will be the same.
  • Boundary files: Shape files for Jersey's boundaries have been included in the shape_files folder. The boundaries do not map evenly to the Country model, so the Country model has been refactored to allow some fields to accept blank values. There are 3 migrations that have been created for this - the first to refactor the boundary/Country model and Trust model (to accept longer ODS codes), the second to map the Jersey shape file layers to the Country model and import the data, the third to add Jersey organisation and Trust to the database if does not exist.
  • Maps: The functions relating to mapping have been slightly altered to filter to country (something that really needed fixing anyway). The template filters out all English and Welsh organisational geographies.
  • Postcodes: E12 currently still uses findmypostcode.co.uk as a postcode validation and lookup service but RCPCH have more recently moved over to its own instance of postcodes.io. Neither of these support Jersey so a new function is included to validate Jersey postcodes (all of which begin JE) with regex. This won't validate the postcode if it does not exist, but will ensure it is at least more or less in the right format. As part of this the seed functions and E12CaseFactory have been updated to generate Jersey postcodes from a random list.
  • GeoCodes: E12 currently looks up postcodes against an API which returns longitude and latitude, and these are stored in the model (using SRID 27700) and this is used to plot them on the scatter plots. There is no authoritative open source lookup of Jersey postcodes matched with geocodes. The Jersey government have 'private partners' who sell this data at £85 a year as a csv download is the cheapest I can find. Or there is Google maps API or a string of other providers such as OpenCage, but these are similarly paid for services. There is not much about this when I search, but generally people in Jersey seem to say that accuracy and coverage is not that great. For the moment therefore a hacky work around is not to save geocode data on save and skip the lookups if the postcode is a Jersey one. This means the scatterplots currently will never have plots. I will open a separately to track the progress of this.
  • Index of multiple deprivation quantiles: We currently get IMD quantiles from our own service which accepts a postcode across England, Wales, Scotland and Northern Ireland and returns country-specific quantiles. It does not accept Jersey postcodes, since the reference data for IMD does not cover Jersey. Jersey released some data based on its census of 2021 here and makes interesting reading. In the 10 years from 2011, deprivation has fallen, completely the opposite of England who introduced austerity measures in 2010. There are more old people in Jersey, and more people now have cars, fewer have children under 5 y, more have qualifications and their own home. Interestingly more are single parents. Because the population is small (~100,000), IMD is reported in vingtaines, rather than quintiles or deciles. The actual data is not published (at least that I can see) be we could contact Ian Cope (Chief Statistician | chiefstatistician@gov.je) potentially to ask if we may have it. I should have thought a simple look up could be hard coded into E12, though ideally we would include this in the RCPCH Census Platform. For the moment, we get a 500 error (which needs fixing) and this is trapped in a try..except so that no value is stored.
  • Unique Reference Number (URN) Since Jersey is not part of the NHS, users do not have NHS numbers, instead they have URNs. There is no published methodology on the creation of these numbers, how uniqueness is ensured, whether there is any checksum/validation method as is the case for NHS numbers. To accommodate this this PR includes a new field in the Case model unique_reference_number which is (unique, obviously) but conditionally used in the forms, list views and so on if Jersey General Hospital and its patients are involved. The CaseForm now accepts an organisation_id parameter to check for this and has a is_jersey flag to decide whether to allow users to store URNs or NHS Numbers for a given patient. Cleaning methods have been updated for this. I have not yet added any tests for this but it appears to work in the UI at least. The templates have been updated conditionally to reference URN vs NHS Numbers, as well as the filters.

Other bits

The admin has been updated to allow search fields for Trust and Organisation models

Documentation changes (done or required as a result of this PR)

Documentation has been added on how to add .shp files and laymapping as this process is convoluted and easy to get wrong. I will add some of the detail above in separate commits.

Tests

There are no tests specifically for Jersey. I will do this in separate commits. Existing tests are all passing.

Related Issues

This closes #1100

New issues will be created for:

  1. service to validate Jersey postcodes
  2. service to return longitude/latitude against Jersey postcodes
  3. index of multiple deprivation in Jersey

…untry model fields, new migration to add boundaries, then another for the trust and the organisation. Note need extra migration to allow longer ods_code in Trust and empty fields in Country boundaries model
…d of jersey to 27700 from 4326 file source. Replace trust addition of Jersey with name rather than country object
…r organisation_id in CaseForm for validation of NHS number vs URN
…ell, the only way to do this is to pay for it as there are no open source datasets. Fix form to actually save the new URN (d'oh)
@eatyourpeas
Copy link
Member Author

image image image

@eatyourpeas eatyourpeas added the feature request This is a desirable feature label Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request This is a desirable feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding Jersey to platform
1 participant