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

[ERSSUP-63215]-[]-[R4 Directory Structure]-[RG] #389

Open
wants to merge 1 commit into
base: develop
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
8 changes: 4 additions & 4 deletions sandbox/src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const createReferralAndSendForTriage = require('./createReferralAndSendForTriage
const patientServiceSearch = require('./patientServiceSearch')
const getCodeSystem = require('./getCodeSystem')
const retrieveAppointmentSlots = require('./retrieveAppointmentSlots')
const retrieveBusinessFunctions = require('./retrieveBusinessFunctions')
const retrieveOboUsers = require('./retrieveOboUsers')
const retrieveBusinessFunctions = require('./r4/retrieveBusinessFunctions')
const retrieveOboUsers = require('./r4/retrieveOboUsers')
const uploadFileToDocumentStore = require('./uploadFileToDocumentStore')
const generatePatientLetter = require('./generatePatientLetter')
const retrieveAttachment = require('./retrieveAttachment')
Expand All @@ -17,8 +17,8 @@ const updateAppointment = require('./updateAppointment')
const retrieveClinicalInformation = require('./retrieveClinicalInformation')
const retrieveWorklist = require('./retrieveWorklist')
const retrieveAdviceAndGuidanceWorklist = require('./retrieveAdviceAndGuidanceWorklist')
const retrieveHealthcareService = require('./retrieveHealthcareService')
const searchForHealthcareServices = require('./searchForHealthcareServices')
const retrieveHealthcareService = require('./r4/retrieveHealthcareService')
const searchForHealthcareServices = require('./r4/searchForHealthcareServices')
const retrieveAdviceAndGuidanceRequest = require('./retrieveAdviceAndGuidanceRequest')
const retrieveAdviceAndGuidanceConversation = require('./retrieveAdviceAndGuidanceConversation')
const sendAdviceAndGuidanceResponse = require('./sendAdviceAndGuidanceResponse')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const mockResponseProvider = require('../services/mockResponseProvider')
const mockResponseProvider = require('../../services/mockResponseProvider')

module.exports = [
/**
Expand All @@ -16,7 +16,7 @@ module.exports = [
}

// this should never happen as we always get a valid response for this endpoint
return h.file('SandboxErrorOutcome.json').code(400);
return h.file('../SandboxErrorOutcome.json').code(400);


}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const mockResponseProvider = require('../services/mockResponseProvider')
const businessFunctionValidator = require('../services/businessFunctionValidator')
const mockResponseProvider = require('../../services/mockResponseProvider')
const businessFunctionValidator = require('../../services/businessFunctionValidator')

function retrieveHealthcareService(request, h) {
const allowedBusinessFunctions = ["REFERRING_CLINICIAN", "REFERRING_CLINICIAN_ADMIN"]
Expand All @@ -21,7 +21,7 @@ function retrieveHealthcareService(request, h) {
}
}

return h.file('NotFoundOutcome.txt').code(404)
return h.file('../NotFoundOutcome.txt').code(404)
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const mockResponseProvider = require('../services/mockResponseProvider')
const mockResponseProvider = require('../../services/mockResponseProvider')

module.exports = [
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const mockResponseProvider = require('../services/mockResponseProvider')
const businessFunctionValidator = require('../services/businessFunctionValidator')
const mockResponseProvider = require('../../services/mockResponseProvider')
const businessFunctionValidator = require('../../services/businessFunctionValidator')

module.exports = [
{
Expand Down
14 changes: 7 additions & 7 deletions sandbox/src/services/mockResponseProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ module.exports = {

getExampleResponseForRetrieveBusinessFunctions: function () {

return { responsePath: 'retrieveBusinessFunctions/responses/PractitionerRoleBundle.json', responseCode: 200 }
return { responsePath: 'r4/retrieveBusinessFunctions/responses/PractitionerRoleBundle.json', responseCode: 200 }
},

getExampleResponseForRetrieveOboUsers: function () {
return { responsePath: 'retrieveOboUsers/responses/PractitionerBundle.json', responseCode: 200 }
return { responsePath: 'r4/retrieveOboUsers/responses/PractitionerBundle.json', responseCode: 200 }
},

getExampleResponseForGeneratePatientLetter: function () {
Expand Down Expand Up @@ -471,11 +471,11 @@ module.exports = {
const serviceId = request.params.serviceId

if (serviceId == 1 && (!version || version == 1)) {
return 'getService/responses/sampleServiceWithMinimumAttributes.json'
return 'r4/getService/responses/sampleServiceWithMinimumAttributes.json'
}

if (serviceId == 2 && (!version || version == 1)) {
return 'getService/responses/sampleServiceWithFullAttributes.json'
return 'r4/getService/responses/sampleServiceWithFullAttributes.json'
}

return null
Expand All @@ -485,15 +485,15 @@ module.exports = {
const ids = request.query['_id']

if (ids == ['1', '2']) {
return 'searchForServices/responses/searchServiceWithMinmumalAttributes.json'
return 'r4/searchForServices/responses/searchServiceWithMinmumalAttributes.json'
}

if (ids == ['3', '4']) {
return 'searchForServices/responses/searchServiceWithMaxAndMinlAttributes.json'
return 'r4/searchForServices/responses/searchServiceWithMaxAndMinlAttributes.json'
}

if (ids == ['5', '6']) {
return 'searchForServices/responses/searchServiceWithEmptyResponse.json'
return 'r4/searchForServices/responses/searchServiceWithEmptyResponse.json'
}

return null
Expand Down
1 change: 1 addition & 0 deletions scripts/copy_examples_from_sandbox.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
# this script copies files from mock sandbox to specification. This is done so that we only need to maintain set in one place.
cp -r ./sandbox/src/mocks/r4/. ./specification/components/r4/examples/
cp -r ./sandbox/src/mocks/. ./specification/components/examples/
8 changes: 7 additions & 1 deletion scripts/validate_oas_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ def validate_response_examples():

# Process response example file path
args = list(filter(lambda x: x != "..", example_res_path.split("/")))
abspath_example = os.path.join(REPO_ROOT, "specification/components", *args)

path = (
"specification/components/r4"
if endpoint_dict["path"].startswith("/R4/")
else "specification/components"
)
abspath_example = os.path.join(REPO_ROOT, path, *args)

with open(abspath_example, "r") as example_file:
example_response = load(example_file)
Expand Down
23 changes: 23 additions & 0 deletions specification/components/r4/examples/R4-OperationOutcome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
Copy link
Contributor

@francisco-videira-nhs francisco-videira-nhs Aug 3, 2022

Choose a reason for hiding this comment

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

Just for traceability, as stated in the STU3 PR, we don't commit these examples to git. During make publish they copied from the sandbox, so the directory specification/components/r4/examples/ should be added to .gitignore

"meta": {
"profile": [
"https://www.hl7.org/fhir/R4/operationoutcome.html"
]
},
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "invalid",
"diagnostics": "Example diagnostics message",
"details": {
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-APIErrorCode",
"code": "INVALID"
}
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"id": "2",
"meta": {
"versionId": "1",
"profile": [
"https://fhir.nhs.uk/StructureDefinition/eRS-HealthcareService"
]
},
"language": "en",
"resourceType": "HealthcareService",
"extension": [
{
"url": "https://fhir.nhs.uk/StructureDefinition/Extension-eRS-HoursOfOperation",
"valueString": "9-5 Mon-Fri"
},
{
"url": "https://fhir.nhs.uk/StructureDefinition/Extension-eRS-ServiceInstructions",
"valueString": "Instructions"
},
{
"url": "https://fhir.nhs.uk/StructureDefinition/Extension-eRS-HealthcareService-Contact",
"extension": [
{
"url": "purpose",
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/contactentity-type",
"code": "PATINF",
"display": "Patient"
}
]
}
},
{
"url": "telecom",
"valueContactPoint": {
"system": "phone",
"value": "01234567890"
}
}
]
},
{
"url": "https://fhir.nhs.uk/StructureDefinition/Extension-eRS-HealthcareService-Contact",
"extension": [
{
"url": "purpose",
"valueCodeableConcept": {
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-Purpose",
"code": "HEALTHCARE_PROFESSIONALS",
"display": "Healthcare Professionals"
}
]
}
},
{
"url": "telecom",
"valueContactPoint": {
"system": "email",
"value": "[email protected]"
}
}
]
}
],
"location": [
{
"identifier": {
"system": "https://fhir.nhs.uk/Id/ods-site-code",
"value": "R6901"
}
}
],
"name": "Direct SVC 1",
"type": {
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-AppointmentType",
"code": "DAY_CASE",
"display": "Day Case"
}
]
},
"characteristic": [
{
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-RequestFlowType",
"code": "BOOKABLE",
"display": "Appointment Request"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"id": "1",
"meta": {
"versionId": "1",
"profile": [
"https://fhir.nhs.uk/StructureDefinition/eRS-HealthcareService"
]
},
"language": "en",
"resourceType": "HealthcareService",
"location": [
{
"identifier": {
"system": "https://fhir.nhs.uk/Id/ods-site-code",
"value": "R6901"
}
}
],
"name": "Direct Service With Minimal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"id": "85ca4b21-c327-47c1-9594-69dfc500ea7c",
"meta": {
"lastUpdated": "2021-05-24T16:09:32.252Z",
"profile": [
"https://fhir.hl7.org.uk/StructureDefinition/UKCore-Bundle"
]
},
"resourceType": "Bundle",
"type": "searchset",
"total": 2,
"timestamp": "2021-05-24T16:09:32.252Z",
"link": [
{
"relation": "self",
"url": "_baseUrl_/R4/PractitionerRole"
}
],
"entry": [
{
"fullUrl": "_baseUrl_/R4/PractitionerRole/PractitionerRole-R69-000000000101",
"resource": {
"id": "PractitionerRole-R69-000000000101",
"meta": {
"lastUpdated": "2021-05-24T16:09:32.252Z",
"profile": [
"https://fhir.hl7.org.uk/StructureDefinition/UKCore-PractitionerRole"
]
},
"resourceType": "PractitionerRole",
"practitioner": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/sds-user-id",
"value": "000000000101"
}
},
"organization": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/ods-organization-code",
"value": "R69"
}
},
"code": [
{
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-BusinessFunction-1",
"code": "SERVICE_DEFINER"
}
]
},
{
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-BusinessFunction-1",
"code": "SERVICE_PROVIDER_CLINICIAN"
}
]
},
{
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-BusinessFunction-1",
"code": "SERVICE_PROVIDER_ADMIN"
}
]
}
]
},
"search": {
"mode": "match"
}
},
{
"fullUrl": "_baseUrl_/R4/PractitionerRole/PractitionerRole-R68-000000000101",
"resource": {
"id": "PractitionerRole-R68-000000000101",
"meta": {
"lastUpdated": "2021-05-24T16:09:32.252Z",
"profile": [
"https://fhir.hl7.org.uk/StructureDefinition/UKCore-PractitionerRole"
]
},
"resourceType": "PractitionerRole",
"practitioner": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/sds-user-id",
"value": "000000000101"
}
},
"organization": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/ods-organization-code",
"value": "R68"
}
},
"code": [
{
"coding": [
{
"system": "https://fhir.nhs.uk/CodeSystem/eRS-BusinessFunction-1",
"code": "REFERRING_CLINICIAN"
}
]
}
]
},
"search": {
"mode": "match"
}
}
]
}
Loading