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

AEA-3816 Create Prescription Status Update API specification #1

Merged
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#########################################################################
# Dependabot configuration file
#########################################################################

version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "daily"

###################################
# NPM workspace ##################
###################################
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase

###################################
# Poetry #########################
###################################
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Summary

**Remove items from this list if they are not relevant. Remove this line once this has been done**

- Routine Change
- :exclamation: Breaking Change
- :robot: Operational or Infrastructure Change
- :sparkles: New Feature
- :warning: Potential issues that might be caused by this change

### Details

Add any summary information of what is in the change. **Remove this line if you have nothing to add.**
44 changes: 22 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,31 @@ repos:

- repo: local
hooks:
# - id: oas-build-checks
# name: Build OAS
# entry: make
# args: ["build-specification"]
# language: system
# files: ^(examples|packages\/specification)
# types_or: [json, yaml]

- id: lint-githubactions
name: Lint github actions
- id: oas-build-checks
name: Build OAS
entry: make
args: ["lint-githubactions"]
args: ["build-specification"]
language: system
files: ^.github
types_or: [yaml]
pass_filenames: false
files: ^(examples|packages\/specification)
types_or: [json, yaml]

- id: lint-githubaction-scripts
name: Lint github action scripts
entry: make
args: ["lint-githubaction-scripts"]
language: system
files: ^.github/scripts
types_or: [sh, shell]
pass_filenames: false
# - id: lint-githubactions
# name: Lint github actions
# entry: make
# args: ["lint-githubactions"]
# language: system
# files: ^.github
# types_or: [yaml]
# pass_filenames: false

# - id: lint-githubaction-scripts
# name: Lint github action scripts
# entry: make
# args: ["lint-githubaction-scripts"]
# language: system
# files: ^.github/scripts
# types_or: [sh, shell]
# pass_filenames: false

fail_fast: true
default_stages: [commit]
215 changes: 114 additions & 101 deletions packages/specification/eps-prescription-status-update-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,30 @@ servers:
description: "Production"

paths:
/Bundle:
get:

/:
put:
operationId: prescription-status-update-bundle
summary: Get prescription status
summary: Put prescription status
description: |
## Overview
Use this endpoint to get a prescription status, expressed as a FHIR Bundle.
Use this endpoint to put a prescription status, expressed as a FHIR Bundle.
parameters:
- $ref: "#/components/parameters/BearerAuthorisation"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
requestBody:
required: true
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/PutPrescriptionStatusBundle"
examples:
multiple-tasks:
summary: multiple-tasks
description: A transaction bundle, posted to root, containing multiple Tasks.
value:
$ref: examples/Bundle/request-multiple-tasks.json
responses:
"200":
description: Successful retrieval.
Expand All @@ -107,30 +120,72 @@ paths:
schema:
$ref: "#/components/schemas/bundle-response"
examples:
prescriptions-present:
description: A successful response to a GetMyPrescriptions/Bundle request, containing one prescription.
value:
$ref: "examples/GetMyPrescriptions/Bundle/success.json"
prescriptions-present-multiple:
description: A successful response to a GetMyPrescriptions/Bundle request, containing multiple prescriptions.
value:
$ref: "examples/GetMyPrescriptions/Bundle/success-multiple.json"
prescriptions-not-present:
description: A successful response to a GetMyPrescriptions/Bundle request, where no prescriptions were found.
value:
$ref: "examples/GetMyPrescriptions/Bundle/success-empty.json"
prescription-excluded:
description: A successful response to a GetMyPrescriptions/Bundle request, with a single prescription excluded.
multiple-tasks:
description: A successful response to a PutPrescriptionStatus/Bundle request, containing multiple tasks.
value:
$ref: "examples/GetMyPrescriptions/Bundle/success-single-exclusion.json"
prescriptions-excluded:
description: A successful response to a GetMyPrescriptions/Bundle request, with a multiple prescriptions excluded.
$ref: "examples/Bundle/response-multiple-tasks.json"

"4XX":
description: |
An error occurred as follows:

| HTTP status | Error code | Description |
| ----------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 400 | `exception` | Missing or invalid NHS number in request |
| 401 | `processing` | Missing or invalid OAuth 2.0 bearer token in request |
| 404 | `not-found` | No records found for the NHS number in the request |
| 408 | `timeout` | Request timed out |
| 429 | `throttled` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |

The error code will be included in the returned OperationOutcome (below).
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/operation-outcome"
examples:
example:
description: |
An error response to a request.
Resource not found for the given NHS number.
value:
$ref: "examples/GetMyPrescriptions/Bundle/success-multiple-exclusion.json"
distance-selling-pharmacy:
description: A successful response to a GetMyPrescriptions/Bundle request, where the performer organisation is a distance selling pharmacy.
$ref: examples/Bundle/error.json


