POST api/ecg/
Queue analysis of ecg data
method POST
parameters type json
limit none
respond formats json
successful http return codes 202

Parameters

Request parameters are passed in json format
token
required
API token
Example: c0f1ad79-c159-4162-b9b2-d1094cc0cda2
freq
required
Frequency of ecg signal. Current version of BeatCare API supports one frequency per request.
Example: 500
age
optional
Patient age is a useful information for analysis, but is not required for algorithm.
Example: 73
leads
required
Actual ecg signal as dictionary "lead":[values array]. Only II lead is required. Number of values for each lead should be the same.
Example:
{
											  "I" :  [1.1, 2.2, 3.3,...], 
											  "II" :  [1.1, 2.2, 3.3,...]  // REQUIRED
											}

Request example

POST
http://beatcare.com/api/ecg

BODY
{
    "token": "c0f1ad79-c159-4162-b9b2-d1094cc0cda2", // REQUIRED
    "freq" : 500,                                    // REQUIRED
    "leads" : {                                      // REQUIRED
         "I" : [1.1, 2.2, 3.3],
        "II" : [1.1, 2.2, 3.3],                      // REQUIRED
       "III" : [1.1, 2.2, 3.3],
       "aVL" : [1.1, 2.2, 3.3],
       "aVR" : [1.1, 2.2, 3.3],
       "aVF" : [1.1, 2.2, 3.3],
        "V1" : [1.1, 2.2, 3.3],
        ...
        "V6" : [1.1, 2.2, 3.3]
    }
}

Result example

HTTP 202

BODY
{
    "id" : "c7a2ef264b044ca39245696d419dd6ee"
    "url": "http://beatcare.com/api/ecg/c7a2ef264b044ca39245696d419dd6ee"
}               
GET api/ecg/:id/:format
Returns either results of analysis given request id, either the 'in progress' status
method GET
limit none
respond formats json, html, pdf
successful http return codes 200, 202

Parameters

Request parameters are part of the url
id
required
Id of request, that was return by POST /api/ecg request.
Example: c7a2ef264b044ca39245696d419dd6ee
format
optional
Format of response:
  1. default - html
  2. pdf
  3. json
Example: pdf

Request example

GET

http://beatcare.com/api/ecg/c7a2ef264b044ca39245696d419dd6ee/
http://beatcare.com/api/ecg/c7a2ef264b044ca39245696d419dd6ee/json
http://beatcare.com/api/ecg/c7a2ef264b044ca39245696d419dd6ee/pdf
                            
							

Result example

Headers Body
HTTP 202

Analysis is not finished
None
HTTP 200

content-type: text/html
HTML result
HTTP 200

content-type: application/pdf
HTTP 200

content-type: application/json
"patient": {
    "id": "c7a2ef264b044ca39245696d419dd6ee",
    "age":73
},
"summary": {
    "date": "10.03.2015",
    "duration": "00:20:12.007",
    "status":{
        "severity": "warn",
        "string": "suspicious"
    },

    "checks":[
        {
            "name": "Heart rate",
            "explanation": "Too high",
            "value":{
                "severity": "warn",
                "string": "100 BPM"
            }
        },
        {
            "name": "Arrhythmia",
            "explanation": "Tachycardia",
            "value":{
                "severity": "warn",
                "string": "YES"
            }
        },
        {
            "name": "QRS segment length",
            "explanation": "Prolonged. Hyperkalemia or Bundle branch block",
            "value":{
                "severity": "critical",
                "string": "0.14 sec"
            }
        },
        {
            "name": "QT segment duration",
            "explanation": "Normal for 100 BPM",
            "value":{
                "severity": "ok",
                "string": "0.34 sec"
            }
        },
        {
            "name": "ST segment length",
            "explanation": "",
            "value":{
                "severity": "ok",
                "string": "0.09 sec"
            }
        },
        {
            "name": "PQ segment",
            "explanation": "Prolonged. Possible AV-block",
            "value":{
                "severity": "warn",
                "string": "0.25 sec"
            }
        },
        {
            "name": "AV block",
            "explanation": "Type II AV block",
            "value":{
                "severity": "critical",
                "string": "II"
            }
        },
        {
            "name": "ST & isoelectric line",
            "explanation": "ST elevation in normal range",
            "value":{
                "severity": "ok",
                "string": "1 mm"
            }
        }
    ]
},
"details":[
    {
        "explanation": "Prolonged QRS (0.14 sec, normal: < 0.2). Possible Hyperkalemia or Bundle branch block. Consider visiting a cardiologist.",
        "severity": "critical",
        "time": {
            "start":123.32
        }
    },
    {
        "explanation": "Arrhythmia detected.",
        "severity": "warn",
        "time": {
            "start":223,
            "end":254
        }
    },
    {
        "explanation": "BPM exceed normal for given age.",
        "severity": "warn",
        "time": {
            "start":444,
            "end":488.32
        },
        "hint": "Heart rate 100 BPM"
    },
    {
        "explanation": "Type II AV Block detected. Consider visiting a cardiologist.",
        "severity": "critical",
        "time": {
            "start":550.34
        }
    }
]                           

Overall unix-shell sample using curl

POST request with ECG data
curl --request POST \
     --data-binary '{"freq":500,"leads":{"II":[1.1,2.2,3.3]},"token":"..."}' \
     http://api.beatcare.com/api/ecg
                
Response
{"url": "http://api.beatcare.com/api/ecg/test", "id": "test"}
                
Get HTML report
curl http://api.beatcare.com/api/ecg/test
                
Get PDF report
curl http://api.beatcare.com/api/ecg/test/pdf
                
Get JSON report
curl http://api.beatcare.com/api/ecg/test/json