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

refactor all instances of RCPCH NHS Organisations API URL #120

Open
wants to merge 1 commit into
base: live
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions envs/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RCPCH_CENSUS_PLATFORM_UR=##########
NHS_ODS_API_URL=##########
NHS_ODS_API_URL_SUBSCRIPTION_KEY=##########

RCPCH_NHS_ORGANISATIONS_API_URL="https://api.rcpch.ac.uk/nhs-organisations/v1"

NHS_SPINE_SERVICES_URL="https://uat.directory.spineservices.nhs.uk/ORD/2-0-0"

POSTCODE_API_BASE_URL="https://findthatpostcode.uk/"
Expand Down
2 changes: 1 addition & 1 deletion project/npda/general_functions/rcpch_nhs_organisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_all_nhs_organisations():
These are typically used in Django forms as choices.
"""

url = f"https://rcpch-nhs-organisations.azurewebsites.net/organisations/limited"
url = f"{settings.RCPCH_NHS_ORGANISATIONS_API_URL}/organisations/limited"

try:
response = requests.get(
Expand Down
4 changes: 2 additions & 2 deletions project/npda/general_functions/retrieve_pdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def retrieve_pdu_list():
"""

url = settings.RCPCH_NHS_ORGANISATIONS_API_URL
request_url = f"{url}/paediatric_diabetes_units/extended"
request_url = f"{url}/paediatric_diabetes_units/extended/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have entered this url (with the preceding url from example.env) into my browser and receiving a 500 error. Is the API definitely live? Or have I missed something? Should the API not respond with a JSON of the PDUs?


try:
response = requests.get(
Expand Down Expand Up @@ -80,7 +80,7 @@ def retrieve_pdu_from_organisation_ods_code(ods_code):
ods_code = ods_code.upper()

url = settings.RCPCH_NHS_ORGANISATIONS_API_URL
request_url = f"{url}/paediatric_diabetes_units/sibling-organisations/{ods_code}"
request_url = f"{url}/paediatric_diabetes_units/sibling-organisations/{ods_code}/"

try:
response = requests.get(
Expand Down
3 changes: 1 addition & 2 deletions project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@
# This is the token required for getting deprivation quintiles from the RCPCH Census Platform
RCPCH_CENSUS_PLATFORM_URL = os.getenv("RCPCH_CENSUS_PLATFORM_URL")
RCPCH_CENSUS_PLATFORM_TOKEN = os.getenv("RCPCH_CENSUS_PLATFORM_TOKEN")
# TODO #83 - Fix the broken env in Azure and remove hardcoded URL

RCPCH_NHS_ORGANISATIONS_API_URL = os.getenv("RCPCH_NHS_ORGANISATIONS_API_URL")
RCPCH_NHS_ORGANISATIONS_API_URL = "https://rcpch-nhs-organisations.azurewebsites.net"

# This is the NHS Spine services - it does not require authentication
# It is possible to retrieve the ods code from the NHS API above, but not to narrow down
Expand Down
Loading