/Task:
put:
operationId: prescription-status-update-bundle
summary: Put single prescription status
description: |
## Overview
Use this endpoint to put a prescription status, expressed as a FHIR Bundle.
parameters:
- $ref: "#/components/parameters/BearerAuthorisation"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
requestBody:
required: true
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/PutPrescriptionStatusTask"
examples:
single-task:
summary: single-tasks
description: A successful response to a PutPrescriptionStatus/Task request contains a single task resource with a status update.
value:
$ref: examples/Task/request-single-task.json
responses:
"200":
description: Successful retrieval.
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/task-response"
examples:
single-task:
description: A successful response to a PutPrescriptionStatus/Task request, containing a single task.
value:
$ref: "examples/GetMyPrescriptions/Bundle/success-distance-selling.json"
$ref: "examples/Task/response-single-task.json"

"4XX":
description: |
Expand All @@ -152,10 +207,10 @@ paths:
examples:
example:
description: |
An error response to a GetMyPrescriptions/Bundle request.
An error response to a request.
Resource not found for the given NHS number.
value:
$ref: examples/GetMyPrescriptions/Bundle/error.json
$ref: examples/Task/error.json

components:
parameters:
Expand Down Expand Up @@ -192,100 +247,58 @@ components:
type: string
example: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA
schemas:
operation-outcome:
$ref: schemas/resources/OperationOutcome.yaml
bundle-response:
PutPrescriptionStatusBundle:
type: object
required:
- entry
- resourceType
- type
description: A FHIR searchset Bundle.
description: A FHIR transaction Bundle.
properties:
resourceType:
type: string
description: FHIR resource type.
default: Bundle
id:
type: string
description: Object ID for the Bundle.
example: 164996aa-29eb-4f14-a5ac-4b556a7baf6e
type:
type: string
description: Denotes that the bundle is a list of resources returned as a result of a search.
enum: [searchset]
total:
type: number
description: |
The number of prescription bundles contained within the searchset

Note that this excludes OperationOutcomes.
default: transaction
entry:
type: array
description: |
A collection of resources contained within the Bundle.

Note that the presence of an OperationOutcome resource as part of the bundle implies that one
of a patient's prescriptions have been excluded from the response due to a processing error.
An OperationOutcome resource will be included for each prescription that cannot be processed.
items:
type: object
required:
- resourceType
- identifier
- type
- entry
- fullUrl
- resource
- request
description: A FHIR collection Bundle.
properties:
resourceType:
type: string
description: FHIR resource type.
default: Bundle
id:
fullUrl:
type: string
description: Object ID for the Bundle.
example: 164996aa-29eb-4f14-a5ac-4b556a7baf6e
type:
type: string
description: Denotes that the bundle is a collection of resources. Representing a Prescription, in this case.
enum: [collection]
entry:
type: array
description: A collection of resources contained within the Bundle.
items:
oneOf:
- $ref: "#/components/schemas/MedicationRequest-Resource"
- $ref: "#/components/schemas/OrganisationDispensing-Resource"
- $ref: "#/components/schemas/Practitioner-Resource"
- $ref: "#/components/schemas/PractitionerRole-Resource"
- $ref: "#/components/schemas/operation-outcome"
MedicationRequest-Resource:
type: object
description: MedicationRequest
properties:
resource:
$ref: schemas/resources/MedicationRequest.yaml
OrganisationDispensing-Resource:
type: object
description: Dispensing Organisation
properties:
resource:
$ref: schemas/resources/Organisation.yaml
OrganisationPrescribing-Resource:
type: object
description: Prescribing Organisation
properties:
resource:
$ref: schemas/resources/Organisation.yaml
Practitioner-Resource:
type: object
description: Practitioner
properties:
resource:
$ref: schemas/resources/Practitioner.yaml
PractitionerRole-Resource:
type: object
description: PractitionerRole
properties:
resource:
$ref: schemas/resources/PractitionerRole.yaml
example: http://example.org/fhir/Task/4d70678c-81e4-4ff4-8c67-17596fd0aa46
resource:
$ref: "#/components/schemas/PutPrescriptionStatusTask"
request:
type: object
required:
- method
- url
properties:
method:
type: string
default: POST
url:
type: string
default: Task
PutPrescriptionStatusTask:
$ref: schemas/resources/PutPrescriptionStatusTask.yaml
GetPrescriptionStatus:
$ref: schemas/resources/GetPrescriptionStatus.yaml
bundle-response:
$ref: "schemas/components/BundleResponse.yaml"
task-response:
$ref: "schemas/components/TaskResponse.yaml"
operation-outcome:
$ref: schemas/resources/OperationOutcome.yaml
Loading