mariosasko commited on
Commit
4f4797b
1 Parent(s): 7cdf254

Make RedCaps streamable (again) (#3737)

Browse files

Commit from https://github.com/huggingface/datasets/commit/5f52561f6c35d4e3ccad87ff949a729b34d2d0d2

Files changed (3) hide show
  1. README.md +0 -0
  2. dataset_infos.json +1 -1
  3. evidence_infer_treatment.py +5 -5
README.md CHANGED
The diff for this file is too large to render. See raw diff
 
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"2.0": {"description": "Data and code from our \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.\n\nThe dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.\n\nThe dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.\n", "citation": "@inproceedings{lehman-etal-2019-inferring,\n title = \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\",\n author = \"Lehman, Eric and\n DeYoung, Jay and\n Barzilay, Regina and\n Wallace, Byron C.\",\n booktitle = \"Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)\",\n month = jun,\n year = \"2019\",\n address = \"Minneapolis, Minnesota\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/N19-1371\",\n pages = \"3705--3717\",\n}\n", "homepage": "https://github.com/jayded/evidence-inference", "license": "", "features": {"Text": {"dtype": "string", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Prompts": {"feature": {"PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Outcome": {"dtype": "string", "id": null, "_type": "Value"}, "Intervention": {"dtype": "string", "id": null, "_type": "Value"}, "Comparator": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"feature": {"UserID": {"dtype": "int32", "id": null, "_type": "Value"}, "PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Valid Label": {"dtype": "bool", "id": null, "_type": "Value"}, "Valid Reasoning": {"dtype": "bool", "id": null, "_type": "Value"}, "Label": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"dtype": "string", "id": null, "_type": "Value"}, "Label Code": {"dtype": "int32", "id": null, "_type": "Value"}, "In Abstract": {"dtype": "bool", "id": null, "_type": "Value"}, "Evidence Start": {"dtype": "int32", "id": null, "_type": "Value"}, "Evidence End": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "evidence_infer_treatment", "config_name": "2.0", "version": {"version_str": "2.0.0", "description": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 76408584, "num_examples": 2674, "dataset_name": "evidence_infer_treatment"}, "test": {"name": "test", "num_bytes": 9408156, "num_examples": 334, "dataset_name": "evidence_infer_treatment"}, "validation": {"name": "validation", "num_bytes": 10085622, "num_examples": 340, "dataset_name": "evidence_infer_treatment"}}, "download_checksums": {"http://evidence-inference.ebm-nlp.com/v2.0.tar.gz": {"num_bytes": 36528800, "checksum": "6abe0d4ec0d331834981c0171c3c79d47515761867f82f1dc6066e43863a1586"}}, "download_size": 36528800, "post_processing_size": null, "dataset_size": 95902362, "size_in_bytes": 132431162}, "1.1": {"description": "Data and code from our \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.\n\nThe dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.\n\nThe dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.\n", "citation": "@inproceedings{lehman-etal-2019-inferring,\n title = \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\",\n author = \"Lehman, Eric and\n DeYoung, Jay and\n Barzilay, Regina and\n Wallace, Byron C.\",\n booktitle = \"Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)\",\n month = jun,\n year = \"2019\",\n address = \"Minneapolis, Minnesota\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/N19-1371\",\n pages = \"3705--3717\",\n}\n", "homepage": "https://github.com/jayded/evidence-inference", "license": "", "features": {"Text": {"dtype": "string", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Prompts": {"feature": {"PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Outcome": {"dtype": "string", "id": null, "_type": "Value"}, "Intervention": {"dtype": "string", "id": null, "_type": "Value"}, "Comparator": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"feature": {"UserID": {"dtype": "int32", "id": null, "_type": "Value"}, "PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Valid Label": {"dtype": "bool", "id": null, "_type": "Value"}, "Valid Reasoning": {"dtype": "bool", "id": null, "_type": "Value"}, "Label": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"dtype": "string", "id": null, "_type": "Value"}, "Label Code": {"dtype": "int32", "id": null, "_type": "Value"}, "In Abstract": {"dtype": "bool", "id": null, "_type": "Value"}, "Evidence Start": {"dtype": "int32", "id": null, "_type": "Value"}, "Evidence End": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "evidence_infer_treatment", "config_name": "1.1", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 55361753, "num_examples": 1931, "dataset_name": "evidence_infer_treatment"}, "test": {"name": "test", "num_bytes": 6875650, "num_examples": 240, "dataset_name": "evidence_infer_treatment"}, "validation": {"name": "validation", "num_bytes": 7358118, "num_examples": 248, "dataset_name": "evidence_infer_treatment"}}, "download_checksums": {"https://github.com/jayded/evidence-inference/archive/v1.1.zip": {"num_bytes": 114452688, "checksum": "945a81cf40665cd797504728858da54dbb39e16a7785bda833f8d475a407a952"}}, "download_size": 114452688, "post_processing_size": null, "dataset_size": 69595521, "size_in_bytes": 184048209}}
 
1
+ {"2.0": {"description": "Data and code from our \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.\n\nThe dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.\n\nThe dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.\n", "citation": "@inproceedings{lehman-etal-2019-inferring,\n title = \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\",\n author = \"Lehman, Eric and\n DeYoung, Jay and\n Barzilay, Regina and\n Wallace, Byron C.\",\n booktitle = \"Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)\",\n month = jun,\n year = \"2019\",\n address = \"Minneapolis, Minnesota\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/N19-1371\",\n pages = \"3705--3717\",\n}\n", "homepage": "https://github.com/jayded/evidence-inference", "license": "", "features": {"Text": {"dtype": "string", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Prompts": {"feature": {"PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Outcome": {"dtype": "string", "id": null, "_type": "Value"}, "Intervention": {"dtype": "string", "id": null, "_type": "Value"}, "Comparator": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"feature": {"UserID": {"dtype": "int32", "id": null, "_type": "Value"}, "PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Valid Label": {"dtype": "bool", "id": null, "_type": "Value"}, "Valid Reasoning": {"dtype": "bool", "id": null, "_type": "Value"}, "Label": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"dtype": "string", "id": null, "_type": "Value"}, "Label Code": {"dtype": "int32", "id": null, "_type": "Value"}, "In Abstract": {"dtype": "bool", "id": null, "_type": "Value"}, "Evidence Start": {"dtype": "int32", "id": null, "_type": "Value"}, "Evidence End": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "evidence_infer_treatment", "config_name": "2.0", "version": {"version_str": "2.0.0", "description": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 77045294, "num_examples": 2690, "dataset_name": "evidence_infer_treatment"}, "test": {"name": "test", "num_bytes": 9436674, "num_examples": 334, "dataset_name": "evidence_infer_treatment"}, "validation": {"name": "validation", "num_bytes": 10113982, "num_examples": 340, "dataset_name": "evidence_infer_treatment"}}, "download_checksums": {"https://github.com/jayded/evidence-inference/archive/refs/tags/v2.0.zip": {"num_bytes": 163515689, "checksum": "89f99ff5030b4d8a110808c960c6721c1b1c7d4809b9a783d007b649bdfb43f9"}}, "download_size": 163515689, "post_processing_size": null, "dataset_size": 96595950, "size_in_bytes": 260111639}, "1.1": {"description": "Data and code from our \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.\n\nThe dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.\n\nThe dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.\n", "citation": "@inproceedings{lehman-etal-2019-inferring,\n title = \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\",\n author = \"Lehman, Eric and\n DeYoung, Jay and\n Barzilay, Regina and\n Wallace, Byron C.\",\n booktitle = \"Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)\",\n month = jun,\n year = \"2019\",\n address = \"Minneapolis, Minnesota\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/N19-1371\",\n pages = \"3705--3717\",\n}\n", "homepage": "https://github.com/jayded/evidence-inference", "license": "", "features": {"Text": {"dtype": "string", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Prompts": {"feature": {"PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Outcome": {"dtype": "string", "id": null, "_type": "Value"}, "Intervention": {"dtype": "string", "id": null, "_type": "Value"}, "Comparator": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"feature": {"UserID": {"dtype": "int32", "id": null, "_type": "Value"}, "PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Valid Label": {"dtype": "bool", "id": null, "_type": "Value"}, "Valid Reasoning": {"dtype": "bool", "id": null, "_type": "Value"}, "Label": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"dtype": "string", "id": null, "_type": "Value"}, "Label Code": {"dtype": "int32", "id": null, "_type": "Value"}, "In Abstract": {"dtype": "bool", "id": null, "_type": "Value"}, "Evidence Start": {"dtype": "int32", "id": null, "_type": "Value"}, "Evidence End": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "evidence_infer_treatment", "config_name": "1.1", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 55375971, "num_examples": 1931, "dataset_name": "evidence_infer_treatment"}, "test": {"name": "test", "num_bytes": 6877338, "num_examples": 240, "dataset_name": "evidence_infer_treatment"}, "validation": {"name": "validation", "num_bytes": 7359847, "num_examples": 248, "dataset_name": "evidence_infer_treatment"}}, "download_checksums": {"https://github.com/jayded/evidence-inference/archive/v1.1.zip": {"num_bytes": 114452688, "checksum": "945a81cf40665cd797504728858da54dbb39e16a7785bda833f8d475a407a952"}}, "download_size": 114452688, "post_processing_size": null, "dataset_size": 69613156, "size_in_bytes": 184065844}}
evidence_infer_treatment.py CHANGED
@@ -140,28 +140,28 @@ class EvidenceInferTreatment(datasets.GeneratorBasedBuilder):
140
  SPLITS = {}
141
  for split in ["train", "test", "validation"]:
142
  filename = os.path.join(dl_dir, "splits", f"{split}_article_ids.txt")
143
- with open(filename, "r", encoding="utf-8") as f:
144
  for line in f:
145
  id_ = int(line.strip())
146
  SPLITS[id_] = split
147
 
148
  ALL_PROMPTS = {}
149
  prompts_filename = os.path.join(dl_dir, "prompts_merged.csv")
150
- with open(prompts_filename, "r", encoding="utf-8") as f:
151
  data = csv.DictReader(f)
152
  for item in data:
153
  prompt_id = int(item["PromptID"])
154
  ALL_PROMPTS[prompt_id] = {"Prompt": item, "Annotations": []}
155
 
156
  annotations_filename = os.path.join(dl_dir, "annotations_merged.csv")
157
- with open(annotations_filename, "r", encoding="utf-8") as f:
158
  data = csv.DictReader(f)
159
  for item in data:
160
  prompt_id = int(item["PromptID"])
161
-
 
162
  if "Annotations" not in ALL_PROMPTS[prompt_id]:
163
  ALL_PROMPTS[prompt_id]["Annotations"] = []
164
-
165
  ALL_PROMPTS[prompt_id]["Annotations"].append(item)
166
 
167
  # Simplify everything
 
140
  SPLITS = {}
141
  for split in ["train", "test", "validation"]:
142
  filename = os.path.join(dl_dir, "splits", f"{split}_article_ids.txt")
143
+ with open(filename, encoding="utf-8") as f:
144
  for line in f:
145
  id_ = int(line.strip())
146
  SPLITS[id_] = split
147
 
148
  ALL_PROMPTS = {}
149
  prompts_filename = os.path.join(dl_dir, "prompts_merged.csv")
150
+ with open(prompts_filename, encoding="utf-8") as f:
151
  data = csv.DictReader(f)
152
  for item in data:
153
  prompt_id = int(item["PromptID"])
154
  ALL_PROMPTS[prompt_id] = {"Prompt": item, "Annotations": []}
155
 
156
  annotations_filename = os.path.join(dl_dir, "annotations_merged.csv")
157
+ with open(annotations_filename, encoding="utf-8") as f:
158
  data = csv.DictReader(f)
159
  for item in data:
160
  prompt_id = int(item["PromptID"])
161
+ if "" in item: # Remove unnamed column with row index value
162
+ del item[""]
163
  if "Annotations" not in ALL_PROMPTS[prompt_id]:
164
  ALL_PROMPTS[prompt_id]["Annotations"] = []
 
165
  ALL_PROMPTS[prompt_id]["Annotations"].append(item)
166
 
167
  # Simplify everything