# AliYun and Tencent cloud NLP
## Tencent Cloud
#### 1. Use Wechat/Email/WeCom(企业微信) with phone number to **[register](https://cloud.tencent.com/register?s_url=https%3A%2F%2Fcloud.tencent.com%2Fproduct%2Fnlp)**. 
#### 2. Tencent Cloud requires **[real-name authentication](https://console.cloud.tencent.com/developer/auth)** to get started. Once authentication is finished, we can get 50k free query per day for the account. (Also, the real-name authentication is available with a company profile, which is recommended for businese usage). 
#### 3. After authentication, we can now **[create a secret key pair](https://console.cloud.tencent.com/cam/capi)** to start using their APIs.

#### 4. With the key pair, now we can go to their **[API Explorer[NLP section]](https://console.cloud.tencent.com/api/explorer?Product=nlp&Version=2019-04-08&Action=WordSimilarity)** to get their quick starter codes as well as the quick online trial demos. Here are all their available NLP services: 
- Here is the LexicalAnalysis starter code example: 
- Here is the LexicalAnalysis online demo, we can input text inside and get result directly online.

---
## AliYun
#### 1. [Register a Chinese mainland acccount](https://account.aliyun.com/register/qr_register.htm) requires a Chinese mainland phone number. 
~~However, [register an international account](https://account.alibabacloud.com/register/intl_register.htm) is possible with email and a US phone number. And they offer two account options: Businese account and Individual account~~ (May not needed anymore): 
#### 2. After registration, [Real-name authentication](https://account.console.aliyun.com/v2/#/authc/types) is required to use the account, do it via Alipay is recommended (instantly), but via a businese bank account is also available (2~3 businese day). 

#### 3. We can find documentations for several useful Medical tools on the Chinese product page [here](https://help.aliyun.com/document_detail/179395.html), however, these medical services are only available with a Chinese mainland account. 
#### 4. We can get **500 free queries** in total on each of the following medical services. 
#### 5. Found three fixed working examples for the "医学实体识别" API. They are only available when a Chinese mainland user logged in. (These are actual API calls, but the textarea on the left could not be changed).



#### 6. If use their OpenAPI Explorer(online demos) to open the "医学实体识别" API, the page is blank for some reason. Working on my own demo to test it out. 
---
### Coding Portion
#### 1. Starter code available [here(Python)](https://help.aliyun.com/document_detail/177236.htm?spm=a2c4g.11186623.0.0.6b2b6d95WdiFQX#topic-2139758). Using the aliyun-python-sdk-alinlp sdk can waive the digital signature process.
#### 2. Tutorial to create an Access Key pair [here](https://help.aliyun.com/document_detail/116401.htm?spm=a2c4g.11186623.0.0.434a5d7abs0rsB#task-2245479).
#### 3. The "医学实体识别" API's detail input/output/error_msg are available [here](https://help.aliyun.com/document_detail/179395.html).
#### 4. API call on "医学实体识别" API succeeded. Note that the text input **must < 256 char**, otherwise, no output will be generated.
---
## "医学实体识别" API Input/Output Examples
> - Due to API text length limitation(< 256 char), the sample text is **separated into multiple parts**.
> (Ex. "Example 1-1" and "Example 1-2" are both belongs to "Example 1" text.)
> - All texts are reformatted by the following rules:
> -- Remove all \n (the newline character)
> -- Remove all spaces(spaces are not common in Chinese text)
### **Example 1-1**
#### ==Input Text==
```text!
姓名:仲崇波
住院病案号:
1811
2011-09-05 14:50
首次病程记录
惠者 仲崇波 男 59岁
因“肛门旁条索状硬结2周余”为主诉
收入院
病历特点:
1、中老年男性,生活自理,否认肝炎,结核等病史。
2、现病史:该患于2周前无明显诱因出现肛门旁一肺块,伴轻度
疼痛,无分泌物溢出,肛门外出现一外口,影响正常生活及休息,今日
为进一步治疗,故来我院就诊,门诊经检查以“高位肛楼” 收入院。患
者一般状态佳,二便正常,睡眠欠佳。
```
#### ==Diagnosis and Code Mapping==
```object!
{'肝炎': 'K75.901', '结核': 'A16.200', '高位肛楼': 'K60.301'}
```
#### ==Symptom and Code Mapping==
```object!
{'肛门旁条索状硬结': 'K62.901', '肛门旁一肺块': 'K62.820', '轻度疼痛': 'R52.900', '分泌物溢出': 'R84.901', '肛门外出现一外口': 'K62.501', '影响正常生活及休息': 'P02.900'}
```
#### ==Operation and Code Mapping==
```object!
None
```
#### ==Output==
```json!
{
"RequestId": "9DC6B867-FE82-56DF-8A27-602ADE419B9F",
"Data": {
"result": {
"ner": [
{
"parent": [
1,
2
],
"children": [],
"probability": [
0.5667661428451538
],
"end_char": 12,
"attributes": [],
"id": 0,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 11
},
{
"parent": [
2
],
"children": [
0
],
"probability": [
0.40318673849105835
],
"end_char": 13,
"attributes": [],
"id": 1,
"text": "肛门旁",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 11
},
{
"parent": [],
"children": [
0,
1
],
"probability": [
0.7614381909370422
],
"end_char": 18,
"attributes": [
"PAST"
],
"id": 2,
"text": "肛门旁条索状硬结",
"type": [
"Symptom"
],
"attr_probability": [
0.599180281162262
],
"begin_char": 11
},
{
"parent": [],
"children": [],
"probability": [
0.840126633644104
],
"end_char": 50,
"attributes": [
"NEGATION"
],
"id": 3,
"text": "肝炎",
"type": [
"Diagnosis"
],
"attr_probability": [
0.9907529354095459
],
"begin_char": 49
},
{
"parent": [],
"children": [],
"probability": [
0.49227845668792725
],
"end_char": 53,
"attributes": [
"NEGATION"
],
"id": 4,
"text": "结核",
"type": [
"Diagnosis"
],
"attr_probability": [
0.9899516701698303
],
"begin_char": 52
},
{
"parent": [
6
],
"children": [],
"probability": [
0.6862098574638367
],
"end_char": 78,
"attributes": [],
"id": 5,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 77
},
{
"parent": [],
"children": [
5
],
"probability": [
0.9090278148651123
],
"end_char": 82,
"attributes": [
"PAST"
],
"id": 6,
"text": "肛门旁一肺块",
"type": [
"Symptom"
],
"attr_probability": [
0.8783222436904907
],
"begin_char": 77
},
{
"parent": [],
"children": [],
"probability": [
0.4765460789203644
],
"end_char": 88,
"attributes": [
"PAST"
],
"id": 7,
"text": "轻度疼痛",
"type": [
"Symptom"
],
"attr_probability": [
0.8119313716888428
],
"begin_char": 85
},
{
"parent": [],
"children": [],
"probability": [
0.956788182258606
],
"end_char": 95,
"attributes": [
"NEGATION"
],
"id": 8,
"text": "分泌物溢出",
"type": [
"Symptom"
],
"attr_probability": [
0.9866699576377869
],
"begin_char": 91
},
{
"parent": [
10
],
"children": [],
"probability": [
0.5296885967254639
],
"end_char": 98,
"attributes": [],
"id": 9,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 97
},
{
"parent": [],
"children": [
9
],
"probability": [
0.7978349924087524
],
"end_char": 104,
"attributes": [
"PAST"
],
"id": 10,
"text": "肛门外出现一外口",
"type": [
"Symptom"
],
"attr_probability": [
0.7601957321166992
],
"begin_char": 97
},
{
"parent": [],
"children": [],
"probability": [
0.46812018752098083
],
"end_char": 114,
"attributes": [
"PAST"
],
"id": 11,
"text": "影响正常生活及休息",
"type": [
"Symptom"
],
"attr_probability": [
0.9138981699943542
],
"begin_char": 106
},
{
"parent": [],
"children": [],
"probability": [
0.9136496782302856
],
"end_char": 142,
"attributes": [
"PAST"
],
"id": 12,
"text": "高位肛楼",
"type": [
"Diagnosis"
],
"attr_probability": [
0.5133733153343201
],
"begin_char": 139
}
],
"text": "惠者仲崇波男59岁因“肛门旁条索状硬结2周余”为主诉收入院病历特点:1、中老年男性,生活自理,否认肝炎,结核等病史。2、现病史:该患于2周前无明显诱因出现肛门旁一肺块,伴轻度疼痛,无分泌物溢出,肛门外出现一外口,影响正常生活及休息,今日为进一步治疗,故来我院就诊,门诊经检查以“高位肛楼”收入院。患者一般状态佳,二便正常,睡眠欠佳"
},
"success": true,
"tracerId": "0.0.0.0-0-139960837529968-1665613198584-0000000228"
}
}
```
### **Example 1-2**
#### ==Input Text==
```text!
3、查体:T:36.3°C
P: 78次/分
R: 18次/分
Bp: 140/100mmHg。
一般状态可,神清语明,查体合作。眼脸无水肿,
结膜无充血,巩膜无黄染,障孔等大等圆,对光反射灵敏。口唇无发绀,
咽不充山,扁桃体无肿大,颈软,气管居中,甲状腺无肿大。双肺呼吸
音清晰,未闻及干湿性罗音。心音正常,心率:78次/分,律齐,各瓣
膜听诊区未闻及异常杂音。腹软,肝、胆、脾肋下未触及。脊柱四肢正
常。神经系统未见异常。
```
#### ==Diagnosis and Code Mapping==
```object!
None
```
#### ==Symptom and Code Mapping==
```object!
{'眼脸无水肿': 'H02.806', '结膜无充血': 'N42.101', '巩膜无黄染': 'H44.402', '口唇无发绀': 'R23.000', '咽不充山': 'ZZSV11', '扁桃体无肿大': 'J35.100', '气管居中': 'J40.x01', '甲状腺无肿大': 'E04.900', '双肺呼吸音清晰': 'R06.500', '干湿性罗音': 'R49.100', '律齐': 'I49.900'}
```
#### ==Operation and Code Mapping==
```object!
None
```
#### ==Output==
```json!
{
"RequestId": "A7F73717-3DC4-5D9A-9A98-5176AE0F634F",
"Data": {
"result": {
"ner": [
{
"parent": [],
"children": [],
"probability": [
0.4559190571308136
],
"end_char": 3,
"attributes": [],
"id": 0,
"text": "查体",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 2
},
{
"parent": [],
"children": [],
"probability": [
0.7117063403129578
],
"end_char": 5,
"attributes": [],
"id": 1,
"text": "T",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 5
},
{
"parent": [],
"children": [],
"probability": [
0.559089183807373
],
"end_char": 11,
"attributes": [],
"id": 2,
"text": "36.3°",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 7
},
{
"parent": [],
"children": [],
"probability": [
0.6457027196884155
],
"end_char": 13,
"attributes": [],
"id": 3,
"text": "CP",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 12
},
{
"parent": [],
"children": [],
"probability": [
0.8147764801979065
],
"end_char": 19,
"attributes": [],
"id": 4,
"text": "78次/分",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 15
},
{
"parent": [],
"children": [],
"probability": [
0.7796140313148499
],
"end_char": 20,
"attributes": [],
"id": 5,
"text": "R",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 20
},
{
"parent": [],
"children": [],
"probability": [
0.8471737504005432
],
"end_char": 26,
"attributes": [],
"id": 6,
"text": "18次/分",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 22
},
{
"parent": [],
"children": [],
"probability": [
0.9418830275535583
],
"end_char": 28,
"attributes": [],
"id": 7,
"text": "Bp",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 27
},
{
"parent": [],
"children": [],
"probability": [
0.7612501978874207
],
"end_char": 40,
"attributes": [],
"id": 8,
"text": "140/100mmHg",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 30
},
{
"parent": [
10
],
"children": [],
"probability": [
0.474394291639328
],
"end_char": 59,
"attributes": [],
"id": 9,
"text": "眼脸",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 58
},
{
"parent": [],
"children": [
9
],
"probability": [
0.9198798537254333
],
"end_char": 62,
"attributes": [
"NEGATION"
],
"id": 10,
"text": "眼脸无水肿",
"type": [
"Symptom"
],
"attr_probability": [
0.9582778215408325
],
"begin_char": 58
},
{
"parent": [
12
],
"children": [],
"probability": [
0.5355358719825745
],
"end_char": 65,
"attributes": [],
"id": 11,
"text": "结膜",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 64
},
{
"parent": [],
"children": [
11
],
"probability": [
0.9852780699729919
],
"end_char": 68,
"attributes": [
"NEGATION"
],
"id": 12,
"text": "结膜无充血",
"type": [
"Symptom"
],
"attr_probability": [
0.9669600129127502
],
"begin_char": 64
},
{
"parent": [
14
],
"children": [],
"probability": [
0.4944614768028259
],
"end_char": 71,
"attributes": [],
"id": 13,
"text": "巩膜",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 70
},
{
"parent": [],
"children": [
13
],
"probability": [
0.9450756907463074
],
"end_char": 74,
"attributes": [
"NEGATION"
],
"id": 14,
"text": "巩膜无黄染",
"type": [
"Symptom"
],
"attr_probability": [
0.9789148569107056
],
"begin_char": 70
},
{
"parent": [
16
],
"children": [],
"probability": [
0.4977833926677704
],
"end_char": 91,
"attributes": [],
"id": 15,
"text": "口唇",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 90
},
{
"parent": [],
"children": [
15
],
"probability": [
0.9205439686775208
],
"end_char": 94,
"attributes": [
"NEGATION"
],
"id": 16,
"text": "口唇无发绀",
"type": [
"Symptom"
],
"attr_probability": [
0.9656806588172913
],
"begin_char": 90
},
{
"parent": [
18
],
"children": [],
"probability": [
0.5020537376403809
],
"end_char": 96,
"attributes": [],
"id": 17,
"text": "咽",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 96
},
{
"parent": [],
"children": [
17
],
"probability": [
0.973535418510437
],
"end_char": 99,
"attributes": [
"NEGATION"
],
"id": 18,
"text": "咽不充山",
"type": [
"Symptom"
],
"attr_probability": [
0.9691218137741089
],
"begin_char": 96
},
{
"parent": [
20
],
"children": [],
"probability": [
0.6746698617935181
],
"end_char": 103,
"attributes": [],
"id": 19,
"text": "扁桃体",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 101
},
{
"parent": [],
"children": [
19
],
"probability": [
0.9797856211662292
],
"end_char": 106,
"attributes": [
"NEGATION"
],
"id": 20,
"text": "扁桃体无肿大",
"type": [
"Symptom"
],
"attr_probability": [
0.9786681532859802
],
"begin_char": 101
},
{
"parent": [],
"children": [],
"probability": [
0.5835152864456177
],
"end_char": 108,
"attributes": [],
"id": 21,
"text": "颈",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 108
},
{
"parent": [
23
],
"children": [],
"probability": [
0.6687433123588562
],
"end_char": 112,
"attributes": [],
"id": 22,
"text": "气管",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 111
},
{
"parent": [],
"children": [
22
],
"probability": [
0.7424846291542053
],
"end_char": 114,
"attributes": [],
"id": 23,
"text": "气管居中",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 111
},
{
"parent": [
25
],
"children": [],
"probability": [
0.5230563879013062
],
"end_char": 118,
"attributes": [],
"id": 24,
"text": "甲状腺",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 116
},
{
"parent": [],
"children": [
24
],
"probability": [
0.5877424478530884
],
"end_char": 121,
"attributes": [
"NEGATION"
],
"id": 25,
"text": "甲状腺无肿大",
"type": [
"Symptom"
],
"attr_probability": [
0.980836808681488
],
"begin_char": 116
},
{
"parent": [
27
],
"children": [],
"probability": [
0.8271366357803345
],
"end_char": 124,
"attributes": [],
"id": 26,
"text": "双肺",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 123
},
{
"parent": [],
"children": [
26
],
"probability": [
0.5475946068763733
],
"end_char": 129,
"attributes": [],
"id": 27,
"text": "双肺呼吸音清晰",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 123
},
{
"parent": [],
"children": [],
"probability": [
0.3827102482318878
],
"end_char": 138,
"attributes": [
"NEGATION"
],
"id": 28,
"text": "干湿性罗音",
"type": [
"Symptom"
],
"attr_probability": [
0.9988629817962646
],
"begin_char": 134
},
{
"parent": [],
"children": [],
"probability": [
0.9484140872955322
],
"end_char": 146,
"attributes": [],
"id": 29,
"text": "心率",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 145
},
{
"parent": [],
"children": [],
"probability": [
0.9031441807746887
],
"end_char": 152,
"attributes": [],
"id": 30,
"text": "78次/分",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 148
},
{
"parent": [],
"children": [],
"probability": [
0.36500558257102966
],
"end_char": 155,
"attributes": [],
"id": 31,
"text": "律齐",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 154
},
{
"parent": [],
"children": [],
"probability": [
0.3561169505119324
],
"end_char": 159,
"attributes": [],
"id": 32,
"text": "瓣膜",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 158
},
{
"parent": [],
"children": [],
"probability": [
0.6032836437225342
],
"end_char": 171,
"attributes": [],
"id": 33,
"text": "腹",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 171
},
{
"parent": [],
"children": [],
"probability": [
0.5844191312789917
],
"end_char": 174,
"attributes": [],
"id": 34,
"text": "肝",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 174
},
{
"parent": [],
"children": [],
"probability": [
0.6495335102081299
],
"end_char": 176,
"attributes": [],
"id": 35,
"text": "胆",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 176
},
{
"parent": [],
"children": [],
"probability": [
0.4489433169364929
],
"end_char": 178,
"attributes": [],
"id": 36,
"text": "脾",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 178
},
{
"parent": [],
"children": [],
"probability": [
0.4551575481891632
],
"end_char": 199,
"attributes": [
"NEGATION"
],
"id": 37,
"text": "神经系统未见异常",
"type": [
"Test-result"
],
"attr_probability": [
0.760374903678894
],
"begin_char": 192
}
],
"text": "3、查体:T:36.3°CP:78次/分R:18次/分Bp:140/100mmHg。一般状态可,神清语明,查体合作。眼脸无水肿,结膜无充血,巩膜无黄染,障孔等大等圆,对光反射灵敏。口唇无发绀,咽不充山,扁桃体无肿大,颈软,气管居中,甲状腺无肿大。双肺呼吸音清晰,未闻及干湿性罗音。心音正常,心率:78次/分,律齐,各瓣膜听诊区未闻及异常杂音。腹软,肝、胆、脾肋下未触及。脊柱四肢正常。神经系统未见异常。"
},
"success": true,
"tracerId": "0.0.0.0-0-139960501984000-1665614688922-0000000232"
}
}
```
### **Example 1-3**
#### ==Input Text==
```text!
专科检查:查体:取截石位1)视诊:肛门发育正常,5时位距肛门2cm 见一外口,外口封闭无分泌物流出:2〉触诊:肛门括约肌功能良好,5点位各触及一条索状硬物向肛门内延伸,5点位齿线上:2.5cm 可触及一凹陷,触之较硬,应为内口,3)肛门镜未做。
4、铺助检查:
WBC:8 8*109/1
RBC: 4. 9*1012 /L
HGB:182g/1
PLT:29*109/L
临床诊斯:高位肛瘘
诊断依据:
1、病史:肛门旁条索状硬结2周余。
```
#### ==Diagnosis and Code Mapping==
```object!
{'高位肛瘘': 'K60.301'}
```
#### ==Symptom and Code Mapping==
```object!
{'外口封闭无分泌物流出': 'M84130/3', '肛门括约肌功能良好': 'R15.x01', '触之较硬': 'W33.900', '肛门旁条索状硬结': 'K62.901'}
```
#### ==Operation and Code Mapping==
```object!
None
```
#### ==Output==
```json!
{
"RequestId": "C75AB391-0094-54FA-9016-175F06796904",
"Data": {
"result": {
"ner": [
{
"parent": [
1
],
"children": [],
"probability": [
0.6649020314216614
],
"end_char": 18,
"attributes": [],
"id": 0,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 17
},
{
"parent": [],
"children": [
0
],
"probability": [
0.48463284969329834
],
"end_char": 22,
"attributes": [],
"id": 1,
"text": "肛门发育正常",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 17
},
{
"parent": [],
"children": [],
"probability": [
0.4222594201564789
],
"end_char": 29,
"attributes": [],
"id": 2,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 28
},
{
"parent": [],
"children": [],
"probability": [
0.6837033629417419
],
"end_char": 47,
"attributes": [
"NEGATION"
],
"id": 3,
"text": "外口封闭无分泌物流出",
"type": [
"Symptom"
],
"attr_probability": [
0.9471786618232727
],
"begin_char": 38
},
{
"parent": [
5,
6
],
"children": [],
"probability": [
0.45869696140289307
],
"end_char": 55,
"attributes": [],
"id": 4,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 54
},
{
"parent": [
6
],
"children": [
4
],
"probability": [
0.7055328488349915
],
"end_char": 58,
"attributes": [],
"id": 5,
"text": "肛门括约肌",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 54
},
{
"parent": [],
"children": [
4,
5
],
"probability": [
0.5242661833763123
],
"end_char": 62,
"attributes": [],
"id": 6,
"text": "肛门括约肌功能良好",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 54
},
{
"parent": [],
"children": [],
"probability": [
0.4415673315525055
],
"end_char": 78,
"attributes": [],
"id": 7,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 77
},
{
"parent": [],
"children": [],
"probability": [
0.3875442445278168
],
"end_char": 94,
"attributes": [],
"id": 8,
"text": "5点位齿线上:2.5cm",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 83
},
{
"parent": [],
"children": [],
"probability": [
0.4752539098262787
],
"end_char": 105,
"attributes": [],
"id": 9,
"text": "触之较硬",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 102
},
{
"parent": [],
"children": [],
"probability": [
0.9193670153617859
],
"end_char": 129,
"attributes": [],
"id": 10,
"text": "WBC",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 127
},
{
"parent": [],
"children": [],
"probability": [
0.8294545412063599
],
"end_char": 141,
"attributes": [],
"id": 11,
"text": "RBC",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 139
},
{
"parent": [],
"children": [],
"probability": [
0.502691924571991
],
"end_char": 162,
"attributes": [],
"id": 12,
"text": "182g/1",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 157
},
{
"parent": [],
"children": [],
"probability": [
0.659569263458252
],
"end_char": 165,
"attributes": [],
"id": 13,
"text": "PLT",
"type": [
"Test-name"
],
"attr_probability": [],
"begin_char": 163
},
{
"parent": [],
"children": [],
"probability": [
0.7528488636016846
],
"end_char": 174,
"attributes": [],
"id": 14,
"text": "29*109/L",
"type": [
"Test-result"
],
"attr_probability": [],
"begin_char": 167
},
{
"parent": [],
"children": [],
"probability": [
0.674857497215271
],
"end_char": 183,
"attributes": [],
"id": 15,
"text": "高位肛瘘",
"type": [
"Diagnosis"
],
"attr_probability": [],
"begin_char": 180
},
{
"parent": [
17
],
"children": [],
"probability": [
0.5530770421028137
],
"end_char": 195,
"attributes": [],
"id": 16,
"text": "肛门",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 194
},
{
"parent": [],
"children": [
16
],
"probability": [
0.613625168800354,
0.4939148426055908
],
"end_char": 201,
"attributes": [],
"id": 17,
"text": "肛门旁条索状硬结",
"type": [
"Symptom",
"Test-result"
],
"attr_probability": [],
"begin_char": 194
}
],
"text": "专科检查:查体:取截石位1)视诊:肛门发育正常,5时位距肛门2cm见一外口,外口封闭无分泌物流出:2〉触诊:肛门括约肌功能良好,5点位各触及一条索状硬物向肛门内延伸,5点位齿线上:2.5cm可触及一凹陷,触之较硬,应为内口,3)肛门镜未做。4、铺助检查:WBC:88*109/1RBC:4.9*1012/LHGB:182g/1PLT:29*109/L临床诊斯:高位肛瘘诊断依据:1、病史:肛门旁条索状硬结2周余。"
},
"success": true,
"tracerId": "0.0.0.0-0-139960569039472-1665614484348-0000000230"
}
}
```
---
### **Example 2-1**
#### ==Input Text==
```text!
患者XXX,性别:男,年龄:32岁,农民。因“转移性右下腹疼
痛半天”于×年×月X日16:50:10由门诊以“阑尾炎”收入住院。
值班医师于x年X月x日16:58:40到病房及时查视患者。
病例特点:
1、现病史:患者于今早无明显诱因感腹部疼痛,恶心纳呆,呕
吐,发热,呈持续性、进行性加剧,转至右下腹疼痛,右下腹摸及
包块,未在院外诊治,急来我院就诊,为求进一步系统诊治,由门
诊以“阑尾炎”收住院。
```
#### ==Diagnosis and Code Mapping==
```object!
{'阑尾炎': 'K37.x00'}
```
#### ==Symptom and Code Mapping==
```object!
{'转移性右下腹疼痛': 'R10.301', '腹部疼痛': 'R10.100', '恶心': 'R11.x00', '纳呆': 'F03.x00', '呕吐': 'BNP050', '发热': 'R50.900', '进行性加剧': 'Y00.900', '右下腹疼痛': 'R10.301', '右下腹摸及包块': 'ZVX040'}
```
#### ==Operation and Code Mapping==
```object!
None
```
#### ==Output==
```json!
{
"RequestId": "2394B6FC-CDE9-5DF9-B463-CE00B926C718",
"Data": {
"result": {
"ner": [
{
"parent": [],
"children": [
19,
1
],
"probability": [
0.8219740986824036
],
"end_char": 30,
"attributes": [
"PAST"
],
"id": 0,
"text": "转移性右下腹疼痛",
"type": [
"Symptom"
],
"attr_probability": [
0.9389327168464661
],
"begin_char": 23
},
{
"parent": [
0
],
"children": [
19
],
"probability": [
0.8446980118751526
],
"end_char": 28,
"attributes": [],
"id": 1,
"text": "右下腹",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 26
},
{
"parent": [
3
],
"children": [],
"probability": [
0.7417589426040649
],
"end_char": 55,
"attributes": [],
"id": 2,
"text": "阑尾",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 54
},
{
"parent": [],
"children": [
2
],
"probability": [
0.9306288957595825
],
"end_char": 56,
"attributes": [],
"id": 3,
"text": "阑尾炎",
"type": [
"Diagnosis"
],
"attr_probability": [],
"begin_char": 54
},
{
"parent": [
5
],
"children": [],
"probability": [
0.8907551169395447
],
"end_char": 115,
"attributes": [],
"id": 4,
"text": "腹部",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 114
},
{
"parent": [],
"children": [
4
],
"probability": [
0.969254732131958
],
"end_char": 117,
"attributes": [
"PAST"
],
"id": 5,
"text": "腹部疼痛",
"type": [
"Symptom"
],
"attr_probability": [
0.7429856657981873
],
"begin_char": 114
},
{
"parent": [],
"children": [],
"probability": [
0.9956061244010925
],
"end_char": 120,
"attributes": [
"PAST"
],
"id": 6,
"text": "恶心",
"type": [
"Symptom"
],
"attr_probability": [
0.765105664730072
],
"begin_char": 119
},
{
"parent": [],
"children": [],
"probability": [
0.9967622756958008
],
"end_char": 122,
"attributes": [
"PAST"
],
"id": 7,
"text": "纳呆",
"type": [
"Symptom"
],
"attr_probability": [
0.7550528645515442
],
"begin_char": 121
},
{
"parent": [],
"children": [],
"probability": [
0.9988881945610046
],
"end_char": 125,
"attributes": [
"PAST"
],
"id": 8,
"text": "呕吐",
"type": [
"Symptom"
],
"attr_probability": [
0.649490475654602
],
"begin_char": 124
},
{
"parent": [],
"children": [],
"probability": [
0.9775493144989014
],
"end_char": 128,
"attributes": [
"PAST"
],
"id": 9,
"text": "发热",
"type": [
"Symptom"
],
"attr_probability": [
0.7679036855697632
],
"begin_char": 127
},
{
"parent": [],
"children": [],
"probability": [
0.39704185724258423
],
"end_char": 139,
"attributes": [
"PAST"
],
"id": 10,
"text": "进行性加剧",
"type": [
"Symptom"
],
"attr_probability": [
0.884154736995697
],
"begin_char": 135
},
{
"parent": [
12
],
"children": [
18
],
"probability": [
0.9026079177856445
],
"end_char": 145,
"attributes": [],
"id": 11,
"text": "右下腹",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 143
},
{
"parent": [],
"children": [
18,
11
],
"probability": [
0.6083897948265076
],
"end_char": 147,
"attributes": [
"PAST"
],
"id": 12,
"text": "右下腹疼痛",
"type": [
"Symptom"
],
"attr_probability": [
0.7603960037231445
],
"begin_char": 143
},
{
"parent": [
14
],
"children": [
17
],
"probability": [
0.9303876757621765
],
"end_char": 151,
"attributes": [],
"id": 13,
"text": "右下腹",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 149
},
{
"parent": [],
"children": [
17,
13
],
"probability": [
0.9555454254150391
],
"end_char": 155,
"attributes": [
"PAST"
],
"id": 14,
"text": "右下腹摸及包块",
"type": [
"Symptom"
],
"attr_probability": [
0.7623286247253418
],
"begin_char": 149
},
{
"parent": [
16
],
"children": [],
"probability": [
0.7325032353401184
],
"end_char": 187,
"attributes": [],
"id": 15,
"text": "阑尾",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 186
},
{
"parent": [],
"children": [
15
],
"probability": [
0.9427353143692017
],
"end_char": 188,
"attributes": [],
"id": 16,
"text": "阑尾炎",
"type": [
"Diagnosis"
],
"attr_probability": [],
"begin_char": 186
},
{
"parent": [
13,
14
],
"children": [],
"probability": [
0.7
],
"end_char": 150,
"attributes": [],
"id": 17,
"text": "右下",
"type": [
"Location"
],
"attr_probability": [],
"begin_char": 149
},
{
"parent": [
11,
12
],
"children": [],
"probability": [
0.7
],
"end_char": 144,
"attributes": [],
"id": 18,
"text": "右下",
"type": [
"Location"
],
"attr_probability": [],
"begin_char": 143
},
{
"parent": [
0,
1
],
"children": [],
"probability": [
0.7
],
"end_char": 27,
"attributes": [],
"id": 19,
"text": "右下",
"type": [
"Location"
],
"attr_probability": [],
"begin_char": 26
}
],
"text": "患者XXX,性别:男,年龄:32岁,农民。因“转移性右下腹疼痛半天”于×年×月X日16:50:10由门诊以“阑尾炎”收入住院。值班医师于x年X月x日16:58:40到病房及时查视患者。病例特点:1、现病史:患者于今早无明显诱因感腹部疼痛,恶心纳呆,呕吐,发热,呈持续性、进行性加剧,转至右下腹疼痛,右下腹摸及包块,未在院外诊治,急来我院就诊,为求进一步系统诊治,由门诊以“阑尾炎”收住院。"
},
"success": true,
"tracerId": "0.0.0.0-0-139960166439760-1665615981067-0000000235"
}
}
```
### **Example 2-2**
#### ==Input Text==
```text!
入院症见:患者感腹部疼痛,恶心纳呆
呕吐,发热,呈持续性、进行性加剧,转移至右下腹疼痛,右下腹
摸及包块,患者神清语利,精神可,平素饮食可,夜寐可,小便调、
便秘.
2、既往史:既往体健。否认高血压病、冠心病、糖尿病等慢性
病病史,否认肝炎、结核、伤寒、症疾等传染病史,否认重大外伤
史、手术史及输血史,否认食物及药物过敏史。预防接种史不详。
```
#### ==Diagnosis and Code Mapping==
```object!
{'高血压病': 'I10.x00', '冠心病': 'I25.104', '糖尿病': 'E14.900', '肝炎': 'K75.901', '结核': 'A16.200', '食物及药物过敏': 'L27.202'}
```
#### ==Symptom and Code Mapping==
```object!
{'腹部疼痛': 'R10.100', '恶心': 'R11.x00', '纳呆': 'F03.x00', '呕吐': 'BNP050', '发热': 'R50.900', '右下腹疼痛': 'R10.301', '右下腹摸及包块': 'ZVX040', '伤寒': 'A01.000', '症疾': 'B54.x00'}
```
#### ==Operation and Code Mapping==
```object!
None
```
#### ==Output==
```json!
{
"RequestId": "AC71566E-CB98-5BE6-B9C1-C0A191096FE5",
"Data": {
"result": {
"ner": [
{
"parent": [
1
],
"children": [],
"probability": [
0.899808406829834
],
"end_char": 9,
"attributes": [],
"id": 0,
"text": "腹部",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 8
},
{
"parent": [],
"children": [
0
],
"probability": [
0.9612882733345032
],
"end_char": 11,
"attributes": [],
"id": 1,
"text": "腹部疼痛",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 8
},
{
"parent": [],
"children": [],
"probability": [
0.9811118245124817
],
"end_char": 14,
"attributes": [],
"id": 2,
"text": "恶心",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 13
},
{
"parent": [],
"children": [],
"probability": [
0.989193856716156
],
"end_char": 16,
"attributes": [],
"id": 3,
"text": "纳呆",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 15
},
{
"parent": [],
"children": [],
"probability": [
0.9988956451416016
],
"end_char": 18,
"attributes": [],
"id": 4,
"text": "呕吐",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 17
},
{
"parent": [],
"children": [],
"probability": [
0.9800047278404236
],
"end_char": 21,
"attributes": [],
"id": 5,
"text": "发热",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 20
},
{
"parent": [
7
],
"children": [
20
],
"probability": [
0.9256253242492676
],
"end_char": 39,
"attributes": [],
"id": 6,
"text": "右下腹",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 37
},
{
"parent": [],
"children": [
20,
6
],
"probability": [
0.9337639212608337
],
"end_char": 41,
"attributes": [],
"id": 7,
"text": "右下腹疼痛",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 37
},
{
"parent": [
9
],
"children": [
19
],
"probability": [
0.9130396246910095
],
"end_char": 45,
"attributes": [],
"id": 8,
"text": "右下腹",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 43
},
{
"parent": [],
"children": [
19,
8
],
"probability": [
0.9362768530845642
],
"end_char": 49,
"attributes": [],
"id": 9,
"text": "右下腹摸及包块",
"type": [
"Symptom"
],
"attr_probability": [],
"begin_char": 43
},
{
"parent": [],
"children": [],
"probability": [
0.9796510338783264
],
"end_char": 95,
"attributes": [
"NEGATION"
],
"id": 10,
"text": "高血压病",
"type": [
"Diagnosis"
],
"attr_probability": [
0.5497587323188782
],
"begin_char": 92
},
{
"parent": [],
"children": [],
"probability": [
0.9901682138442993
],
"end_char": 99,
"attributes": [
"NEGATION"
],
"id": 11,
"text": "冠心病",
"type": [
"Diagnosis"
],
"attr_probability": [
0.898547351360321
],
"begin_char": 97
},
{
"parent": [],
"children": [],
"probability": [
0.9926747679710388
],
"end_char": 103,
"attributes": [
"NEGATION"
],
"id": 12,
"text": "糖尿病",
"type": [
"Diagnosis"
],
"attr_probability": [
0.9096331596374512
],
"begin_char": 101
},
{
"parent": [
14
],
"children": [],
"probability": [
0.38602763414382935
],
"end_char": 113,
"attributes": [],
"id": 13,
"text": "肝",
"type": [
"Anatomy"
],
"attr_probability": [],
"begin_char": 113
},
{
"parent": [],
"children": [
13
],
"probability": [
0.9004794359207153
],
"end_char": 114,
"attributes": [
"NEGATION"
],
"id": 14,
"text": "肝炎",
"type": [
"Diagnosis"
],
"attr_probability": [
0.9885963797569275
],
"begin_char": 113
},
{
"parent": [],
"children": [],
"probability": [
0.9629657864570618
],
"end_char": 117,
"attributes": [
"NEGATION"
],
"id": 15,
"text": "结核",
"type": [
"Diagnosis"
],
"attr_probability": [
0.989276647567749
],
"begin_char": 116
},
{
"parent": [],
"children": [],
"probability": [
0.9229863882064819
],
"end_char": 120,
"attributes": [
"NEGATION"
],
"id": 16,
"text": "伤寒",
"type": [
"Symptom"
],
"attr_probability": [
0.9933517575263977
],
"begin_char": 119
},
{
"parent": [],
"children": [],
"probability": [
0.8050374984741211
],
"end_char": 123,
"attributes": [
"NEGATION"
],
"id": 17,
"text": "症疾",
"type": [
"Symptom"
],
"attr_probability": [
0.9903056621551514
],
"begin_char": 122
},
{
"parent": [],
"children": [],
"probability": [
0.7649497985839844
],
"end_char": 154,
"attributes": [
"NEGATION"
],
"id": 18,
"text": "食物及药物过敏",
"type": [
"Diagnosis"
],
"attr_probability": [
0.9994564652442932
],
"begin_char": 148
},
{
"parent": [
8,
9
],
"children": [],
"probability": [
0.7
],
"end_char": 44,
"attributes": [],
"id": 19,
"text": "右下",
"type": [
"Location"
],
"attr_probability": [],
"begin_char": 43
},
{
"parent": [
6,
7
],
"children": [],
"probability": [
0.7
],
"end_char": 38,
"attributes": [],
"id": 20,
"text": "右下",
"type": [
"Location"
],
"attr_probability": [],
"begin_char": 37
}
],
"text": "入院症见:患者感腹部疼痛,恶心纳呆呕吐,发热,呈持续性、进行性加剧,转移至右下腹疼痛,右下腹摸及包块,患者神清语利,精神可,平素饮食可,夜寐可,小便调、便秘.2、既往史:既往体健。否认高血压病、冠心病、糖尿病等慢性病病史,否认肝炎、结核、伤寒、症疾等传染病史,否认重大外伤史、手术史及输血史,否认食物及药物过敏史。预防接种史不详。"
},
"success": true,
"tracerId": "0.0.0.0-0-139960233495216-1665616058009-0000000236"
}
}
```
---
> ### **Due to max length of this note has been reached, Example 3 will be provided [here](https://hackmd.io/mwTrUccoTmqzUynK7-n5qQ?view)**