Skip to content

Commit

Permalink
Merge pull request #44 from rcpch:eatyourpeas/issue41
Browse files Browse the repository at this point in the history
new-jersey
  • Loading branch information
eatyourpeas authored Nov 30, 2024
2 parents 72ccd3a + 126c243 commit cfcaf79
Show file tree
Hide file tree
Showing 30 changed files with 367 additions and 219 deletions.
3 changes: 3 additions & 0 deletions rcpch_nhs_organisations/hospitals/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Register your models here.
from .models import (
Country,
LocalHealthBoard,
Organisation,
PaediatricDiabetesNetwork,
Expand All @@ -16,6 +17,8 @@
admin.site.register(PaediatricDiabetesNetwork)
admin.site.register(Trust)

admin.site.register(Country)

admin.site.site_header = "RCPCH NHS Organisations"
admin.site.site_title = "RCPCH NHS Organisations admin"
admin.site.index_title = "RCPCH NHS Organisations"
Expand Down
207 changes: 91 additions & 116 deletions rcpch_nhs_organisations/hospitals/constants/rcpch_organisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6011,7 +6011,7 @@
"Sector": "",
"OrganisationStatus": "",
"IsPimsManaged": "",
"OrganisationName": "SANDRINGHAM HOUSE",
"OrganisationName": "SALFORD CARE ORGANISATION",
"Address1": "WINDSOR STREET",
"Address2": "",
"Address3": "",
Expand Down Expand Up @@ -8203,31 +8203,31 @@
"Fax": "",
"LocalAuthority": "E06000060",
},
# {
# "OrganisationID": "",
# "OrganisationCode": "R0A07",
# "OrganisationType": "",
# "SubType": "",
# "Sector": "",
# "OrganisationStatus": "",
# "IsPimsManaged": "",
# "OrganisationName": "WYTHENSHAWE HOSPITAL",
# "Address1": "SOUTHMOOR ROAD",
# "Address2": "",
# "Address3": "",
# "City": "MANCHESTER",
# "County": "GREATER MANCHESTER",
# "Postcode": "M23 9LT",
# "Latitude": "53.38911906358711",
# "Longitude": "-2.2919031193396626",
# "ParentODSCode": "RM3",
# "ParentName": "NORTHERN CARE ALLIANCE NHS FOUNDATION TRUST",
# "Phone": "",
# "Email": "",
# "Website": "",
# "Fax": "",
# "LocalAuthority": "E08000003",
# }, # Duplicate but note different ParentODSCode and ParentName. Wythenshawe Hospital is part of Manchester University NHS Foundation Trust and has never been part of Northern Care Alliance NHS Foundation Trust.
{
"OrganisationID": "",
"OrganisationCode": "RM325",
"OrganisationType": "",
"SubType": "",
"Sector": "",
"OrganisationStatus": "",
"IsPimsManaged": "",
"OrganisationName": "WYTHENSHAWE HOSPITAL",
"Address1": "SOUTHMOOR ROAD",
"Address2": "",
"Address3": "",
"City": "MANCHESTER",
"County": "GREATER MANCHESTER",
"Postcode": "M23 9LT",
"Latitude": "53.38911906358711",
"Longitude": "-2.2919031193396626",
"ParentODSCode": "RM3",
"ParentName": "NORTHERN CARE ALLIANCE NHS FOUNDATION TRUST",
"Phone": "",
"Email": "",
"Website": "",
"Fax": "",
"LocalAuthority": "E08000003",
},
{
"OrganisationID": "39985",
"OrganisationCode": "RA430",
Expand Down Expand Up @@ -8354,7 +8354,7 @@
},
{
"OrganisationID": "",
"OrganisationCode": "RM325",
"OrganisationCode": "R0A07",
"OrganisationType": "",
"SubType": "",
"Sector": "",
Expand Down Expand Up @@ -8429,29 +8429,54 @@
}, # 01/04/2023 QHL NHS BIRMINGHAM AND SOLIHULL INTEGRATED CARE BOARD, MIDLANDS, Birmingham Regional Paediatric Neurology Forum
{
"OrganisationID": "",
"OrganisationCode": "RGT1W",
"OrganisationCode": "RTX02",
"OrganisationType": "",
"SubType": "",
"Sector": "",
"OrganisationStatus": "",
"IsPimsManaged": "",
"OrganisationName": "JERSEY GENERAL HOSPITAL",
"Address1": "The Parade",
"OrganisationName": "ROYAL LANCASTER INFIRMARY",
"Address1": "ASHTON ROAD",
"Address2": "",
"Address3": "",
"City": "St Helier",
"County": "",
"Postcode": "JE1 3QS",
"Latitude": "49.1877254",
"Longitude": "-2.112157",
"ParentODSCode": "RGT",
"ParentName": "CAMBRIDGE UNIVERSITY HOSPITALS NHS FOUNDATION TRUST",
"Phone": "01534 442000",
"City": "LANCASTER",
"County": "LANCASHIRE",
"Postcode": "LA1 4RP",
"Latitude": "54.04260571850475",
"Longitude": "-2.8000539872490346",
"ParentODSCode": "RTX",
"ParentName": "UNIVERSITY HOSPITALS OF MORECAMBE BAY NHS FOUNDATION TRUST",
"Phone": "",
"Email": "",
"Website": "https://www.gov.je/Health/Hospitals/HospitalDepartments/pages/index.aspx",
"Website": "",
"Fax": "",
"LocalAuthority": "E07000121",
}, # 01/04/1998 QE1 NHS LANCASHIRE AND SOUTH CUMBRIA INTEGRATED CARE BOARD, Y62 NORTH WEST COMMISSIONING REGION, North West Children and Young People's Epilepsy Interest Group' (NWIG)
{
"OrganisationID": "",
"OrganisationCode": "RL131",
"OrganisationType": "",
"SubType": "",
"Sector": "",
"OrganisationStatus": "",
"IsPimsManaged": "",
"OrganisationName": "ROBERT JONES & AGNES HUNT ORTHOPAEDIC HOSPITAL",
"Address1": "GOBOWEN",
"Address2": "",
"Address3": "",
"City": "OSWESTRY",
"County": "SHROPSHIRE",
"Postcode": "SY10 7AG",
"Latitude": "52.8846159748024",
"Longitude": "-3.0335475872529485",
"ParentODSCode": "RL1",
"ParentName": "THE ROBERT JONES AND AGNES HUNT ORTHOPAEDIC HOSPITAL NHS FOUNDATION TRUST",
"Phone": "",
"Email": "",
"Website": "",
"Fax": "",
"LocalAuthority": "",
}, # Addition 22.6.2024 - Jersey is not part of the UK and is not included in the NHS Digital data. It is included here as is now a PDU
}, # 01/04/1994 Region: Y60 MIDLANDS COMMISSIONING REGION, ICB: QOC NHS SHROPSHIRE, TELFORD AND WREKIN INTEGRATED CARE BOARD, OPENUK: BRPNF - Birmingham Regional Paediatric Neurology Form
{
"OrganisationID": "",
"OrganisationCode": "8HV48",
Expand All @@ -8477,83 +8502,34 @@
"Fax": "",
"LocalAuthority": "",
}, # Addition 29.6.2024 - Add RCPCH!
{
"OrganisationID": "",
"OrganisationCode": "RTX02",
"OrganisationType": "",
"SubType": "",
"Sector": "",
"OrganisationStatus": "",
"IsPimsManaged": "",
"OrganisationName": "ROYAL LANCASTER INFIRMARY",
"Address1": "ASHTON ROAD",
"Address2": "",
"Address3": "",
"City": "LANCASTER",
"County": "LANCASHIRE",
"Postcode": "LA1 4RP",
"Latitude": "54.04260571850475",
"Longitude": "-2.8000539872490346",
"ParentODSCode": "RTX",
"ParentName": "UNIVERSITY HOSPITALS OF MORECAMBE BAY NHS FOUNDATION TRUST",
"Phone": "",
"Email": "",
"Website": "",
"Fax": "",
"LocalAuthority": "E07000121",
}, # 01/04/1998 QE1 NHS LANCASHIRE AND SOUTH CUMBRIA INTEGRATED CARE BOARD, Y62 NORTH WEST COMMISSIONING REGION, North West Children and Young People's Epilepsy Interest Group' (NWIG)
# { COMMENTED OUT AS DUPLICATE BUT NOTE DIFFERENT PARENTODSCODE AND PARENTNAME
# "OrganisationID": "",
# "OrganisationCode": "RL114",
# "OrganisationType": "",
# "SubType": "",
# "Sector": "",
# "OrganisationStatus": "",
# "IsPimsManaged": "",
# "OrganisationName": "PRINCESS ROYAL HOSPITAL",
# "Address1": "APLEY CASTLE",
# "Address2": "APLEY",
# "Address3": "",
# "City": "TELFORD",
# "County": "SHROPSHIRE",
# "Postcode": "TF1 6TF",
# "Latitude": "52.693",
# "Longitude": "-2.471",
# "ParentODSCode": "RL1",
# "ParentName": "THE ROBERT JONES AND AGNES HUNT ORTHOPAEDIC HOSPITAL NHS FOUNDATION TRUST",
# "Phone": "01952 641222",
# "Email": "",
# "Website": "",
# "Fax": "",
# "LocalAuthority": "E07000076",
# }, # 01/10/2012 QOC NHS SHROPSHIRE, TELFORD AND WREKIN INTEGRATED CARE BOARD, Y60 MIDLANDS COMMISSIONING REGION, BRPNF - Birmingham Regional Paediatric Neurology Form
# {
# "OrganisationID": "",
# "OrganisationCode": "RL108",
# "OrganisationType": "",
# "SubType": "",
# "Sector": "",
# "OrganisationStatus": "",
# "IsPimsManaged": "",
# "OrganisationName": "ROYAL SHREWSBURY HOSPITAL",
# "Address1": "MYTTON OAK ROAD",
# "Address2": "",
# "Address3": "",
# "City": "SHREWSBURY",
# "County": "SHROPSHIRE",
# "Postcode": "SY3 8XQ",
# "Latitude": "52.699",
# "Longitude": "-2.748",
# "ParentODSCode": "RL1",
# "ParentName": "THE ROBERT JONES AND AGNES HUNT ORTHOPAEDIC HOSPITAL NHS FOUNDATION TRUST",
# "Phone": "01743 261000",
# "Email": "",
# "Website": "",
# "Fax": "",
# "LocalAuthority": "E07000076",
# }, # 01/10/2012 QOC NHS SHROPSHIRE, TELFORD AND WREKIN INTEGRATED CARE BOARD, Y60 MIDLANDS COMMISSIONING REGION, BRPNF - Birmingham Regional Paediatric Neurology Form
]

