license: mit
task_categories:
- token-classification
language:
- en
tags:
- biology
- medical
size_categories:
- 1M<n<10M
field:
- data
MACCROBAT-biomedical-ner
This data is the same data from here, the only difference is that it has been converted into the Huggingface dataset format. So it can be easily loaded and can be used wherever need.
To convert from the orginal format to huggingface dataset format, followed the following steps (To know in more detail look at the create_dataset.py
file):
- Read corresponding
*.txt
and*.ann
file. - Used
pandas
to convert the*.ann
file into dataframe. - After converting into dataframe, did some processing and converted NER label information into:
{ "text": "ner-text", "label": "ner-label", "start": 10, "end": 20 }
- Standard labels are converted into
B-Tag
andI-tag
, whereB
- stands for begning of the tag andI
- stands for inside the tag. - Finally the JSON is created and uploaded here.
Source Data
This ZIP-compressed file contains 200 source documents (in plain text, on sentence per line) and 200 annotation documents (in brat standoff format). Documents are named using PubMed document IDs, e.g. "15939911.txt" contains text from the document "A young man with palpitations and Ebstein's anomaly of the tricuspid valve" by Marcu and Donohue. Text is from PubMed Central full-text documents but has been edited to include only clinical case report details. All annotations were created manually.
"MACCROBAT2020" is the second release of this dataset, following "MACCROBAT2018". The consistency and format of annotations has been improved in the newest version.
Uses
Use below snippet to load the data properly and it can be used to finetune medical based NER model with some additional processing.
import datasets
from datasets import load_dataset
features_data = datasets.Features(
{
"full_text": Value(dtype="string"),
"ner_info": [
{
"text": Value(dtype="string"),
"label": Value(dtype="string"),
"start": Value(dtype="int64"),
"end": Value(dtype="int64"),
}
],
"tokens": Sequence(Value(dtype="string")),
"ner_labels": Sequence(
ClassLabel(
names=[
"O",
"B-ACTIVITY",
"I-ACTIVITY",
"I-ADMINISTRATION",
"B-ADMINISTRATION",
"B-AGE",
"I-AGE",
"I-AREA",
"B-AREA",
"B-BIOLOGICAL_ATTRIBUTE",
"I-BIOLOGICAL_ATTRIBUTE",
"I-BIOLOGICAL_STRUCTURE",
"B-BIOLOGICAL_STRUCTURE",
"B-CLINICAL_EVENT",
"I-CLINICAL_EVENT",
"B-COLOR",
"I-COLOR",
"I-COREFERENCE",
"B-COREFERENCE",
"B-DATE",
"I-DATE",
"I-DETAILED_DESCRIPTION",
"B-DETAILED_DESCRIPTION",
"I-DIAGNOSTIC_PROCEDURE",
"B-DIAGNOSTIC_PROCEDURE",
"I-DISEASE_DISORDER",
"B-DISEASE_DISORDER",
"B-DISTANCE",
"I-DISTANCE",
"B-DOSAGE",
"I-DOSAGE",
"I-DURATION",
"B-DURATION",
"I-FAMILY_HISTORY",
"B-FAMILY_HISTORY",
"B-FREQUENCY",
"I-FREQUENCY",
"I-HEIGHT",
"B-HEIGHT",
"B-HISTORY",
"I-HISTORY",
"I-LAB_VALUE",
"B-LAB_VALUE",
"I-MASS",
"B-MASS",
"I-MEDICATION",
"B-MEDICATION",
"I-NONBIOLOGICAL_LOCATION",
"B-NONBIOLOGICAL_LOCATION",
"I-OCCUPATION",
"B-OCCUPATION",
"B-OTHER_ENTITY",
"I-OTHER_ENTITY",
"B-OTHER_EVENT",
"I-OTHER_EVENT",
"I-OUTCOME",
"B-OUTCOME",
"I-PERSONAL_BACKGROUND",
"B-PERSONAL_BACKGROUND",
"B-QUALITATIVE_CONCEPT",
"I-QUALITATIVE_CONCEPT",
"I-QUANTITATIVE_CONCEPT",
"B-QUANTITATIVE_CONCEPT",
"B-SEVERITY",
"I-SEVERITY",
"B-SEX",
"I-SEX",
"B-SHAPE",
"I-SHAPE",
"B-SIGN_SYMPTOM",
"I-SIGN_SYMPTOM",
"B-SUBJECT",
"I-SUBJECT",
"B-TEXTURE",
"I-TEXTURE",
"B-THERAPEUTIC_PROCEDURE",
"I-THERAPEUTIC_PROCEDURE",
"I-TIME",
"B-TIME",
"B-VOLUME",
"I-VOLUME",
"I-WEIGHT",
"B-WEIGHT",
]
)
),
}
)
# load the data
medical_ner_data = load_dataset("singh-aditya/MACCROBAT-biomedical-ner", field="data", features=features_data)
print(medical_ner_data)
DatasetDict({
train: Dataset({
features: ['ner_labels', 'tokens', 'full_text', 'ner_info'],
num_rows: 200
})
})
Dataset Structure
{
'full_text': "CASE: A 28-year-old previously healthy man presented with a 6-week history of palpitations.\nThe symptoms occurred during rest, 2–3 times per week, lasted up to 30 minutes at a time and were associated with dyspnea.\nExcept for a grade 2/6 holosystolic tricuspid regurgitation murmur (best heard at the left sternal border with inspiratory accentuation), physical examination yielded unremarkable findings.\nAn electrocardiogram (ECG) revealed normal sinus rhythm and a Wolff– Parkinson– White pre-excitation pattern (Fig.1: Top), produced by a right-sided accessory pathway.\nTransthoracic echocardiography demonstrated the presence of Ebstein's anomaly of the tricuspid valve, with apical displacement of the valve and formation of an “atrialized” right ventricle (a functional unit between the right atrium and the inlet [inflow] portion of the right ventricle) (Fig.2).\nThe anterior tricuspid valve leaflet was elongated (Fig.2C, arrow), whereas the septal leaflet was rudimentary (Fig.2C, arrowhead).\nContrast echocardiography using saline revealed a patent foramen ovale with right-to-left shunting and bubbles in the left atrium (Fig.2D).\nThe patient underwent an electrophysiologic study with mapping of the accessory pathway, followed by radiofrequency ablation (interruption of the pathway using the heat generated by electromagnetic waves at the tip of an ablation catheter).\nHis post-ablation ECG showed a prolonged PR interval and an odd “second” QRS complex in leads III, aVF and V2–V4 (Fig.1Bottom), a consequence of abnormal impulse conduction in the “atrialized” right ventricle.\nThe patient reported no recurrence of palpitations at follow-up 6 months after the ablation.\n",
'ner_info': [
{
'text': '28-year-old',
'label': 'AGE',
'start': 8,
'end': 19
},
{'text': 'previously healthy', 'label': 'HISTORY', 'start': 20, 'end': 38}, {'text': 'man', 'label': 'SEX', 'start': 39, 'end': 42}, {'text': 'presented', 'label': 'CLINICAL_EVENT', 'start': 43, 'end': 52}, {'text': '6-week', 'label': 'DURATION', 'start': 60, 'end': 66}, {'text': 'palpitations', 'label': 'SIGN_SYMPTOM', 'start': 78, 'end': 90}, {'text': 'symptoms', 'label': 'COREFERENCE', 'start': 96, 'end': 104}, {'text': 'rest', 'label': 'CLINICAL_EVENT', 'start': 121, 'end': 125}, {'text': '2–3 times per week', 'label': 'FREQUENCY', 'start': 127, 'end': 145}, {'text': 'up to 30 minutes at a time', 'label': 'DETAILED_DESCRIPTION', 'start': 154, 'end': 180}, {'text': 'dyspnea', 'label': 'SIGN_SYMPTOM', 'start': 206, 'end': 213}, {'text': 'grade 2/6', 'label': 'LAB_VALUE', 'start': 228, 'end': 237}, {'text': 'holosystolic', 'label': 'DETAILED_DESCRIPTION', 'start': 238, 'end': 250}, {'text': 'tricuspid', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 251, 'end': 260}, {'text': 'regurgitation murmur', 'label': 'SIGN_SYMPTOM', 'start': 261, 'end': 281}, {'text': 'left sternal border', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 301, 'end': 320}, {'text': 'inspiratory accentuation', 'label': 'DETAILED_DESCRIPTION', 'start': 326, 'end': 350}, {'text': 'physical examination', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 353, 'end': 373}, {'text': 'unremarkable', 'label': 'LAB_VALUE', 'start': 382, 'end': 394}, {'text': 'electrocardiogram', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 408, 'end': 425}, {'text': 'ECG', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 427, 'end': 430}, {'text': 'normal', 'label': 'LAB_VALUE', 'start': 441, 'end': 447}, {'text': 'sinus rhythm', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 448, 'end': 460}, {'text': 'Wolff– Parkinson– White pre-excitation pattern', 'label': 'SIGN_SYMPTOM', 'start': 467, 'end': 513}, {'text': 'right-sided', 'label': 'DETAILED_DESCRIPTION', 'start': 542, 'end': 553}, {'text': 'accessory pathway', 'label': 'DISEASE_DISORDER', 'start': 554, 'end': 571}, {'text': 'Transthoracic', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 573, 'end': 586}, {'text': 'echocardiography', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 587, 'end': 603}, {'text': "Ebstein's anomaly", 'label': 'DISEASE_DISORDER', 'start': 633, 'end': 650}, {'text': 'tricuspid valve', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 658, 'end': 673}, {'text': 'apical displacement', 'label': 'SIGN_SYMPTOM', 'start': 680, 'end': 699}, {'text': 'valve', 'label': 'COREFERENCE', 'start': 707, 'end': 712}, {'text': 'atrialized', 'label': 'DISEASE_DISORDER', 'start': 734, 'end': 744}, {'text': 'right ventricle', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 746, 'end': 761}, {'text': 'right atrium', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 793, 'end': 805}, {'text': 'inlet', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 814, 'end': 819}, {'text': 'right ventricle', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 844, 'end': 859}, {'text': 'anterior tricuspid valve leaflet', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 874, 'end': 906}, {'text': 'elongated', 'label': 'SIGN_SYMPTOM', 'start': 911, 'end': 920}, {'text': 'septal leaflet', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 950, 'end': 964}, {'text': 'rudimentary', 'label': 'SIGN_SYMPTOM', 'start': 969, 'end': 980}, {'text': 'Contrast', 'label': 'DETAILED_DESCRIPTION', 'start': 1002, 'end': 1010}, {'text': 'echocardiography', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 1011, 'end': 1027}, {'text': 'using saline', 'label': 'DETAILED_DESCRIPTION', 'start': 1028, 'end': 1040}, {'text': 'patent foramen ovale', 'label': 'DISEASE_DISORDER', 'start': 1052, 'end': 1072}, {'text': 'right-to-left shunting', 'label': 'SIGN_SYMPTOM', 'start': 1078, 'end': 1100}, {'text': 'bubbles', 'label': 'SIGN_SYMPTOM', 'start': 1105, 'end': 1112}, {'text': 'left atrium', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 1120, 'end': 1131}, {'text': 'electrophysiologic study', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 1167, 'end': 1191}, {'text': 'mapping', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 1197, 'end': 1204}, {'text': 'accessory pathway', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 1212, 'end': 1229}, {'text': 'radiofrequency', 'label': 'DETAILED_DESCRIPTION', 'start': 1243, 'end': 1257}, {'text': 'ablation', 'label': 'THERAPEUTIC_PROCEDURE', 'start': 1258, 'end': 1266}, {'text': 'ablation catheter', 'label': 'THERAPEUTIC_PROCEDURE', 'start': 1363, 'end': 1380}, {'text': 'ECG', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 1401, 'end': 1404}, {'text': 'prolonged', 'label': 'LAB_VALUE', 'start': 1414, 'end': 1423}, {'text': 'PR interval', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 1424, 'end': 1435}, {'text': 'odd', 'label': 'LAB_VALUE', 'start': 1443, 'end': 1446}, {'text': '“second”', 'label': 'LAB_VALUE', 'start': 1447, 'end': 1455}, {'text': 'QRS complex', 'label': 'DIAGNOSTIC_PROCEDURE', 'start': 1456, 'end': 1467}, {'text': 'leads III, aVF and V2–V4', 'label': 'DETAILED_DESCRIPTION', 'start': 1471, 'end': 1495}, {'text': 'abnormal impulse conduction', 'label': 'DISEASE_DISORDER', 'start': 1528, 'end': 1555}, {'text': 'atrialized', 'label': 'DISEASE_DISORDER', 'start': 1564, 'end': 1574}, {'text': 'right ventricle', 'label': 'BIOLOGICAL_STRUCTURE', 'start': 1576, 'end': 1591}, {'text': 'palpitations', 'label': 'SIGN_SYMPTOM', 'start': 1631, 'end': 1643}, {'text': 'follow-up', 'label': 'CLINICAL_EVENT', 'start': 1647, 'end': 1656}, {'text': '6 months after', 'label': 'DATE', 'start': 1657, 'end': 1671}],
'tokens': ['CASE: A ', '28-year-old', ' ', 'previously healthy', ' ', 'man', ' ', 'presented', ' with a ', '6-week', ' history of ', 'palpitations', '.\nThe ', 'symptoms', ' occurred during ', 'rest', ', ', '2–3 times per week', ', lasted ', 'up to 30 minutes at a time', ' and were associated with ', 'dyspnea', '.\nExcept for a ', 'grade 2/6', ' ', 'holosystolic', ' ', 'tricuspid', ' ', 'regurgitation murmur', ' (best heard at the ', 'left sternal border', ' with ', 'inspiratory accentuation', '), ', 'physical examination', ' yielded ', 'unremarkable', ' findings.\nAn ', 'electrocardiogram', ' (', 'ECG', ') revealed ', 'normal', ' ', 'sinus rhythm', ' and a ', 'Wolff– Parkinson– White pre-excitation pattern', ' (Fig.1: Top), produced by a ', 'right-sided', ' ', 'accessory pathway', '.\n', 'Transthoracic', ' ', 'echocardiography', ' demonstrated the presence of ', "Ebstein's anomaly", ' of the ', 'tricuspid valve', ', with ', 'apical displacement', ' of the ', 'valve', ' and formation of an “', 'atrialized', '” ', 'right ventricle', ' (a functional unit between the ', 'right atrium', ' and the ', 'inlet', ' [inflow] portion of the ', 'right ventricle', ') (Fig.2).\nThe ', 'anterior tricuspid valve leaflet', ' was ', 'elongated', ' (Fig.2C, arrow), whereas the ', 'septal leaflet', ' was ', 'rudimentary', ' (Fig.2C, arrowhead).\n', 'Contrast', ' ', 'echocardiography', ' ', 'using saline', ' revealed a ', 'patent foramen ovale', ' with ', 'right-to-left shunting', ' and ', 'bubbles', ' in the ', 'left atrium', ' (Fig.2D).\nThe patient underwent an ', 'electrophysiologic study', ' with ', 'mapping', ' of the ', 'accessory pathway', ', followed by ', 'radiofrequency', ' ', 'ablation', ' (interruption of the pathway using the heat generated by electromagnetic waves at the tip of an ', 'ablation catheter', ').\nHis post-ablation ', 'ECG', ' showed a ', 'prolonged', ' ', 'PR interval', ' and an ', 'odd', ' ', '“second”', ' ', 'QRS complex', ' in ', 'leads III, aVF and V2–V4', ' (Fig.1Bottom), a consequence of ', 'abnormal impulse conduction', ' in the “', 'atrialized', '” ', 'right ventricle', '.\nThe patient reported no recurrence of ', 'palpitations', ' at ', 'follow-up', ' ', '6 months after', ' the ablation.\n'],
'ner_labels': [0, 5, 0, 39, 0, 65, 0, 13, 0, 32, 0, 69, 0, 18, 0, 13, 0, 35, 0, 22, 0, 69, 0, 42, 0, 22, 0, 12, 0, 69, 0, 12, 0, 22, 0, 24, 0, 42, 0, 24, 0, 24, 0, 42, 0, 24, 0, 69, 0, 22, 0, 26, 0, 12, 0, 24, 0, 26, 0, 12, 0, 69, 0, 18, 0, 26, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 69, 0, 12, 0, 69, 0, 22, 0, 24, 0, 22, 0, 26, 0, 69, 0, 69, 0, 12, 0, 24, 0, 24, 0, 12, 0, 22, 0, 75, 0, 75, 0, 24, 0, 42, 0, 24, 0, 42, 0, 42, 0, 24, 0, 22, 0, 26, 0, 26, 0, 12, 0, 69, 0, 13, 0, 19, 0]}
Dataset Creation
Data Collection and Processing
[More Information Needed]
BibTeX:
{
article= Caufield2020,
author = "J. Harry Caufield",
title = "{MACCROBAT}",
year = "2020",
month = "1",
url = "https://figshare.com/articles/dataset/MACCROBAT2018/9764942",
doi = "10.6084/m9.figshare.9764942.v2"
}