Delete loading script
Browse files- med_dialog.py +0 -148
med_dialog.py
DELETED
|
@@ -1,148 +0,0 @@
|
|
| 1 |
-
import datasets
|
| 2 |
-
import os
|
| 3 |
-
import json
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
_CITATION = """
|
| 7 |
-
@article{chen2020meddiag,
|
| 8 |
-
title={MedDialog: a large-scale medical dialogue dataset},
|
| 9 |
-
author={Chen, Shu and Ju, Zeqian and Dong, Xiangyu and Fang, Hongchao and Wang, Sicheng and Yang, Yue and Zeng,
|
| 10 |
-
Jiaqi and Zhang, Ruisi and Zhang, Ruoyu and Zhou, Meng and Zhu, Penghui and Xie, Pengtao},
|
| 11 |
-
journal={arXiv preprint arXiv:2004.03329},
|
| 12 |
-
year={2020}
|
| 13 |
-
}
|
| 14 |
-
"""
|
| 15 |
-
|
| 16 |
-
_DESCRIPTION = """
|
| 17 |
-
"The MedDialog dataset (English) contains conversations between doctors and patients.
|
| 18 |
-
It has 0.26 million dialogues. The data is continuously growing and more dialogues will be added.
|
| 19 |
-
The raw dialogues are from healthcaremagic.com and icliniq.com. All copyrights of the data belong
|
| 20 |
-
to healthcaremagic.com and icliniq.com."
|
| 21 |
-
|
| 22 |
-
The following is an example from the healthcaremagic.com subset:
|
| 23 |
-
|
| 24 |
-
Patient: I get cramps on top of my left forearm and hand and it causes my hand and fingers to draw up and it
|
| 25 |
-
hurts. It mainly does this when I bend my arm. I ve been told that I have a slight pinch in a nerve in my neck.
|
| 26 |
-
Could this be a cause? I don t think so. Doctor: Hi there. It may sound difficult to believe it ,but the nerves
|
| 27 |
-
which supply your forearms and hand, start at the level of spinal cord and on their way towards the forearm and
|
| 28 |
-
hand regions which they supply, the course of these nerves pass through difference fascial and muscular planes
|
| 29 |
-
that can make them susceptible to entrapment neuropathies. Its a group of conditions where a nerve gets
|
| 30 |
-
compressed between a muscle and a bone, or between the fibers of a muscle that it pierces or passes through.
|
| 31 |
-
Also, the compression can happen when the nerves are travelling around a blood vessel which can mechanically put
|
| 32 |
-
pressure on them. Usually patients who would be having such a problem present with a dull aching pain over the
|
| 33 |
-
arm and forearm. If it is not too severe and does not cause any neurological deficits then conservative management
|
| 34 |
-
with Pregabalin and Vitamin B complex tablets, activity modifications and physiotherapy can be started which
|
| 35 |
-
will provide relief. Avoid the activities which exaggerate your problem.
|
| 36 |
-
|
| 37 |
-
Could painful forearms be related to pinched nerve in neck?
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
The following is an example from the icliniq.com subset:
|
| 41 |
-
|
| 42 |
-
Patient: Hello doctor, We are looking for a second opinion on my friend's MRI scan of both the knee joints as he
|
| 43 |
-
is experiencing excruciating pain just above the patella. He has a sudden onset of severe pain on both the knee
|
| 44 |
-
joints about two weeks ago. Previously he had a similar episode about two to three months ago and it subsided
|
| 45 |
-
after resting and painkillers. Doctor: Hi. I viewed the right and left knee MRI images. (attachment removed to
|
| 46 |
-
protect patient identity). Left knee: The MRI, left knee joint shows a complex tear in the posterior horn of the
|
| 47 |
-
medial meniscus area and mild left knee joint effusion. There is some fluid between the semimembranous and medial
|
| 48 |
-
head of gastrocnemius muscles. There is a small area of focal cartilage defect in the upper pole of the patella
|
| 49 |
-
with mild edematous fat. The anterior and posterior cruciate ligaments are normal. The medial and lateral
|
| 50 |
-
collateral ligaments are normal. Right knee: The right knee joint shows mild increased signal intensity in the
|
| 51 |
-
posterior horn of the medial meniscus area and minimal knee joint effusion. There is minimal fluid in the back
|
| 52 |
-
of the lower thigh and not significant. There is a suspicious strain in the left anterior cruciate ligament
|
| 53 |
-
interiorly but largely the attachments are normal. The posterior cruciate ligament is normal. There are subtle
|
| 54 |
-
changes in the upper pole area of the right patella and mild edema. There is mild edema around the bilateral
|
| 55 |
-
distal quadriceps tendons, but there is no obvious tear of the tendons.
|
| 56 |
-
|
| 57 |
-
My friend has excruciating knee pain. Please interpret his MRI report
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
Paper: https://arxiv.org/abs/2004.03329
|
| 61 |
-
Code: https://github.com/UCSD-AI4H/Medical-Dialogue-System
|
| 62 |
-
|
| 63 |
-
@article{chen2020meddiag,
|
| 64 |
-
title={MedDialog: a large-scale medical dialogue dataset},
|
| 65 |
-
author={Chen, Shu and Ju, Zeqian and Dong, Xiangyu and Fang, Hongchao and Wang, Sicheng and Yang, Yue and Zeng,
|
| 66 |
-
Jiaqi and Zhang, Ruisi and Zhang, Ruoyu and Zhou, Meng and Zhu, Penghui and Xie, Pengtao},
|
| 67 |
-
journal={arXiv preprint arXiv:2004.03329},
|
| 68 |
-
year={2020}
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
We used the data preprocessing from "BioBART: Pretraining and Evaluation o A Biomedical Generative Language Model"
|
| 72 |
-
(Yuan et al.) and generated the following splits:
|
| 73 |
-
|
| 74 |
-
|Dataset | Train | Valid | Test |
|
| 75 |
-
|--------------- |------------|---------|--------|
|
| 76 |
-
|HealthCareMagic | 181,122 | 22,641 | 22,642 |
|
| 77 |
-
|iCliniq | 24,851 | 3,105 | 3,108 |
|
| 78 |
-
|
| 79 |
-
Yuan et al. described, "HealthCareMagic's summaries are more abstractive and are written in a formal style,
|
| 80 |
-
unlike iCliniq's patient-written summaries."
|
| 81 |
-
|
| 82 |
-
Paper: https://arxiv.org/abs/2204.03905
|
| 83 |
-
Code: https://github.com/GanjinZero/BioBART
|
| 84 |
-
|
| 85 |
-
@misc{https://doi.org/10.48550/arxiv.2204.03905,
|
| 86 |
-
doi = {10.48550/ARXIV.2204.03905},
|
| 87 |
-
url = {https://arxiv.org/abs/2204.03905},
|
| 88 |
-
author = {Yuan, Hongyi and Yuan, Zheng and Gan, Ruyi and Zhang, Jiaxing and Xie, Yutao and Yu, Sheng},
|
| 89 |
-
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences,
|
| 90 |
-
FOS: Computer and information sciences},
|
| 91 |
-
title = {BioBART: Pretraining and Evaluation of A Biomedical Generative Language Model},
|
| 92 |
-
publisher = {arXiv},
|
| 93 |
-
year = {2022},
|
| 94 |
-
copyright = {arXiv.org perpetual, non-exclusive license}
|
| 95 |
-
}
|
| 96 |
-
"""
|
| 97 |
-
|
| 98 |
-
class MedDialog(datasets.GeneratorBasedBuilder):
|
| 99 |
-
VERSION = datasets.Version("1.0.0")
|
| 100 |
-
|
| 101 |
-
BUILDER_CONFIGS = [
|
| 102 |
-
datasets.BuilderConfig(name=name, version=datasets.Version("1.0.0"), description=_DESCRIPTION)
|
| 103 |
-
for name in ["healthcaremagic", "icliniq"]
|
| 104 |
-
]
|
| 105 |
-
|
| 106 |
-
def _info(self):
|
| 107 |
-
features = datasets.Features(
|
| 108 |
-
{
|
| 109 |
-
"tgt": datasets.Value("string"),
|
| 110 |
-
"src": datasets.Value("string"),
|
| 111 |
-
"id": datasets.Value("int64"),
|
| 112 |
-
|
| 113 |
-
}
|
| 114 |
-
)
|
| 115 |
-
return datasets.DatasetInfo(
|
| 116 |
-
description=_DESCRIPTION,
|
| 117 |
-
features=features,
|
| 118 |
-
homepage="",
|
| 119 |
-
license="",
|
| 120 |
-
citation=_CITATION,
|
| 121 |
-
)
|
| 122 |
-
|
| 123 |
-
def _split_generators(self, dl_manager):
|
| 124 |
-
train_json = dl_manager.download(os.path.join(self.config.name, "train.json"))
|
| 125 |
-
valid_json = dl_manager.download(os.path.join(self.config.name, "valid.json"))
|
| 126 |
-
test_json = dl_manager.download(os.path.join(self.config.name, "test.json"))
|
| 127 |
-
|
| 128 |
-
return [
|
| 129 |
-
datasets.SplitGenerator(
|
| 130 |
-
name=datasets.Split.TRAIN,
|
| 131 |
-
gen_kwargs={"path": train_json},
|
| 132 |
-
),
|
| 133 |
-
datasets.SplitGenerator(
|
| 134 |
-
name=datasets.Split.VALIDATION,
|
| 135 |
-
gen_kwargs={"path": valid_json},
|
| 136 |
-
),
|
| 137 |
-
datasets.SplitGenerator(
|
| 138 |
-
name=datasets.Split.TEST,
|
| 139 |
-
gen_kwargs={"path": test_json},
|
| 140 |
-
)
|
| 141 |
-
]
|
| 142 |
-
|
| 143 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 144 |
-
def _generate_examples(self, path):
|
| 145 |
-
with open(path, encoding="utf-8") as f:
|
| 146 |
-
file = json.load(f)
|
| 147 |
-
for key, row in enumerate(file["data"]):
|
| 148 |
-
yield key, row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|