Operation Definition: Create Index Record (MeRI)

Introduction

Creates an index record of a healthcare provider and patient.

See operation Unregister Index Record for documentation on how to unregister an index record of a healthcare provider and a patient. If an index record that has been unregistered is to be registered again, it has to be created as a new one using this operation.

This operation changes content.

Usage

Invocations

POST [base]/$create-index-record

Parameters (In)

Name Cardinality Type Documentation
patient 1..1 Identifier (system and value) Patient identifier
healthcareProvider 1..1 Identifier (system and value) Healthcare provider identifier
availabilityTime 1..1 instant When patient data was first made available by the healthcare provider. An instant must be specified at least to the second and include time zone offset, for example 2015-02-07T13:28:17.239+02:00

Valid patient identifier systems

  • Swedish personal identity number (sv: personnummer)
    • system: http://electronichealth.se/identifier/personnummer
    • value format: 12 digits with or without hyphen, eg 198001032385
  • Swedish coordination number (sv: samordningsnummer)
    • system: http://electronichealth.se/identifier/samordningsnummer
    • value format: 12 digits with or without hyphen, eg 201903682399

Valid healthcare provider identifier systems

  • Swedish personal identity number (sv: personnummer)
    • system: http://electronichealth.se/identifier/personnummer
    • value format: 12 digits with or without hyphen, eg 198001032385
  • Swedish organization identifier (sv: organisationsnummer)
    • system: urn:oid:2.5.4.97
    • value format: 10 digits with or without hyphen, eg 5560269986

Return Values (Out)

Name Cardinality Type Documentation
return 1..1 OperationOutcome OperationOutcome with result of operation

Validation messages

These validation messages are error, information or success messages that SHOULD be returned in the OperationOutcome response.

Message Severity Parameter Comment
2-44-1: Required parameter missing. Error Parameters with cardinality 1..N must be supplied
2-44-2: Invalid format of personal identity number. Submit the personal identity number using 12 digits with or without hyphen, e.g. 198001032385. Error patient.valueIdentifier.value, healthcareProvider.valueIdentifier.value
2-44-3: Invalid format of coordination number. Submit the coordination number using 12 digits with or without hyphen, e.g. 198000602394. Error patient.valueIdentifier.value
2-44-4: Invalid system. Valid systems are %s. Error patient.valueIdentifier.system, healthcareProvider.valueIdentifier.system The Identifier.system values of parameters patient and healthcareProvider must be be from list of valid systems (see section Parameters (In) above)
2-44-5: Invalid timestamp. Submit the timestamp in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz, e.g. 2015-02-07T13:28:17.239+02:00. Error availabilityTime.valueInstant Instant must be a correctly formatted instant, ie specified at least to the second and including time zone offset, for example 2015-02-07T13:28:17.239+02:00
2-44-7: Invalid format of organization identifier. Submit the organization identifier using 10 digits without hyphen, e.g. 5560269986. Error healthcareProvider.valueIdentifier.value
2-44-9: Invalid parameter. Valid parameters are patient, healthcareProvider, availabilityTime. Error
2-44-100: Required attribute missing in JWT token. Error Attribute client_id required.
4-44-300: Index record registered successfully. Success
4-44-303: Index record for supplied patient and healthcare provider already exists. Information

Examples

The following section includes examples of request bodies and corresponding response bodies when successfully or unsuccessfully invoking CreateIndexRecord.

Successful request and response

Request body

This example shows how to create an index record for a patient with a personal identity number at a healthcare provider with an organization identifier.

{
"resourceType": "Parameters",
"id": "CreateIndexRecord-PersonalIdentityNumber-RequestBody",
{
"name": "patient",
"system": "http://electronichealth.se/identifier/personnummer",
"value": "198001032385"
}
},
{
"name": "healthcareProvider",
"system": "urn:oid:2.5.4.97",
"value": "5560269986"
}
},
{
"name": "availabilityTime",
"valueInstant": "2025-02-01T18:31:20+01:00"
}
]
}
<Parameters xmlns="http://hl7.org/fhir">
<id value="CreateIndexRecord-PersonalIdentityNumber-RequestBody" />
<name value="patient" />
<system value="http://electronichealth.se/identifier/personnummer" />
<value value="198001032385" />
</valueIdentifier>
</parameter>
<name value="healthcareProvider" />
<system value="urn:oid:2.5.4.97" />
<value value="5560269986" />
</valueIdentifier>
</parameter>
<name value="availabilityTime" />
<valueInstant value="2025-02-01T18:31:20+01:00" />
</parameter>
</Parameters>

This example shows how to create an index record for a patient with a coordination number at a healthcare provider with an organization identifier.

{
"resourceType": "Parameters",
"id": "CreateIndexRecord-CoordinationNumber-RequestBody",
{
"name": "patient",
"system": "http://electronichealth.se/identifier/samordningsnummer",
"value": "201903682399"
}
},
{
"name": "healthcareProvider",
"system": "urn:oid:2.5.4.97",
"value": "5560269986"
}
},
{
"name": "availabilityTime",
"valueInstant": "2025-02-01T18:31:20+01:00"
}
]
}
<Parameters xmlns="http://hl7.org/fhir">
<id value="CreateIndexRecord-CoordinationNumber-RequestBody" />
<name value="patient" />
<system value="http://electronichealth.se/identifier/samordningsnummer" />
<value value="201903682399" />
</valueIdentifier>
</parameter>
<name value="healthcareProvider" />
<system value="urn:oid:2.5.4.97" />
<value value="5560269986" />
</valueIdentifier>
</parameter>
<name value="availabilityTime" />
<valueInstant value="2025-02-01T18:31:20+01:00" />
</parameter>
</Parameters>

Response body

