New Zealand MWS IG
1.1.5 - Release

New Zealand MWS IG - Local Development build (v1.1.5) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

## Create Allergy Intolerance

### Create AllergyIntolerance for Patient

The Create AllergyIntolerance operation is initiated by a user who needs to create a new AllergyIntolerance for a patient.

#### Create AllergyIntolerance processing steps:

1. A FHIR Client sends a POST request to the MWS AllergyIntolerance endpoint with a payload containing the MwsAllergyIntolerance resource to be created, excluding ids
2. The request is validated - ALT: Validation failure. Operation Outcome resource returned
3. The AllergyIntolerance is created in the MWS database and an ID is assigned
4. A newly created MwsAllergyIntolerance, including its ID, is returned to the client

#### Create AllergyIntolerance Request Examples

##### Recorder CPN is known

This is an example of a create request in which the recorder's CPN is known: create AllergyIntolerance request - CPN known

The recorder is provided as a relative literal reference to an HPIPractitioner

     "practitioner": {
            "reference": "Practitioner/99ZZZS"
          }

##### Recorder CPN is not known

This is an example of a create request in which the recorder's CPN is not known: create AllergyIntolerance request - unknown CPN The recorder is given as a logical reference using the local identifier and namespace

     "practitioner": {
            "identifier": {
              "value": "my-local-practionerid-1234",
              "system": "http://my-local-practioner-namespace.co.nz"
            }
          }

#### Behaviour

- FHIR Create AllergyIntolerance request received by the system
- Requester identity checked to make sure they are valid and have correct permission set.
- AllergyIntolerance record is validated.
- The patient identity is validated.
- The request is checked to make sure the changes requested complies with the relevant AllergyIntolerance Business and Attribute Rules.
- If all the attributes / items in the AllergyIntolerance record are correct
- A new AllergyIntolerance record is created in MWS with the details populated in the request.

#### Create AllergyIntolerance Errors

Business Rule | HTTP error | EM error | Codesystem displayname | Additional description
--- | --- | --- | --- | ---
Clinical Status must be a valid code | 422 Processable content |  |  | None of the codings provided are in the value set Mws clinical status
Clinical Status is a required field | 400 Bad request | EM07201 | Missing a required field | Clinical Status is a required field on create
Verification Status must be a valid code | 422 Unprocessable content |  |  | None of the codings provided are in the value set Mws verification status
Clinical status not allowed if verification status is entered-in-error | 422 Unprocessable content |  |  | Clinical status not allowed if verification status is entered-in-error
Verification status entered-in-error is not allowed on create | 400 Bad request | EM07302 | Must not be supplied on this operation | Verification status of enter-in-error must not be supplied on a create operation
A verification status of refuted must have an inactive clinical status | 400 Bad request | EM07202 | Field is required when another field is present | A verification status of refuted must have an inactive clinical status
Category is a required field | 400 Bad request | EM07201 | Missing a required field | Category is a required field
Category must be a valid code | 422 Unprocessable content |  |  | None of the codings provided are in the value set allergy intolerance category
Code is a required field | 400 Bad request | EM07201 | Missing a required field | AllergyIntolerance code is a required field
Code must be a valid code | 422 Unprocessable content |  |  | None of the codings provided are in the value set mws substance combined
NHI must be in the NHI system | 400 Bad request | EM02002 | Cannot be found | NHI number supplied cannot be found
The patient demographics supplied must match the NHI details | 400 Bad request | EM02008 | Patient identity information does not match Patient NHI supplied | Patient details supplied do not match the NHI details
Onset date cannot be in the future | 400 Bad request | EM07212 | Cannot be a future date | Onset date cannot be in the future
Onset date must be greater than or equal to the patient's date of birth | 400 Bad request | EM07303 | Date must be greater than date of birth | Onset date must be greater than or equal to the patient's date of birth
RecordedDate must not be supplied on a create | 400 Bad request | EM07302 | Must not be supplied on this operation | Recorded date must not be supplied on a create. Todays date is used
Recorder location is a required field | 400 Bad request | EM07201 | Missing a required field | Recorder HPI facilityID is a required field
Recorder location must be a valid HPI facilityID | 400 Bad request | EM02002 | Cannot be found | HPI Facility ID not found in the HPI
Recorder organization must be a valid HPI OrganisationID | 400 Bad request | EM02002 | Cannot be found | HPI Organisation ID not found in the HPI
The recorder practitioner must be either an HPI CPN or a local identifier | 400 Bad request | EM07201 | Missing a required field | Recorder Practitioner is a required field
A recorder practitioner HPI CPN must be in the HPI | 400 Bad request | EM02002 | Cannot be found | HPI CPN not found in the HPI
A recorder practitioner’s local identifier must have a system and an ID. | 400 Bad request | EM07201 | Missing a required field | A recorder's local identifier must have a system and ID
Note must contain only allowed characters | 422 Unprocessable content |  |  | Rule NOTE-ALLOWED-CHARS character restrictions for notes
Note must not exceed 1024 characters | 422 Unprocessable content |  |  | Rule NOTE-LENGTH Notes must be less than 1024 characters
Manifestation must be a valid code | 422 Unprocessable content |  |  | None of the codings provided are in the value set mws manifestations
A maximum of 50 manifestations is allowed | 422 Unprocessable content |  |  | Reaction.manifestation: max allowed = 50, but found <count>
The set of manifestations must not include any duplicate manifestation codes | 400 Bad request | EM7307 | Contains duplicates | The set of reaction manifestations contains duplicate manifestation codes