<CodeSystem xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <url value="https://fhir.nhs.uk/STU3/CodeSystem/eRS-APIErrorCode-1" />
  <version value="1.3.0" />
  <name value="eRS API Error Code" />
  <status value="active" />
  <publisher value="NHS Digital" />
  <contact>
    <name value="Interoperability Team" />
    <telecom>
      <system value="email" />
      <value value="interoperabilityteam@nhs.net" />
      <use value="work" />
    </telecom>
  </contact>
  <purpose value="Code system used to indicate the type of attachment" />
  <copyright value="2019 NHS Digital" />
  <content value="complete" />
  <concept>
    <code value="INVALID_VALUE" />
    <display value="Invalid value" />
  </concept>
  <concept>
    <code value="INVALID_CODE" />
    <display value="Invalid code" />
  </concept>
  <concept>
    <code value="MISSING_VALUE" />
    <display value="A mandatory input field is missing" />
  </concept>
  <concept>
    <code value="CONFLICTING_VALUES" />
    <display value="Conflicting values" />
  </concept>
  <concept>
    <code value="UNEXPECTED_FIELD" />
    <display value="Unexpected field" />
  </concept>
  <concept>
    <code value="INVALID_REQUEST_TYPE" />
    <display value="Invalid Request Type" />
  </concept>
  <concept>
    <code value="INVALID_REQUEST_STATE" />
    <display value="Invalid Request State" />
  </concept>
  <concept>
    <code value="PATIENT_SENSITIVE" />
    <display value="Patient Sensitive" />
  </concept>
  <concept>
    <code value="NO_RELATIONSHIP" />
    <display value="No Relationship" />
  </concept>
  <concept>
    <code value="FHIR_CONSTRAINT_VIOLATION" />
    <display value="FHIR constraint violated" />
  </concept>
  <concept>
    <code value="DUPLICATE_FILENAME" />
    <display value="The Filename of one of the files that correspond to the IDs supplied exactly matches (including extension) that of an existing file already associated with the referral." />
  </concept>
  <concept>
    <code value="FIELD_NOT_PERMITTED" />
    <display value="This field, although expected by the operation, is not applicable in some cases due to business rules." />
  </concept>
  <concept>
    <code value="FILE_SIZE_ERROR" />
    <display value="The file is either empty or too large." />
  </concept>
  <concept>
    <code value="INAPPROPRIATE_VALUE" />
    <display value="A value, which is acceptable under different conditions, is inappropriate in the context of the other information provided with the request." />
  </concept>
  <concept>
    <code value="INVALID_FHIR_STRUCTURE" />
    <display value="e-RS is unable to interpret the provided json as FHIR." />
  </concept>
  <concept>
    <code value="INVALID_STATE" />
    <display value="A referenced entity in an invalid state for the operation to proceed." />
  </concept>
  <concept>
    <code value="NO_ACCESS" />
    <display value="The current user does not have permission to access one of the entities referenced." />
  </concept>
  <concept>
    <code value="NO_ACCESS_CODE" />
    <display value="The patient record is missing the access code that is necessary to log onto Manage My Referrals" />
  </concept>
  <concept>
    <code value="ORGANISATION_IS_CLOSED" />
    <display value="The selected organisation is marked as closed" />
  </concept>
  <concept>
    <code value="ORGANISATION_NOT_APPROPRIATE" />
    <display value="The selected organisation is of a type that is not suitable for the operation." />
  </concept>
  <concept>
    <code value="PATIENT_ERROR" />
    <display value="An error occurred while fetching the patient's record from PDS." />
  </concept>
  <concept>
    <code value="REFERENCE_NOT_FOUND" />
    <display value="An entity referenced in the body of the request is not found when looked up." />
  </concept>
  <concept>
    <code value="REFERENCED_USER_IS_NOT_ACTIVE" />
    <display value="A user is not marked as active in SDS." />
  </concept>
  <concept>
    <code value="REFERENCED_USER_IS_NOT_RC" />
    <display value="The referenced user doesn't have the Referring Clinician Role." />
  </concept>
  <concept>
    <code value="REFERENCED_USER_IS_NOT_SPC" />
    <display value="The referenced user doesn't have the Service Provider Clinician Role." />
  </concept>
  <concept>
    <code value="REFERENCED_USER_NOT_IN_ORG" />
    <display value="The referenced user is not in the required organisation." />
  </concept>
  <concept>
    <code value="SHORTLISTED_SERVICE_NOT_IN_RESULTS" />
    <display value="A service proposed for shortlisting is not compatible with the search criteria." />
  </concept>
  <concept>
    <code value="SNOMED_NOT_FOUND" />
    <display value="A SNOMED code, while potentially valid in the latest version of the international dictionary, is not found in the e-RS copy of the dictionary." />
  </concept>
  <concept>
    <code value="TOO_MANY_ITEMS" />
    <display value="Too many items have been provided in an array or list." />
  </concept>
  <concept>
    <code value="VALUE_IS_REQUIRED" />
    <display value="This fields, although defined as optional, is required in specific cases due to business rules." />
  </concept>
  <concept>
    <code value="PENDING" />
    <display value="The file is currently being scanned and cannot be retrieved." />
  </concept>
  <concept>
    <code value="THREATS_FOUND" />
    <display value="The file has been quarantined as a threats has been detected, the file cannot be retrieved." />
  </concept>
  <concept>
    <code value="VALIDATION_FAILED" />
    <display value="The file has failed validation." />
    <definition value="Reasons for this include: the file type provided is not supported or does not correlate with the file extension; the file is too large" />
  </concept>
  <concept>
    <code value="FORBIDDEN" />
    <display value="An issue occurred whilst attempting to authorise a request" />
  </concept>
  <concept>
    <code value="SYSTEM_UNAVAILABLE" />
    <display value="There has been a processing failure in the request chain. This could be transient failure for a single request, a temporary service issue, maintenance window or due to an issue with a downstream service. Re-send the request after a period of time (using the value specified in the 'Retry-After' header if provided)" />
  </concept>
</CodeSystem>