Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourpeas committed May 30, 2024
2 parents db1dd96 + b4846bc commit 109334b
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 54 deletions.
48 changes: 6 additions & 42 deletions .github/workflows/main_rcpch-nhs-organisations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

jobs:
build:
build-and-deploy:
runs-on: ubuntu-latest

steps:
Expand All @@ -20,50 +20,14 @@ jobs:
- name: Set up Python version
uses: actions/setup-python@v1
with:
python-version: '3.11'
python-version: "3.11"

- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt

# Optional: Add step to run tests here (PyTest, Django test suites, etc.)

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v3
with:
name: python-app
path: |
release.zip
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: python-app

- name: Unzip artifact for deployment
run: unzip release.zip


- name: 'Deploy to Azure Web App'
- name: "Deploy to Azure Web App"
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: 'rcpch-nhs-organisations'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_A76B7421A08D44778EBB49AB30B51B3D }}
app-name: "rcpch-nhs-organisations"
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_A76B7421A08D44778EBB49AB30B51B3D }}
package: "."
Original file line number Diff line number Diff line change
Expand Up @@ -8402,4 +8402,40 @@
"Fax": "",
"LocalAuthority": "E06000043",
}, # 01/04/2021, QNX NHS SUSSEX INTEGRATED CARE BOARD, SOUTH EAST, SOUTH EAST THAMES EPILEPSY GROUP
]
{
"OrganisationID": "",
"OrganisationCode": "I3W1A",
"OrganisationType": "",
"SubType": "",
"Sector": "",
"OrganisationStatus": "",
"IsPimsManaged": "",
"OrganisationName": "MIDLAND METROPOLITAN UNIVERSITY HOSPITAL",
"Address1": "GROVE LANE",
"Address2": "",
"Address3": "",
"City": "SMETHWICK",
"County": "WEST MIDLANDS",
"Postcode": "B66 2QT",
"Latitude": "52.491258",
"Longitude": "-1.949846",
"ParentODSCode": "RXK",
"ParentName": "SANDWELL AND WEST BIRMINGHAM HOSPITALS NHS TRUST",
"Phone": "",
"Email": "",
"Website": "",
"Fax": "",
"LocalAuthority": "E08000028",
}, # 01/04/2023 QHL NHS BIRMINGHAM AND SOLIHULL INTEGRATED CARE BOARD, MIDLANDS, Birmingham Regional Paediatric Neurology Forum
]

"""
Steps to update organisation in the console once created in the admin
from django.contrib.gis.geos import Point
point = Point(x=longitude,y=latitude)
o = Organisation.objects.get(ods_code="####")
o.geocode_coordinates=point
o.save()
from epilepsy12.common_view_functions import _seed_all_aggregation_models
_seed_all_aggregation_models()
"""
7 changes: 2 additions & 5 deletions rcpch_nhs_organisations/hospitals/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,10 @@
# JSON Schema
path("schema/", SpectacularJSONAPIView.as_view(), name="schema"),
# Swagger UI
path(
"swagger-ui/",
SpectacularSwaggerView.as_view(),
name="swagger-ui",
),
path("swagger-ui/", SpectacularSwaggerView.as_view(), name="swagger-ui"),
]

urlpatterns = []


urlpatterns += drf_routes
9 changes: 9 additions & 0 deletions rcpch_nhs_organisations/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
"0.0.0.0",
]

if os.getenv("WEBSITE_SITE_NAME"):
ALLOWED_HOSTS = ["*"]
else:
ALLOWED_HOSTS = [
"127.0.0.1",
"localhost",
"0.0.0.0",
]

# Application definition

INSTALLED_APPS = [
Expand Down
3 changes: 2 additions & 1 deletion rcpch_nhs_organisations/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""
rcpch_nhs_organisations URL Configuration
"""

from django.urls import path, include

urlpatterns = [
path(
"rcpch-nhs-organisations/api/v1/",
"",
include("rcpch_nhs_organisations.hospitals.urls"),
),
]
5 changes: 4 additions & 1 deletion rcpch_nhs_organisations/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
"""

import os
import sys

sys.path.append(os.path.abspath(os.path.dirname(__file__)))

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rcpch_nhs_organisations.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rcpch_nhs_organisations.settings")

application = get_wsgi_application()
8 changes: 4 additions & 4 deletions requirements/common-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# standard imports
requests==2.31.0
requests==2.32.0
python-dateutil==2.9.0.post0

# third party imports
django==4.2
django==4.2.11
djangorestframework==3.14
djangorestframework-gis==1.0
drf-spectacular==0.27.1
Expand All @@ -13,7 +13,7 @@ psycopg2-binary==2.9.9
whitenoise==6.6.0

# live application server
gunicorn==21.2.0
gunicorn>=22.0.0


# DOCUMENTATION - MATERIAL FOR MKDOCS INSIDERS
Expand All @@ -33,7 +33,7 @@ mkdocs-with-pdf==0.9.3 # PDF export feature

# code linting and formatting
autopep8==2.0.4
black==24.2.0
black==24.3.0

# for colored logs
colorlog==6.8.2
Expand Down

0 comments on commit 109334b

Please sign in to comment.