Example of response body with an OperationOutcome of successful CreateIndexRecord operation.

{
"resourceType": "OperationOutcome",
"id": "f0b6e66c-794e-48a9-85f8-cb754e4d0091",
"issue": [
{
"severity": "success",
"code": "success",
"details": {
"coding": [
{
"system": "http://electronichealth.se/CodeSystem/error-codes",
"code": "4-44-300",
"display": "Index record registered successfully."
}
]
}
}
]
}
<OperationOutcome xmlns="http://hl7.org/fhir">
<id value="f0b6e66c-794e-48a9-85f8-cb754e4d0091" />
<severity value="success" />
<code value="success" />
<system value="http://electronichealth.se/CodeSystem/error-codes" />
<code value="4-44-300" />
<display value="Index record registered successfully." />
</coding>
</details>
</issue>
</OperationOutcome>

Response when index post already exists

Example of OperationOutcome response when an index post with the supplied healthcare provider and patient already exists. Since the desired state had already been achieved the severity will be "information" with a code of "duplicate" to inform that an additional index post has not been created.

{
"resourceType": "OperationOutcome",
"id": "54d7ac5d-380d-489a-b769-1ac5ed26eec7",
"issue": [
{
"severity": "information",
"code": "duplicate",
"details": {
"coding": [
{
"system": "http://electronichealth.se/CodeSystem/error-codes",
"code": "4-44-303",
"display": "Index record for supplied patient and healthcare provider already exists."
}
]
}
}
]
}
<OperationOutcome xmlns="http://hl7.org/fhir">
<id value="54d7ac5d-380d-489a-b769-1ac5ed26eec7" />
<severity value="information" />
<code value="duplicate" />
<system value="http://electronichealth.se/CodeSystem/error-codes" />
<code value="4-44-303" />
<display value="Index record for supplied patient and healthcare provider already exists." />
</coding>
</details>
</issue>
</OperationOutcome>

Invalid request format and corresponding response

Request body

Example of invalid request body for CreateIndexRecord operation because of wrongly formatted personal identity number of sole trader Organization - valueIdentifier.value of first parameter has 10 digit version of personal identity number instead of 12, and invalid value of identifier system of second parameter - http://electronichealth.se/personnummer instead of http://electronichealth.se/identifier/personnummer.

{
"resourceType": "Parameters",
"id": "CreateIndexRecord-InvalidFormat-RequestBody",
{
"name": "healthcareProvider",
"system": "http://electronichealth.se/identifier/personnummer",
"value": "8001032385"
}
},
{
"name": "patient",
"system": "http://electronichealth.se/personnummer",
"value": "198001042384"
}
},
{
"name": "availabilityTime",
"valueInstant": "2025-02-01T18:31:20+01:00"
}
]
}
<Parameters xmlns="http://hl7.org/fhir">
<id value="CreateIndexRecord-InvalidFormat-RequestBody" />
<name value="healthcareProvider" />
<system value="http://electronichealth.se/identifier/personnummer" />
<value value="8001032385" />
</valueIdentifier>
</parameter>
<name value="patient" />
<system value="http://electronichealth.se/personnummer" />
<value value="198001042384" />
</valueIdentifier>
</parameter>
<name value="availabilityTime" />
<valueInstant value="2025-02-01T18:31:20+01:00" />
</parameter>
</Parameters>

Response body

Example of response body with an OperationOutcome of failed CreateIndexRecord operation because of invalid format.

The first issue is about a wrongly formatted personal identity number. To specify which parameter the issue pertains to, the diagnostics element shows the path leading to the element in the request body that contains the wrongly formatted value - in this case the valueIdentifier.value element of the healthcareProvider parameter.

The second issue is about an invalid system ID. To specify which parameter the issue pertains to, the diagnostics element shows the path leading to the element in the request body that contains the invalid system value - in this case the valueIdentifier.system element of the patient parameter.

{
"resourceType": "OperationOutcome",
"id": "29d043b4-46ca-447a-9616-3abba3b47bb1",
"issue": [
{
"severity": "error",
"code": "value",
"details": {
"coding": [
{
"system": "http://electronichealth.se/CodeSystem/error-codes",
"code": "2-44-2",
"display": "Invalid format of personal identity number. Submit the personal identity number using 12 digits with or without hyphen, e.g. 198001032385."
}
]
},
"diagnostics": "healthcareProvider.valueIdentifier.value"
},
{
"severity": "error",
"code": "value",
"details": {
"coding": [
{
"system": "http://electronichealth.se/CodeSystem/error-codes",
"code": "2-44-4",
"display": "Invalid system. Valid systems are http://electronichealth.se/identifier/personnummer, http://electronichealth.se/identifier/\nsamordningsnummer."
}
]
},
"diagnostics": "patient.valueIdentifier.system"
}
]
}
<OperationOutcome xmlns="http://hl7.org/fhir">
<id value="29d043b4-46ca-447a-9616-3abba3b47bb1" />
<severity value="error" />
<code value="value" />
<system value="http://electronichealth.se/CodeSystem/error-codes" />
<code value="2-44-2" />
<display value="Invalid format of personal identity number. Submit the personal identity number using 12 digits with or without hyphen, e.g. 198001032385." />
</coding>
</details>
<diagnostics value="healthcareProvider.valueIdentifier.value" />
</issue>
<severity value="error" />
<code value="value" />
<system value="http://electronichealth.se/CodeSystem/error-codes" />
<code value="2-44-4" />
<display value="Invalid system. Valid systems are http://electronichealth.se/identifier/personnummer, http://electronichealth.se/identifier/\nsamordningsnummer." />
</coding>
</details>
<diagnostics value="patient.valueIdentifier.system" />
</issue>
</OperationOutcome>