Skip to content

Commit

Permalink
Merge pull request #19 from rcpch:development
Browse files Browse the repository at this point in the history
remove last migration and move to seed as azure too lacklustre to build in one go
  • Loading branch information
eatyourpeas authored Jun 29, 2024
2 parents 4ec4a8a + 3a3ef52 commit 65afec5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 6 additions & 0 deletions rcpch_nhs_organisations/hospitals/management/commands/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
seed_trusts,
seed_pdus,
ods_codes_to_abstraction_levels,
load_jersey_boundaries,
)

from .image import rcpch_ascii_art
Expand Down Expand Up @@ -46,6 +47,10 @@ def handle(self, *args, **options):
self.stdout.write(B + "Adding paediatric diabetes units..." + W)
seed_pdus()
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":
self.stdout.write(
B + "Adding all organisations and levels of abstraction..." + W
Expand All @@ -54,6 +59,7 @@ def handle(self, *args, **options):
seed_trusts()
seed_organisations()
seed_pdus()
load_jersey_boundaries()
rcpch_ascii_art()

else:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .abstraction_levels import *
from .jersey import *
from .organisations import *
from .pdus import *
from .trusts import *
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.db import migrations
from django.apps import apps as django_apps

import os
Expand All @@ -10,8 +9,8 @@
Jersey_Boundary_File = os.path.join(app_path, "shape_files", "Jersey", "CLC06_UK.shp")


def load_jersey_boundaries(apps, schema_editor, verbose=True):
JerseyBoundaries = apps.get_model("hospitals", "JerseyBoundaries")
def load_jersey_boundaries():
JerseyBoundaries = django_apps.get_model("hospitals", "JerseyBoundaries")
jerseyboundaries_mapping = {
"objectid": "OBJECTID",
"shape_id": "ID",
Expand All @@ -30,12 +29,3 @@ def load_jersey_boundaries(apps, schema_editor, verbose=True):
encoding="iso-8859-1",
)
lm.save(strict=True, verbose=True)


class Migration(migrations.Migration):

dependencies = [
("hospitals", "0004_jerseyboundaries"),
]

operations = [migrations.RunPython(load_jersey_boundaries)]

0 comments on commit 65afec5

Please sign in to comment.