Convert dataset to Parquet

#1
by SaylorTwift HF Staff - opened
README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ dataset_info:
3
+ - config_name: healthcaremagic
4
+ features:
5
+ - name: tgt
6
+ dtype: string
7
+ - name: src
8
+ dtype: string
9
+ - name: id
10
+ dtype: int64
11
+ splits:
12
+ - name: train
13
+ num_bytes: 190539493
14
+ num_examples: 181122
15
+ - name: validation
16
+ num_bytes: 23782271
17
+ num_examples: 22641
18
+ - name: test
19
+ num_bytes: 23813362
20
+ num_examples: 22642
21
+ download_size: 147248621
22
+ dataset_size: 238135126
23
+ - config_name: icliniq
24
+ features:
25
+ - name: tgt
26
+ dtype: string
27
+ - name: src
28
+ dtype: string
29
+ - name: id
30
+ dtype: int64
31
+ splits:
32
+ - name: train
33
+ num_bytes: 30971422
34
+ num_examples: 24851
35
+ - name: validation
36
+ num_bytes: 3819950
37
+ num_examples: 3105
38
+ - name: test
39
+ num_bytes: 3831220
40
+ num_examples: 3108
41
+ download_size: 15177985
42
+ dataset_size: 38622592
43
+ configs:
44
+ - config_name: healthcaremagic
45
+ data_files:
46
+ - split: train
47
+ path: healthcaremagic/train-*
48
+ - split: validation
49
+ path: healthcaremagic/validation-*
50
+ - split: test
51
+ path: healthcaremagic/test-*
52
+ - config_name: icliniq
53
+ data_files:
54
+ - split: train
55
+ path: icliniq/train-*
56
+ - split: validation
57
+ path: icliniq/validation-*
58
+ - split: test
59
+ path: icliniq/test-*
60
+ ---
healthcaremagic/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:496f41974e7b3b02cb249578d84cef6471e97cd2f146f5a2c6448b86f8d5bf0b
3
+ size 14726476
healthcaremagic/test.json DELETED
The diff for this file is too large to render. See raw diff
 
healthcaremagic/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c841e4195c48d124d34ebd3cc70adbdb9f0bc5c33b3fe98e1be9358120899a8d
3
+ size 117821940
healthcaremagic/train.json DELETED
Binary file (200 MB)
 
healthcaremagic/valid.json DELETED
The diff for this file is too large to render. See raw diff
 
healthcaremagic/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af00dd230260ad01be236897c2e629937e46cce5c728e35ce09a634e59c5a17c
3
+ size 14700205
icliniq/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5beaa488cd06e327165037113805f5c2deb1873b8827fc8e76560bc6633be27f
3
+ size 1495322
icliniq/test.json DELETED
The diff for this file is too large to render. See raw diff
 
icliniq/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c60e46419585e618b5180d1506dabc33f8b681371fc73135be99830387c69323
3
+ size 12180652
icliniq/train.json DELETED
The diff for this file is too large to render. See raw diff
 
icliniq/valid.json DELETED
The diff for this file is too large to render. See raw diff
 
icliniq/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d9daa583a88f6498490f8857b5abb0d84008a130c8ea352f0fdb8087603cd51
3
+ size 1502011
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