minidiablo05 AGBonnet commited on
Commit
8a51e7b
·
0 Parent(s):

Duplicate from AGBonnet/augmented-clinical-notes

Browse files

Co-authored-by: Antoine Bonnet <AGBonnet@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pickle filter=lfs diff=lfs merge=lfs -text
22
+ *.pkl filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar filter=lfs diff=lfs merge=lfs -text
30
+ *.tflite filter=lfs diff=lfs merge=lfs -text
31
+ *.tgz filter=lfs diff=lfs merge=lfs -text
32
+ *.wasm filter=lfs diff=lfs merge=lfs -text
33
+ *.xz filter=lfs diff=lfs merge=lfs -text
34
+ *.zip filter=lfs diff=lfs merge=lfs -text
35
+ *.zst filter=lfs diff=lfs merge=lfs -text
36
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
37
+ # Audio files - uncompressed
38
+ *.pcm filter=lfs diff=lfs merge=lfs -text
39
+ *.sam filter=lfs diff=lfs merge=lfs -text
40
+ *.raw filter=lfs diff=lfs merge=lfs -text
41
+ # Audio files - compressed
42
+ *.aac filter=lfs diff=lfs merge=lfs -text
43
+ *.flac filter=lfs diff=lfs merge=lfs -text
44
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
45
+ *.ogg filter=lfs diff=lfs merge=lfs -text
46
+ *.wav filter=lfs diff=lfs merge=lfs -text
47
+ # Image files - uncompressed
48
+ *.bmp filter=lfs diff=lfs merge=lfs -text
49
+ *.gif filter=lfs diff=lfs merge=lfs -text
50
+ *.png filter=lfs diff=lfs merge=lfs -text
51
+ *.tiff filter=lfs diff=lfs merge=lfs -text
52
+ # Image files - compressed
53
+ *.jpg filter=lfs diff=lfs merge=lfs -text
54
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
55
+ *.webp filter=lfs diff=lfs merge=lfs -text
56
+ augmented_notes_30K.jsonl filter=lfs diff=lfs merge=lfs -text
57
+ report.pdf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-generation
5
+ language:
6
+ - en
7
+ pretty_name: Augmented Clinical Notes
8
+ size_categories:
9
+ - 10K<n<100K
10
+ configs:
11
+ - config_name: default
12
+ data_files:
13
+ - split: train
14
+ path: augmented_notes_30K.jsonl
15
+ tags:
16
+ - medical
17
+ - health
18
+ dataset_info:
19
+ features:
20
+ - name: idx
21
+ dtype: string
22
+ - name: note
23
+ dtype: string
24
+ - name: full_note
25
+ dtype: string
26
+ - name: conversation
27
+ dtype: string
28
+ - name: summary
29
+ dtype: string
30
+ ---
31
+
32
+ # Augmented Clinical Notes
33
+
34
+ The Augmented Clinical Notes dataset is an extension of existing datasets containing 30,000 triplets from different sources:
35
+
36
+ - **Real clinical notes** (*[PMC-Patients](https://arxiv.org/abs/2202.13876)*): Clinical notes correspond to patient summaries from the PMC-Patients dataset, which are extracted from PubMed Central case studies.
37
+ - **Synthetic dialogues** (*[NoteChat](https://arxiv.org/abs/2310.15959)*): Synthetic patient-doctor conversations were generated from clinical notes using GPT 3.5.
38
+ - **Structured patient information** (*ours*): From clinical notes, we generate structured patient summaries using GPT-4 and a tailored medical information template (see details below).
39
+
40
+ This dataset was used to train [**MediNote-7B**](https://huggingface.co/AGBonnet/medinote-7b) and [**MediNote-13B**](https://huggingface.co/AGBonnet/medinote-13b), a set of clinical note generators fine-tuned from the [**MediTron**](https://huggingface.co/epfl-llm/meditron-7b) large language models.
41
+
42
+ Our full report is available [here](./report.pdf).
43
+
44
+ ## Dataset Details
45
+
46
+ <!-- Provide a longer summary of what this dataset is. -->
47
+
48
+ - **Curated by:** Antoine Bonnet and Paul Boulenger
49
+ - **Language(s):** English only
50
+ - **Repository:** [EPFL-IC-Make-Team/ClinicalNotes](https://github.com/EPFL-IC-Make-Team/ClinicalNotes)
51
+ - **Paper:** *[MediNote: Automated Clinical Notes](report.pdf)*
52
+
53
+ ## Dataset Creation
54
+
55
+
56
+ **Clinical notes**. Our primary source of clinical notes is *[PMC-Patients](https://arxiv.org/abs/2202.13876)*. This large-scale dataset contains 167K patient summaries extracted from open-access case studies published in PubMed Central. Each note encapsulates a detailed case presentation as written by a doctor, presenting a thorough summary encompassing the patient’s visit, medical history, symptoms, administered treatments, as well as the discharge summary and outcome of the intervention. These comprehensive case presentations offer a rich and diverse collection of medical scenarios, forming a robust foundation for our model training and evaluation.
57
+
58
+ **Synthetic dialogues**. Distribution of confidential patient-doctor conversations is forbidden, so no large scale dataset is publicly available for training. We circumvent the lack of real dialogue data by building upon [NoteChat](https://huggingface.co/datasets/akemiH/NoteChat), an extension of PMC-Patients with 167K synthetic patient-doctor conversations. Each dialogue transcript within the NoteChat dataset was generated from a clinical note by ChatGPT (version `gpt-3.5-turbo-0613`).
59
+
60
+ **Patient information**. We augment the PMC-Patients and NoteChat datasets by extracting structured patient information from the 30K longest clinical notes. To do so, we prompt GPT-4 (version `gpt-4-turbo-0613`) with zero-shot instructions, providing clinical notes and a structured template of patient medical information with feature definitions. This template, shown below, encapsulates crucial aspects of a clinical note such as the patient’s admission to a care center, medical history, current symptoms, as well as the doctor’s diagnosis and treatment plan.
61
+
62
+ The full data pipeline is shown below.
63
+
64
+ <p align="center">
65
+ <img width=70% src="data_pipeline.pdf" alt="Data pipeline" title="Data pipeline">
66
+ </p>
67
+
68
+
69
+ ### Medical information template
70
+
71
+ Here is shown the medical template we used to structurize clinical notes. A JSON version is also available as `template_definitions.json`.
72
+
73
+ <p align="center">
74
+ <img width=70% src="template.pdf" alt="Data pipeline" title="Data pipeline">
75
+ </p>
76
+
77
+ ### Dialogue Quality
78
+
79
+ The primary aim of synthetic dialogues is to distill comprehensive information from the case presentation, transforming it into a plausible and engaging conversation.
80
+ Newer versions of the dataset include higher quality dialogues generated by GPT-4 and NoteChat, a multi-agent dialogue generation pipeline (see the [NoteChat repository](https://github.com/believewhat/Dr.NoteAid) for more information).
81
+
82
+ Dialogues produced by ChatGPT tend to lack realism and frequently adhere to a pattern where the doctor poses a series of questions mirroring the facts from the original clinical notes, receiving simple ’Yes’ responses from the patient. Nevertheless, we decided to use ChatGPT dialogues as they were the only ones available during the training phase.
83
+
84
+ Clinical notes within NoteChat were truncated prior to the dialogue generation process. Consequently, the information lost due to truncation from the clinical note is also missing in the resulting dialogue. While complete notes were accessible from PMC-Patients, a conscious decision was made to fine-tune our models using truncated notes. This decision aimed at preventing our fine-tuned models from being inadvertently trained to hallucinate information towards the conclusion of a note. Notably, certain ChatGPT dialogues involving scenarios where a patient passes away and a subsequent dialogue with a family member commences revealed instances of prompt leaks. These leaks manifested as the prompt used for synthetic dialogue generation being inadvertently repeated within the dialogue.
85
+
86
+ ## Dataset Structure
87
+
88
+ <!-- This section provides a description of the dataset fields, and additional information about the dataset structure such as criteria used to create the splits, relationships between data points, etc. -->
89
+
90
+ Each row of the dataset represents one dialogue-summary-note triplet, and consists of the following dataset fields (all strings):
91
+
92
+ | Field | Description | Source |
93
+ |-|-|-|
94
+ | `idx` | Unique identifier, index in the original NoteChat-ChatGPT dataset | NoteChat |
95
+ | `note` | Clinical note used by NoteChat (possibly truncated) | NoteChat |
96
+ | `full_note` | Full clinical note | PMC-Patients |
97
+ | `conversation` | Patient-doctor dialogue | NoteChat |
98
+ | `summary`| Patient information summary (JSON) | ours |
99
+
100
+ ## Uses
101
+
102
+ <!-- Address questions around how the dataset is intended to be used. -->
103
+
104
+
105
+ While this dataset was originally used to fine-tune LLMs to extract structured patient information from dialogue, it can also be used for diverse applications in the healthcare domain, such as training models to extract comprehensive tabular patient features from clinical notes.
106
+
107
+
108
+ ## Bias, Risks, and Limitations
109
+
110
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
111
+
112
+ - **Synthetic Data**: NoteChat dialogues were synthetically generated from clinical notes; they are not completely realistic and therefore fail to accurately represent real patient-doctor conversations. Real patient-doctor conversations are of course preferred, but their distribution is forbidden in the US by the [Health Insurance Portability and Accountability Act of 1996](https://www.cdc.gov/phlp/publications/topic/hipaa.html).
113
+ - **Representation**: PMC-Patients clinical notes have been extracted from English PubMed Central publications, and therefore over-represent clinical settings from English-speaking countries.
114
+
115
+ ## Acknowledgments
116
+
117
+ We thank Prof. Mary-Anne Hartley for her advice on the appropriate template for structured medical patient summaries.
118
+
119
+ <!--
120
+ ## Citation
121
+
122
+ If you use the Augmented Clinical Notes dataset, please cite out work:
123
+
124
+ ```
125
+ ADD CITATION
126
+ ```
127
+ --!>
augmented_notes_30K.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2301347522a517df6ecf4799955fef5993cc679d9fabbf44d92714331fb6f389
3
+ size 371946943
data_pipeline.pdf ADDED
Binary file (199 kB). View file
 
report.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c59ad5cb42709549df65060ebd13028770eb795e353d0c5693e83810050e3815
3
+ size 2003748
template.pdf ADDED
Binary file (64.3 kB). View file
 
template_definitions.json ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "visit motivation": "Reason for the patient's visit",
3
+ "admission": [
4
+ {
5
+ "reason": "Reason for admission to a care center",
6
+ "date": "Date of first admission",
7
+ "duration": "Length of patient's stay",
8
+ "care center details": "Any details of care center the patient was admitted to (e.g. oncology clinic)"
9
+ }
10
+ ],
11
+ "patient information": {
12
+ "age": "Patient's age",
13
+ "sex": "Patient's sex",
14
+ "ethnicity": "Patient's ethnicity or nationality",
15
+ "weight": "Patient's weight",
16
+ "height": "Patient's height",
17
+ "family medical history": "Information about family medical history",
18
+ "recent travels": "Details about patient's recent travels",
19
+ "socio economic context": "Patient's socioeconomic background",
20
+ "occupation": "Patient's occupation"
21
+ },
22
+ "patient medical history": {
23
+ "physiological context": "Relevant physiological history of the patient",
24
+ "psychological context": "Relevant psychological history of the patient",
25
+ "vaccination history": "History of vaccinations received by the patient",
26
+ "allergies": "Any known allergies of the patient",
27
+ "exercise frequency": "Frequency of patient's exercise activity",
28
+ "nutrition": "Information about patient's nutrition",
29
+ "sexual history": "Relevant details about patient's sexual history",
30
+ "alcohol consumption": "Patient's alcohol consumption habits",
31
+ "drug usage": "Information about any recreative drugs used by patient",
32
+ "smoking status": "Patient's smoking status"
33
+ },
34
+ "surgeries": [{
35
+ "reason": "Reason for surgery",
36
+ "Type": "Type of surgery performed",
37
+ "time": "Time of surgery",
38
+ "outcome": "Outcome of surgery",
39
+ "details": "Details about the surgery"
40
+ }],
41
+ "symptoms": [
42
+ {
43
+ "name of symptom": "Specific symptom experienced by the patient",
44
+ "intensity of symptom": "Severity or intensity of the symptom",
45
+ "location": "Where the symptom is localized",
46
+ "time": "Any temporal details about when the symtom appears",
47
+ "temporalisation": "Any specific timing patterns associated with the symptom",
48
+ "behaviours affecting the symptom": "Activities or actions that influence the symptom's severity or occurrence.",
49
+ "details": "All additional details about the symptom"
50
+ }
51
+ ],
52
+ "medical examinations": [{
53
+ "name" : "name of medical examination performed",
54
+ "result": "Result or measurement of the physical examination",
55
+ "details": "All additional details about the physical examination"
56
+ }],
57
+ "diagnosis tests": [
58
+ {
59
+ "test": "Name of medical test performed to diagnose the condition",
60
+ "result": "Result or measurement of the medical test performed to diagnose the condition",
61
+ "severity": "Severity level of diagnosed condition",
62
+ "condition": "Name of medical conditions diagnosed",
63
+ "time": "Any temporal details about when the diagnosis test was performed",
64
+ "details": "All additional details about the medical test"
65
+ }
66
+ ],
67
+ "treatments": [
68
+ {
69
+ "name": "Treatment or medication prescribed to the patient",
70
+ "related condition": "Medical condition that the treatment is prescribed for",
71
+ "dosage": "Amount or strength of the treatment",
72
+ "time": "Any temporal details about when the treatment was performed",
73
+ "frequency": "How often the treatment is taken",
74
+ "duration": "The length of time the patient should take the treatment",
75
+ "reason for taking": "The medical reason for taking the treatment",
76
+ "reaction to treatment": "Patient's reaction or response to the prescribed treatment",
77
+ "details": "All additional details about the treatment"
78
+ }
79
+ ],
80
+ "discharge": {
81
+ "reason": "Reason motivating patient's discharge",
82
+ "referral": "Details about any referrals",
83
+ "follow up": "Details about any follow up appointments",
84
+ "discharge summary": "Summary of patient's discharge"
85
+ }
86
+ }