Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
albertvillanova HF staff commited on
Commit
7882f9a
1 Parent(s): 39d6ce3
Files changed (1) hide show
  1. ask_a_patient.py +11 -15
ask_a_patient.py CHANGED
@@ -17,14 +17,12 @@ import os
17
 
18
  import datasets
19
 
20
- from .bigbiohub import kb_features
21
- from .bigbiohub import BigBioConfig
22
- from .bigbiohub import Tasks
23
 
24
  _DATASETNAME = "ask_a_patient"
25
  _DISPLAYNAME = "AskAPatient"
26
 
27
- _LANGUAGES = ['English']
28
  _PUBMED = True
29
  _LOCAL = False
30
  _CITATION = """
@@ -50,7 +48,7 @@ mapped to how they are formally written in medical ontologies (SNOMED-CT and AMT
50
 
51
  _HOMEPAGE = "https://zenodo.org/record/55013"
52
 
53
- _LICENSE = 'Creative Commons Attribution 4.0 International'
54
 
55
  _URLs = "https://zenodo.org/record/55013/files/datasets.zip"
56
 
@@ -124,10 +122,10 @@ class AskAPatient(datasets.GeneratorBasedBuilder):
124
  def _generate_examples(self, filepath, split_id):
125
  with open(filepath, "r", encoding="latin-1") as f:
126
  for i, line in enumerate(f):
127
- id = f"{split_id}_{i}"
128
  cui, medical_concept, social_media_text = line.strip().split("\t")
129
  if self.config.schema == "source":
130
- yield id, {
131
  "cui": cui,
132
  "medical_concept": medical_concept,
133
  "social_media_text": social_media_text,
@@ -135,12 +133,12 @@ class AskAPatient(datasets.GeneratorBasedBuilder):
135
  elif self.config.schema == "bigbio_kb":
136
  text_type = "social_media_text"
137
  offset = (0, len(social_media_text))
138
- yield id, {
139
- "id": id,
140
- "document_id": id,
141
  "passages": [
142
  {
143
- "id": f"{id}_passage",
144
  "type": text_type,
145
  "text": [social_media_text],
146
  "offsets": [offset],
@@ -148,13 +146,11 @@ class AskAPatient(datasets.GeneratorBasedBuilder):
148
  ],
149
  "entities": [
150
  {
151
- "id": f"{id}_entity",
152
  "type": text_type,
153
  "text": [social_media_text],
154
  "offsets": [offset],
155
- "normalized": [
156
- {"db_name": "SNOMED-CT|AMT", "db_id": cui}
157
- ],
158
  }
159
  ],
160
  "events": [],
 
17
 
18
  import datasets
19
 
20
+ from .bigbiohub import BigBioConfig, Tasks, kb_features
 
 
21
 
22
  _DATASETNAME = "ask_a_patient"
23
  _DISPLAYNAME = "AskAPatient"
24
 
25
+ _LANGUAGES = ["English"]
26
  _PUBMED = True
27
  _LOCAL = False
28
  _CITATION = """
 
48
 
49
  _HOMEPAGE = "https://zenodo.org/record/55013"
50
 
51
+ _LICENSE = "Creative Commons Attribution 4.0 International"
52
 
53
  _URLs = "https://zenodo.org/record/55013/files/datasets.zip"
54
 
 
122
  def _generate_examples(self, filepath, split_id):
123
  with open(filepath, "r", encoding="latin-1") as f:
124
  for i, line in enumerate(f):
125
+ uid = f"{split_id}_{i}"
126
  cui, medical_concept, social_media_text = line.strip().split("\t")
127
  if self.config.schema == "source":
128
+ yield uid, {
129
  "cui": cui,
130
  "medical_concept": medical_concept,
131
  "social_media_text": social_media_text,
 
133
  elif self.config.schema == "bigbio_kb":
134
  text_type = "social_media_text"
135
  offset = (0, len(social_media_text))
136
+ yield uid, {
137
+ "id": uid,
138
+ "document_id": uid,
139
  "passages": [
140
  {
141
+ "id": f"{uid}_passage",
142
  "type": text_type,
143
  "text": [social_media_text],
144
  "offsets": [offset],
 
146
  ],
147
  "entities": [
148
  {
149
+ "id": f"{uid}_entity",
150
  "type": text_type,
151
  "text": [social_media_text],
152
  "offsets": [offset],
153
+ "normalized": [{"db_name": "SNOMED-CT|AMT", "db_id": cui}],
 
 
154
  }
155
  ],
156
  "events": [],