ygorg commited on
Commit
665baf2
·
verified ·
1 Parent(s): fc5baf4

Delete loading script

Browse files
Files changed (1) hide show
  1. DiaMED.py +0 -167
DiaMED.py DELETED
@@ -1,167 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """DIAMED"""
16
-
17
- import os
18
- import json
19
- import math
20
-
21
- import datasets
22
-
23
- _DESCRIPTION = """\
24
- DIAMED
25
- """
26
-
27
- _HOMEPAGE = "DIAMED"
28
-
29
- _LICENSE = "Apache License 2.0"
30
-
31
- _URL = "https://huggingface.co/datasets/Dr-BERT/DiaMED/resolve/main/data.zip"
32
-
33
- _CITATION = """\
34
- DIAMED
35
- """
36
-
37
- class DiaMed(datasets.GeneratorBasedBuilder):
38
- """DIAMED"""
39
-
40
- VERSION = datasets.Version("1.0.0")
41
-
42
- BUILDER_CONFIGS = [
43
- datasets.BuilderConfig(name=f"default", version="1.0.0", description=f"DiaMED data"),
44
- ]
45
-
46
- DEFAULT_CONFIG_NAME = "default"
47
-
48
- def _info(self):
49
-
50
- features = datasets.Features(
51
- {
52
- "identifier": datasets.Value("string"),
53
- "title": datasets.Value("string"),
54
- "clinical_case": datasets.Value("string"),
55
- "topic": datasets.Value("string"),
56
- "keywords": datasets.Sequence(
57
- datasets.Value("string"),
58
- ),
59
- "domains": datasets.Sequence(
60
- datasets.Value("string"),
61
- ),
62
- "collected_at": datasets.Value("string"),
63
- "published_at": datasets.Value("string"),
64
- "source_url": datasets.Value("string"),
65
- "source_name": datasets.Value("string"),
66
- "license": datasets.Value("string"),
67
- "figures_urls": datasets.Sequence(
68
- datasets.Value("string"),
69
- ),
70
- "figures_paths": datasets.Sequence(
71
- datasets.Value("string"),
72
- ),
73
- "figures": datasets.Sequence(
74
- datasets.Image(),
75
- ),
76
- "icd-10": datasets.features.ClassLabel(names=[
77
- 'A00-B99 Certain infectious and parasitic diseases',
78
- 'C00-D49 Neoplasms',
79
- 'D50-D89 Diseases of the blood and blood-forming organs and certain disorders involving the immune mechanism',
80
- 'E00-E89 Endocrine, nutritional and metabolic diseases',
81
- 'F01-F99 Mental, Behavioral and Neurodevelopmental disorders',
82
- 'G00-G99 Diseases of the nervous system',
83
- 'H00-H59 Diseases of the eye and adnexa',
84
- 'H60-H95 Diseases of the ear and mastoid process',
85
- 'I00-I99 Diseases of the circulatory system',
86
- 'J00-J99 Diseases of the respiratory system',
87
- 'K00-K95 Diseases of the digestive system',
88
- 'L00-L99 Diseases of the skin and subcutaneous tissue',
89
- 'M00-M99 Diseases of the musculoskeletal system and connective tissue',
90
- 'N00-N99 Diseases of the genitourinary system',
91
- 'O00-O9A Pregnancy, childbirth and the puerperium',
92
- 'P00-P96 Certain conditions originating in the perinatal period',
93
- 'Q00-Q99 Congenital malformations, deformations and chromosomal abnormalities',
94
- 'R00-R99 Symptoms, signs and abnormal clinical and laboratory findings, not elsewhere classified',
95
- 'S00-T88 Injury, poisoning and certain other consequences of external causes',
96
- 'U00-U85 Codes for special purposes',
97
- 'V00-Y99 External causes of morbidity',
98
- 'Z00-Z99 Factors influencing health status and contact with health services',
99
- ]),
100
- }
101
- )
102
-
103
- return datasets.DatasetInfo(
104
- description=_DESCRIPTION,
105
- features=features,
106
- homepage=_HOMEPAGE,
107
- license=_LICENSE,
108
- citation=_CITATION,
109
- )
110
-
111
- def _split_generators(self, dl_manager):
112
- """Returns SplitGenerators."""
113
-
114
- data_dir = dl_manager.download_and_extract(_URL)
115
-
116
- return [
117
- datasets.SplitGenerator(
118
- name=datasets.Split.TRAIN,
119
- gen_kwargs={
120
- "base_path": data_dir,
121
- "filepath": data_dir + "/splits/train.json",
122
- },
123
- ),
124
- datasets.SplitGenerator(
125
- name=datasets.Split.VALIDATION,
126
- gen_kwargs={
127
- "base_path": data_dir,
128
- "filepath": data_dir + "/splits/validation.json",
129
- },
130
- ),
131
- datasets.SplitGenerator(
132
- name=datasets.Split.TEST,
133
- gen_kwargs={
134
- "base_path": data_dir,
135
- "filepath": data_dir + "/splits/test.json",
136
- },
137
- ),
138
- ]
139
-
140
- def _generate_examples(self, base_path, filepath):
141
-
142
- with open(filepath, encoding="utf-8") as f:
143
-
144
- data = json.load(f)
145
-
146
- for key, d in enumerate(data):
147
-
148
- if str(d["icd-10"]) == "nan" or d["icd-10"].find("Plusieurs cas cliniques") != -1 or d["icd-10"].find("Aucune annotation") != -1:
149
- continue
150
-
151
- yield key, {
152
- "identifier": d["identifier"],
153
- "title": d["title"],
154
- "clinical_case": d["clinical_case"],
155
- "topic": d["topic"],
156
- "keywords": d["keywords"],
157
- "domains": d["domain"],
158
- "collected_at": d["collected_at"],
159
- "published_at": d["published_at"],
160
- "source_url": d["source_url"],
161
- "source_name": d["source_name"],
162
- "license": d["license"],
163
- "figures_urls": d["figures"],
164
- "figures": [base_path + fg.lstrip(".") for fg in d["local_figures"]],
165
- "figures_paths": [base_path + fg.lstrip(".") for fg in d["local_figures"]],
166
- "icd-10": d["icd-10"],
167
- }