Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published

updateExisting method: createComposition

Implemented changes:

Request structure

Example

Expand
titleRequest example
Code Block
{
  "category": {
    "coding": [
      {
        "system": "COMPOSITION_CATEGORIES",
        "code": "SICKNESS"
      }
    ]
  },
  "type": {
    "coding": [
      {
        "system": "COMPOSITION_TYPES",
        "code": "TEMP_DISABILITY"
      }
    ]
  },
  "event": [
    {
      "code": {
        "coding": [
          {
            "system": "COMPOSITION_EVENTS",
            "code": "COMPOSITION_VALIDITY_PERIOD"
          }
        ]
      },
      "period": {
        "start": "2022-10-24T10:45:16Z",
        "end": "2022-10-28T10:45:16Z"
      }
    }
  ],
  "subject": {
    "type": {
      "coding": [
        {
          "system": "eHealth/resources",
          "code": "person"
        }
      ],
      "text": "string"
    },
    "value": "52b504c7-0177-4078-834b-52d89154081c"
  },
  "encounter": {
    "type": {
      "coding": [
        {
          "system": "eHealth/resources",
          "code": "encounter"
        }
      ],
      "text": "string"
    },
    "value": "e39ee5ae-2644-4f04-8e64-bb359866e907"
  },
  "author": {
    "type": {
      "coding": [
        {
          "system": "eHealth/resources",
          "code": "employee"
        }
      ],
      "text": "string"
    },
    "value": "43cc2161-1c2b-481b-a618-77e35817f850"
  },
  "section": {
    "focus": {
      "type": {
        "coding": [
          {
            "system": "eHealth/resources",
            "code": "person"
          }
        ],
        "text": "string"
      },
      "value": "52b504c7-0177-4078-834b-52d89154081c"
    }
  },
  "extension": [
    {
      "valueCode": "INFORM_WITH",
      "valueUuid": "e7ff2eef-712f-4676-960d-6aa16dce2103"
    },
    {
      "valueCode": "IS_ACCIDENT",
      "valueBoolean": true
    },
    {
      "valueCode": "TREATMENT_VIOLATION",
      "valueString": "reject_recommendation"
    },
    {
      "valueCode": "TREATMENT_VIOLATION_DATE",
      "valueDate": "2022-10-24"
    },
    {
      "valueCode": "IS_INTOXICATED",
      "valueBoolean": true
    },
    {
      "valueCode": "IS_FOREIGN_TREATMENT",
      "valueBoolean": true
    },
    {
      "valueCode": "IS_FORCE_RENEW",
      "valueBoolean": true
    }
  ]
}

Validation data request

  1. Focus Processing - Receiving and processing Focus record

    1. For Newborn Composition:

      1. If focus.type.coding.code isn’t person - return BAD_FOCUS_CODING(1009)

    2. Getting a record about the Composition's patient by id with RPC method get_preperson_by_id if focus.type.coding.code = preperson or get_person_by_id if focus.type.coding.code = person and Composition.type is Temporary Disability

      1. In case of error - return 1009 (BAD_FOCUS_CODING), 1010 (FOCUS_NOT_FOUND), 1111 (FOCUS_IS_NOT_ACTIVE)

    3. Getting a record about the Composition.focus’s authorization methods by id with RPC method get_auth_methods.

      1. If authorization method is expired such method isn't not used

      2. If specified authorization method wasn't found - return 1171 (FOCUS_AUTH_NOT_SPECIFIED)

    4. Checks for “section.focus” attribute:

      1. If focus.type.code does not match with value in EMAL_VALIDATION_FOCUS_CATEGORIES_BY_TYPE - return 1201 (INVALID_DISABILITY_FOCUS_CATEGORY)

      2. If focus.status does not match with value in EMAL_VALIDATION_FOCUS_ALLOWED_STATUSES_BY_CATEGORY - return 1202 (INVALID_DISABILITY_FOCUS_STATUS) or 1203 (INVALID_NEWBORN_FOCUS_STATUS )

      3. If focus.type=preperson and IS_FOREIGN_TREATMENT extension is TRUE - return 1214 (FOREIGN_TREATMENT_FOR_FOCUS_PREPERSON_NOT_ALLOWED)

      4. Additional checks for focus.type=person:

        1. Check for patient’s verification_status:

          1. If verification_status does not match with value in EMAL_VALIDATION_FOCUS_ALLOWED_VERIFICATION_STATUSES_BY_CATEGORY or it doesn't specified - return 1204 (INVALID_NEWBORN_FOCUS_VERIFICATION_STATUS) or 1205 (INVALID_DISABILITY_FOCUS_VERIFICATION_STATUS)

        2. Check for tax_id

          1. In case of error - return 1138 (PERSON_HAS_NO_TAX_ID)

        3. Check for focus document.type

          1. If it is not match with value in EMAL_ERLN_CREATE_RECORD_JOB_DOCUMENT_TYPE_CODES - return 10916 (IDENTIFICATION_FAILED_DOCUMENT_ABSENT)

          2. If focus.documen_type is not match with value in EMAL_VALIDATION_FOCUS_DOCUMENTS_BY_CATEGORY - return 1212 (INVALID_NEWBORN_FOCUS_DOCUMENTS) or 1213 (INVALID_DISABILITY_FOCUS_DOCUMENTS)

        4. Check for focus.gender

          1. If focus gender is not match with value in EMAL_VALIDATION_FOCUS_GENDERS_BY_CATEGORY or it's not specified - return 1208 (INVALID_NEWBORN_FOCUS_GENDER) or 1209 (INVALID_DISABILITY_FOCUS_GENDER)

        5. Check for focus age

          1. If age of the person is not match with value in EMAL_VALIDATION_FOCUS_ALLOWED_AGES_BY_CATEGORY - return 1206 (INVALID_NEWBORN_FOCUS_AGE) or 1207 (INVALID_DISABILITY_FOCUS_AGE)

        6. Check that if authentication method with type = ‘THIRD_PERSON’ is submitted in AUTHORIZE_WITH INFORM_WITH extension. If true - getting a record about the authorization methods by id with RPC method get_auth_methods:

          1. persons age < no_self_registration_age global parameter;

          2. persons age between no_self_registration_age and person_full_legal_capacity_age global parameters and person does not have document with type from PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter;

          3. persons age > person_full_legal_capacity_age global parameter and exists at least one active and approved confidant person relationship for person (using following process https://e-health-ua.atlassian.net/wiki/spaces/CSI/pages/17667883028 with person_id = person_id from request - expected :ok, :approved response)

            1. If AUTHORIZE_WITH with type = 'THIRD_PERSON' does not exist - return 1230 FOCUS_NOT_LEGALLY_CAPABLE_WITHOUT_AUTHORIZATION

          4. Check that authentication method exists in MPI database, person_authentication_methods table (with is_active = true), belongs to the same patient as set in the composition, is active (ended_at > now() or ended_at is null) and type != NA

            1. in case error - return 1171 'FOCUS_AUTH_NOT_SPECIFIED'

      5. For Rectification cases:

        1. If the records of identified and unidentified patients are not combined - return 1155 (CANT_AMEND_NO_MERGE_PAIR)

  2. getSmsPhoneNumber - Receiving phone number for sending SMS about creation of composition

    1. This procedure is performed if extension “AUTHORIZE_WITH INFORM_WITH” was specified in the request. In other cases, the procedure is not performed

      1. search for a person's authorization method by RPC call to the MPI service get_auth_method

        1. If phone number was found - this number is saving for future SMS sending

        2. If phone number wasn't found - return 1017 (PHONE_NOT_FOUND)