@@ -328,7 +328,7 @@ paths:
328328 * `type` MUST match one of the Document Types agreed during [onboarding](#api-description__onboarding). e.g.
329329 ```
330330 "type": {
331- "coding\ ": [
331+ "coding": [
332332 {
333333 "system": "http://snomed.info/sct",
334334 "code": "1363501000000100",
@@ -340,7 +340,7 @@ paths:
340340 * `category` SHOULD indicate the broader class of the Document Type as agreed during [onboarding](#api-description__onboarding). e.g.
341341 ```
342342 "type": {
343- "coding\ ": [
343+ "coding": [
344344 {
345345 "system": "http://snomed.info/sct",
346346 "code": "1102421000000108",
@@ -354,7 +354,7 @@ paths:
354354 ```
355355 "format": [
356356 {
357- "system": "https://fhir.nhs.uk/STU3 /CodeSystem/NRL-FormatCode-1 ",
357+ "system": "https://fhir.nhs.uk/England /CodeSystem/England-NRLFormatCode ",
358358 "code": "urn:nhs-ic:unstructured"
359359 "display": "Unstructured document"
360360 }
@@ -628,6 +628,104 @@ paths:
628628 requests with the `next-page-token` found in the `meta` portion of the response.
629629
630630 This operation is also available as a http POST, which is the preferred method (see below).
631+ put :
632+ summary : Create document pointers with a specific id
633+ operationId : upsertDocumentReference
634+ parameters :
635+ - $ref : " #/components/parameters/odsCode"
636+ - $ref : " #/components/parameters/odsCodeExtension"
637+ - $ref : " #/components/parameters/requestId"
638+ - $ref : " #/components/parameters/correlationId"
639+ responses :
640+ " 201 " :
641+ $ref : " #/components/responses/Success"
642+ description : Create / Supersede successful response
643+ content :
644+ application/fhir+json;version=1 :
645+ example :
646+ resourceType : OperationOutcome
647+ id : 76db24dc-324a-468a-bf02-c06e82279488
648+ meta :
649+ profile :
650+ - https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome
651+ issue :
652+ - severity : information
653+ code : informational
654+ details :
655+ coding :
656+ - system : https://fhir.nhs.uk/CodeSystem/NRLF-SuccessCode
657+ code : RESOURCE_CREATED
658+ display : Resource created
659+ diagnostics : Resource created
660+ " 4XX " :
661+ description : |
662+ An error occurred as follows:
663+
664+ | HTTP status | Error code | Description |
665+ | ----------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
666+ | 400 | BAD_REQUEST | Bad Request |
667+ | 400 | VALIDATION_ERROR | A parameter or value has resulted in a validation error |
668+ | 400 | INVALID_RESOURCE_ID | Invalid resource ID |
669+ | 401 | ACCESS_DENIED | Access Denied |
670+ | 403 | ACCESS_DENIED | Forbidden |
671+ | 403 | ACCESS_DENIED_LEVEL | Access has been denied because you need higher level permissions |
672+ | 404 | RESOURCE_NOT_FOUND | Resource not found |
673+ | 409 | INVALID_VALUE | Invalid value |
674+
675+ The Error Code comes from https://fhir.nhs.uk/STU3/CodeSystem/Spine-ErrorOrWarningCode-1
676+ content :
677+ application/fhir+json;version=1 :
678+ schema :
679+ $ref : " #/components/schemas/OperationOutcome"
680+ example :
681+ resourceType : OperationOutcome
682+ issue :
683+ - severity : error
684+ code : value
685+ details :
686+ coding :
687+ - system : " https://fhir.nhs.uk/STU3/CodeSystem/Spine-ErrorOrWarningCode-1"
688+ version : " 1"
689+ code : VALIDATION_ERROR
690+ display : A parameter or value has resulted in a validation error
691+ diagnostics : " The requested document pointer cannot be read because it belongs to another organisation"
692+ requestBody :
693+ $ref : " #/components/requestBodies/DocumentReference"
694+ description : |
695+ Create a new pointer with a unique identifier that you specify. This is the "upsert" or "update as create" functionality in the FHIR R4 REST standard.
696+
697+ In addition to the criteria for DocumentReference validity detailed in the POST interaction, you must ensure:
698+
699+ * `id` is a composite of the ODS Code and an identifier that is locally unique to your system. NRL does not
700+ generate globally unique ids, instead relies on producers to provide a locally unique id prefixed with their
701+ ODS code, making it globally unique. e.g.
702+ ```
703+ XYZ-1234567890
704+ ```
705+
706+ To supersede existing pointers you must further specify:
707+
708+ * at least one existing pointer in the `relatesTo` with a `code` of `replaces`.
709+ ```
710+ [
711+ {
712+ "code": "replaces",
713+ "target": {
714+ "type": "DocumentReference",
715+ "identifier": {
716+ "value": "XYZ-1234567890"
717+ }
718+ }
719+ }
720+ ]
721+ ```
722+
723+ * the following fields MUST match the pointers being superseded:
724+ * `subject`
725+ * `type`
726+
727+ This will cause a new pointer to be created and superseded pointers to be deleted. Multiple documents can
728+ be superseded.
631729 /DocumentReference/_search :
632730 post :
633731 summary : Retrieve document pointers (POST)
@@ -1220,7 +1318,7 @@ components:
12201318 title : Mental health crisis plan report
12211319 creation : " 2022-12-21T10:45:41+11:00"
12221320 format :
1223- system : https://fhir.nhs.uk/STU3 /CodeSystem/NRL-FormatCode-1
1321+ system : https://fhir.nhs.uk/England /CodeSystem/England-NRLFormatCode
12241322 code : " urn:nhs-ic:unstructured"
12251323 display : Unstructured document
12261324 context :
0 commit comments