HW agent API 2.28.0

API section

Medical equipment

The Medical equipment module: HL7 v2 (MLLP) and ASTM E1381/E1394 analyzers. Results kept for 30 days, long polling and acknowledgement (event lab.result), analyzer orders (worklist) and their status, an analyzer emulator. Needs the lab module in the key (except the emulator).

Acknowledge results#

POST/api/v1/lab/results/ack

Your software saved the results; they no longer appear in undelivered

Request body application/json required

Fields · Ack
  • idsarray of string uuid
JSON
{
  "ids": [
    "3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11"
  ]
}

Response 200 application/json

Fields · Acked
  • acknowledgedinteger int32

Errors — problem+json with a code field, see error codes.

Request example

curl
curl -X POST 'http://localhost:7790/api/v1/lab/results/ack' \
  -H 'Content-Type: application/json' \
  --data '{"ids":["3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11"]}'
curl
curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/lab/results/ack' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42' \
  -H 'Content-Type: application/json' \
  --data '{"ids":["3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11"]}'

Orders#

GET/api/v1/lab/orders

Newest first; status is QUEUED, SENT or DONE

Parameters

NameInTypeDescription
analyzerqueryinteger int32
statusquerystring
limitqueryinteger int32

Response 200 application/json

Fields · OrderList
  • ordersarray of Order
    8 fields · Order
    • analyzerinteger int32
    • sampleIdstring
    • patientPatient
      4 fields · Patient
      • idstring
      • namestring
      • birthDatestring
      • sexstring
    • testsarray of string
    • prioritystring
    • statusstring
    • createdAtstring date-time
    • sentAtstring date-time

Errors — problem+json with a code field, see error codes.

Request example

curl
curl 'http://localhost:7790/api/v1/lab/orders'
curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/lab/orders' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Analyzer order#

POST/api/v1/lab/orders

Worklist: какие тесты сделать по образцу. HL7 — агент сразу передаёт ORM^O01; ASTM — передаёт заданием или отвечает им на запрос анализатора по штрихкоду. status: SENT, QUEUED (ждёт связи или запроса), DONE (пришёл результат)

Request body application/json required

Fields · OrderRequest
  • analyzerinteger int32
  • sampleIdstring
  • patientPatient
    4 fields · Patient
    • idstring
    • namestring
    • birthDatestring
    • sexstring
  • testsarray of string
  • prioritystring
JSON
{
  "analyzer": 1,
  "sampleId": "string",
  "patient": {
    "id": "string",
    "name": "string",
    "birthDate": "string",
    "sex": "string"
  },
  "tests": [
    "string"
  ],
  "priority": "string"
}

Response 200 application/json

Fields · Order
  • analyzerinteger int32
  • sampleIdstring
  • patientPatient
    4 fields · Patient
    • idstring
    • namestring
    • birthDatestring
    • sexstring
  • testsarray of string
  • prioritystring
  • statusstring
  • createdAtstring date-time
  • sentAtstring date-time

Errors — problem+json with a code field, see error codes.

Request example

curl
curl -X POST 'http://localhost:7790/api/v1/lab/orders' \
  -H 'Content-Type: application/json' \
  --data '{"analyzer":1,"sampleId":"string","patient":{"id":"string","name":"string","birthDate":"string","sex":"string"},"tests":["string"],"priority":"string"}'
curl
curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/lab/orders' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42' \
  -H 'Content-Type: application/json' \
  --data '{"analyzer":1,"sampleId":"string","patient":{"id":"string","name":"string","birthDate":"string","sex":"string"},"tests":["string"],"priority":"string"}'

Resend waiting orders#

POST/api/v1/lab/analyzers/{number}/resend

All analyzer orders with status QUEUED

Parameters

NameInTypeDescription
numberrequiredpathinteger int32

Response 200 application/json

Fields · Resent
  • queuedinteger int32

Errors — problem+json with a code field, see error codes.

Request example

curl
curl -X POST 'http://localhost:7790/api/v1/lab/analyzers/1/resend'
curl
curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/lab/analyzers/1/resend' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Result from the emulator#

POST/api/v1/lab/analyzers/{number}/emulate

Только эмулятор анализатора: результат по образцу без задания, приходит событием lab.result как от настоящего

Parameters

NameInTypeDescription
numberrequiredpathinteger int32

Request body application/json

Fields · Emulate
  • sampleIdstring
  • patientPatient
    4 fields · Patient
    • idstring
    • namestring
    • birthDatestring
    • sexstring
  • testsarray of string
JSON
{
  "sampleId": "string",
  "patient": {
    "id": "string",
    "name": "string",
    "birthDate": "string",
    "sex": "string"
  },
  "tests": [
    "string"
  ]
}