JERSEY_ORGANISATION = {
"OrganisationID": "",
"OrganisationCode": "RGT1W",
"OrganisationType": "",
"SubType": "",
"Sector": "",
"OrganisationStatus": "",
"IsPimsManaged": "",
"OrganisationName": "JERSEY GENERAL HOSPITAL",
"Address1": "THE PARADE",
"Address2": "",
"Address3": "",
"City": "ST HELIER",
"County": "JERSEY",
"Postcode": "JE1 3Q",
"Latitude": "49.18841258908002",
"Longitude": "-2.1122213730166157",
"ParentODSCode": "RGT1W", # This is a special case as it is both an organisation and a trust so the parent trust ODS code is the same as the organisation code and exists in both models.
"ParentName": "JERSEY GENERAL HOSPITAL",
"Phone": "01534 442000",
"Email": "",
"Website": "https://www.gov.je/Health/Hospitals/HospitalDepartments/pages/index.aspx",
"Fax": "",
"LocalAuthority": "",
} # 01/04/2015 - Jersey General Hospital, Jersey, Channel Islands is a special case as it is both an organisation and a trust. It is member of the South West Interest Group Paediatric Epilepsy. It has no other organisational hierarchies

"""
Steps to update organisation in the console once created in the admin
from django.contrib.gis.geos import Point
Expand All @@ -8564,4 +8540,3 @@
from epilepsy12.common_view_functions import _seed_all_aggregation_models
_seed_all_aggregation_models()
"""
# Organisation.objects.create(ods_code="RGT1W",name="JERSEY GENERAL HOSPITAL",website=,address1="The Parade",address2="",address3="",telephone="",city="St Helier",county="",latitude=49.1877254,longitude=-2.112157,postcode="JE1 3QS",geocode_coordinates=Point(x=-2.112157,y=49.1877254),active=True,published_at=Date(1993,4,1),paediatric_diabetes_unit="PZ248",trust=,local_health_board,integrated_care_board,nhs_england_region,openuk_network,london_borough,country,)
11 changes: 11 additions & 0 deletions rcpch_nhs_organisations/hospitals/constants/trust.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Does not include Wales - these are in the Local Health Boards file
Some ambulance trusts are here but commented out.
"""

TRUSTS = [
{
"ods_code": "RVV",
Expand Down Expand Up @@ -2185,3 +2186,13 @@
"country": "ENGLAND",
},
]

JERSEY_NHS_TRUST = {
"ods_code": "RGT1W",
"trust_name": "JERSEY GENERAL HOSPITAL",
"address_line_1": "THE PARADE",
"address_line_2": "",
"town": "ST HELIER",
"postcode": "JE1 3Q",
"country": "JERSEY",
} # 01/04/2015 Jersey is a special case as it is both an organisation and a Trust. The ODS code is the same for both.
31 changes: 14 additions & 17 deletions rcpch_nhs_organisations/hospitals/management/commands/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
update_pdu_networks,
seed_pdus,
ods_codes_to_abstraction_levels,
load_jersey_boundaries,
create_jersey_country,
create_jersey_general_hospital,
)

from .image import rcpch_ascii_art
Expand All @@ -31,53 +30,51 @@ class Command(BaseCommand):
help = "seed database with census and IMD data for England, Wales, Scotland and Northern Ireland."

def add_arguments(self, parser):
parser.add_argument("--model", type=str, help="Mode")
parser.add_argument(
"--level",
type=str,
help="Level. e.g. Trust, Network, PDU. Enter 'all' to seed all. Enter --help for more information.",
)

def handle(self, *args, **options):
if options["model"] == "abstraction_levels":
if options["level"] == "abstraction_levels":
self.stdout.write(B + "Adding abstraction levels..." + W)
ods_codes_to_abstraction_levels()
rcpch_ascii_art()
elif options["model"] == "trusts":
elif options["level"] == "trusts":
self.stdout.write(B + "Adding trusts..." + W)
seed_trusts()
rcpch_ascii_art()
elif options["model"] == "organisations":
elif options["level"] == "organisations":
self.stdout.write(B + "Adding organisations..." + W)
seed_organisations()
rcpch_ascii_art()
elif options["model"] == "paediatric_diabetes_networks":
elif options["level"] == "paediatric_diabetes_networks":
self.stdout.write(B + "Adding paediatric diabetes networks..." + W)
seed_paediatric_diabetes_networks()
rcpch_ascii_art()
elif options["model"] == "pdus":
elif options["level"] == "pdus":
self.stdout.write(
B + "Adding paediatric diabetes units and networks..." + W
)
seed_paediatric_diabetes_networks()
seed_pdus()
rcpch_ascii_art()
elif options["model"] == "update_pdus_with_networks":
elif options["level"] == "update_pdus_with_networks":
self.stdout.write(
B + "Adding paediatric diabetes units and networks..." + W
)
update_pdu_networks()
rcpch_ascii_art()
elif options["model"] == "jersey":
self.stdout.write(B + "Adding Jersey boundaries..." + W)
load_jersey_boundaries()
rcpch_ascii_art()
elif options["model"] == "all":
elif options["level"] == "all":
self.stdout.write(
B + "Adding all organisations and levels of abstraction..." + W
)
create_jersey_country()
ods_codes_to_abstraction_levels()
seed_trusts()
seed_organisations()

create_jersey_general_hospital()
seed_pdus()
load_jersey_boundaries()
rcpch_ascii_art()

else:
Expand Down
Loading

0 comments on commit cfcaf79

Please sign in to comment.