心血管风险评估
最后更新:2023年08月31日
接口能力
本接口可通过捕捉慢病人群的心电特征,结合基础生理数据和部分症状指标来综合评估其未来三年内冠心病、脑卒中(中风)、心梗的发病风险。
请求方法
HTTP方法: POST
请求URL:http://api.amsu-new.com/amsu-analysis/v2/health/cvdr/results/
数据提交方式:multipart/form-data
Header参数:
字段 | 类型 | 描述 |
---|---|---|
Authorization | Bearer Token | 构造方式为Bearer+(空格)+(Access Token) |
Body参数:
字段 | 类型 | 必传 | 范围 | 描述 |
---|---|---|---|---|
height | Integer | 是 | 90 - 240 | 身高,单位:cm |
weight | Float | 是 | 30.0 - 200.9 | 体重,单位:kg |
age | Integer | 是 | 20 - 90 | 年龄 |
gender | Integer | 是 | 0 - 1 | 性别,男1 女0 |
htn | Integer | 是 | 0 - 1 | 高血压确诊情况,确诊1 未确诊0 |
dm | Integer | 是 | 0 - 1 | 糖尿病确诊情况,确诊1 未确诊0 |
sbp | Integer | 是 | 75 - 240 | 收缩压 |
symptom | Array of Integer | 是 | 1, 2, 3, 4, 5, 6, 7 | 临床症状,列出所有已出现的症状编号(请见下方表格) |
disease | Array of String | 是 | J45, G43, G47, R05, R07, R53 | 确诊疾病,列出所有已确诊疾病的ICD-10编码(请见下方表格) |
ecg_file | File | 是 | *.ecg | 二进制心电文件,以.ecg 作后缀名,尺寸限制 100M 以内(约55小时离线数据)。数据将按照 小端序 2字节short 型被解析,可使用 心电图查看工具 观察您的文件是否能正确解析 |
model | String | 是 | online、offline | 心电记录模式,通过蓝牙采集的心电数据为online ,在AMSU设备中存储的心电数据为offline |
device | String | 是 | V6、S1 | 心电设备类型,对应蓝牙协议中「Device Information」-「Model Number」里包含的开发代号,心电衣(带)主机对应代号为V6 ,心电贴对应代号为S1 |
提示
若 model 为 online
,请在构造心电文件时用您自定义的信息(或任意值)填充前256个字节作为头部,若不构造头部,则文件中前1~2秒的心电数据不会参与分析。
症状编号:
编号 | 描述 | 编号 | 描述 | 编号 | 描述 |
---|---|---|---|---|---|
1 | 头晕头痛 | 4 | 心悸胸闷 | 7 | 水肿 |
2 | 恶心呕吐 | 5 | 呼吸道出血 | ||
3 | 呼吸异常 | 6 | 四肢麻木 |
ICD-10疾病编码:
编码 | 描述 | 编码 | 描述 | 编码 | 描述 |
---|---|---|---|---|---|
J45 | 哮喘 | G47 | 睡眠障碍 | R07 | 咽痛或胸痛 |
G43 | 偏头痛 | R05 | 咳嗽 | R53 | 不适和疲劳 |
返回参数
字段 | 类型 | 描述 |
---|---|---|
id | Integer | 本次分析的标识 |
chd | Float | 三年期冠心病患病风险(概率) |
cva | Float | 三年期脑卒中(中风)发病风险(概率) |
ami | Float | 三年期心梗发病风险(概率) |
正确返回示例:
HTTP状态码:200
{
"id": 459,
"chd": 0.119,
"cva": 0.103,
"ami": 0.213
}
HTTP状态码不为200
{
"error": {
"code": "ECG.INVALID_DATA",
"msg": "ECG data cannot be analyzed normally, which may be due to wrong format or poor signal quality."
}
}
错误码
HTTP状态码 | 错误码 | 说明 |
---|---|---|
422 | ECG.INVALID_DATA | 无法从心电数据中有效识别出R波,此错误的可能原因有:1. 心电文件格式出错;2.心电数据未正常采集;3.心电数据质量过差 |
另请参见 公共错误码
示例代码
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("height","188")
.addFormDataPart("weight","88.8")
.addFormDataPart("gender","0")
.addFormDataPart("age","18")
.addFormDataPart("htn","1")
.addFormDataPart("sbp","150")
.addFormDataPart("dm","0")
.addFormDataPart("symptom","1")
.addFormDataPart("symptom","4")
.addFormDataPart("disease","R05")
.addFormDataPart("disease","J45")
.addFormDataPart("ecg_file","example_online.ecg",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("/datas/example_online.ecg")))
.addFormDataPart("model","online")
.addFormDataPart("device","V6")
.build();
Request request = new Request.Builder()
.url("http://api.amsu-new.com/amsu-analysis/v2/health/cvdr/results/")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjU5NjAyMzgzfQ.wEq-XjvfteGxfebXvf8wLlX8JO1ONA1pgNXEbMde3NQ")
.build();
Response response = client.newCall(request).execute();
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://api.amsu-new.com/amsu-analysis/v2/health/cvdr/results/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjU5NjAyMzgzfQ.wEq-XjvfteGxfebXvf8wLlX8JO1ONA1pgNXEbMde3NQ"
};
[request setAllHTTPHeaderFields:headers];
NSArray *parameters = @[
@{ @"name": @"height", @"value": @"188" },
@{ @"name": @"weight", @"value": @"88.8" },
@{ @"name": @"gender", @"value": @"0" },
@{ @"name": @"age", @"value": @"18" },
@{ @"name": @"htn", @"value": @"1" },
@{ @"name": @"sbp", @"value": @"150" },
@{ @"name": @"dm", @"value": @"0" },
@{ @"name": @"symptom", @"value": @"1" },
@{ @"name": @"symptom", @"value": @"4" },
@{ @"name": @"disease", @"value": @"R05" },
@{ @"name": @"disease", @"value": @"J45" },
@{ @"name": @"ecg_file", @"fileName": @"/datas/example_online.ecg" },
@{ @"name": @"model", @"value": @"online" },
@{ @"name": @"device", @"value": @"V6" }
];
NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjU5NjAyMzgzfQ.wEq-XjvfteGxfebXvf8wLlX8JO1ONA1pgNXEbMde3NQ");
var formdata = new FormData();
formdata.append("height", "188");
formdata.append("weight", "88.8");
formdata.append("gender", "0");
formdata.append("age", "18");
formdata.append("htn", "1");
formdata.append("sbp", "150");
formdata.append("dm", "0");
formdata.append("symptom", "1");
formdata.append("symptom", "4");
formdata.append("disease", "R05");
formdata.append("disease", "J45");
formdata.append("ecg_file", fileInput.files[0], "example_online.ecg");
formdata.append("model", "online");
formdata.append("device", "V6");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("http://api.amsu-new.com/amsu-analysis/v2/health/cvdr/results/", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import requests
url = "http://api.amsu-new.com/amsu-analysis/v2/health/cvdr/results/"
payload={'height': '188',
'weight': '88.8',
'gender': '0',
'age': '18',
'htn': '1',
'sbp': '150',
'dm': '0',
'symptom': [1,4],
'disease': ['R05','J45'],
'model': 'online',
'device': 'V6'}
files=[
('ecg_file',('example_online.ecg',open('/datas/example_online.ecg','rb'),'application/octet-stream'))
]
headers = {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjU5NjAyMzgzfQ.wEq-XjvfteGxfebXvf8wLlX8JO1ONA1pgNXEbMde3NQ'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)