Response 200 application/json

Fields · Result
  • validboolean
  • errorsarray of Issue
    8 fields · Issue
    • codestring
    • severitystring
      values: ERROR WARNING
    • atstring date-time
    • registerinteger int32
    • terminalinteger int32
    • fdinteger int64
    • amountinteger int64
    • messagestring
  • warningsarray of Issue
    8 fields · Issue
    • codestring
    • severitystring
      values: ERROR WARNING
    • atstring date-time
    • registerinteger int32
    • terminalinteger int32
    • fdinteger int64
    • amountinteger int64
    • messagestring

Errors — problem+json with a code field, see error codes.

Request example

curl
curl -X POST 'http://localhost:7790/api/v1/lab/analyzers/1/emulate' \
  -H 'Content-Type: application/json' \
  --data '{"sampleId":"string","patient":{"id":"string","name":"string","birthDate":"string","sex":"string"},"tests":["string"]}'
curl
curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/lab/analyzers/1/emulate' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42' \
  -H 'Content-Type: application/json' \
  --data '{"sampleId":"string","patient":{"id":"string","name":"string","birthDate":"string","sex":"string"},"tests":["string"]}'

Results#

GET/api/v1/lab/results

Старые первыми. undelivered=true — ещё не подтверждённые МИС (забрать и подтвердить POST /api/v1/lab/results/ack); since — полученные позже (ISO 8601); wait — ждать новый результат до стольких секунд (длинный опрос, до 60); raw=true — с исходным сообщением анализатора

Parameters

NameInTypeDescription
analyzerqueryinteger int32
sampleIdquerystring
sincequerystring date-time
undeliveredqueryboolean
rawqueryboolean
limitqueryinteger int32
waitqueryinteger int32

Response 200 application/json

Fields · ResultList
  • resultsarray of Result
    3 fields · Result
    • validboolean
    • errorsarray of Issue
      8 fields · Issue
      • codestring
      • severitystring
        values: ERROR WARNING
      • atstring date-time
      • registerinteger int32
      • terminalinteger int32
      • fdinteger int64
      • amountinteger int64
      • messagestring
    • warningsarray of Issue
      8 fields · Issue
      • codestring
      • severitystring
        values: ERROR WARNING
      • atstring date-time
      • registerinteger int32
      • terminalinteger int32
      • fdinteger int64
      • amountinteger int64
      • messagestring

Errors — problem+json with a code field, see error codes.

Request example

curl
curl 'http://localhost:7790/api/v1/lab/results'
curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/lab/results' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Result#

GET/api/v1/lab/results/{id}

With the analyzer's original message

Parameters

NameInTypeDescription
idrequiredpathstring uuid

Response 200 application/json

Fields · Result
  • validboolean
  • errorsarray of Issue
    8 fields · Issue
    • codestring
    • severitystring
      values: ERROR WARNING
    • atstring date-time
    • registerinteger int32
    • terminalinteger int32
    • fdinteger int64
    • amountinteger int64
    • messagestring
  • warningsarray of Issue
    8 fields · Issue
    • codestring
    • severitystring
      values: ERROR WARNING
    • atstring date-time
    • registerinteger int32
    • terminalinteger int32
    • fdinteger int64
    • amountinteger int64
    • messagestring

Errors — problem+json with a code field, see error codes.

Request example

curl
curl 'http://localhost:7790/api/v1/lab/results/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11'
curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/lab/results/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Analyzers#

GET/api/v1/lab/analyzers

Protocol, connection, messages received and orders waiting to be sent

Response 200 application/json

Fields · AnalyzerList
  • licensedboolean
  • analyzersarray of AnalyzerInfo
    7 fields · AnalyzerInfo
    • numberinteger int32
    • namestring
    • typestring
    • protocolstring
    • activeboolean
    • connectedboolean
    • infomap → any value

Errors — problem+json with a code field, see error codes.

Request example

curl
curl 'http://localhost:7790/api/v1/lab/analyzers'
curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/lab/analyzers' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Delete an order#

DELETE/api/v1/lab/orders/{analyzer}/{sampleId}

Cancel a test: the analyzer will no longer get it in reply to a query

Parameters

NameInTypeDescription
analyzerrequiredpathinteger int32
sampleIdrequiredpathstring

Response 200

No body.

Errors — problem+json with a code field, see error codes.

Request example

curl
curl -X DELETE 'http://localhost:7790/api/v1/lab/orders/1/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11'
curl
curl -X DELETE 'https://cloud.hw-connector.ru/agent/api/v1/lab/orders/1/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'