diff --git a/tracex_project/extraction/fixtures/prompts_fixture.json b/tracex_project/extraction/fixtures/prompts_fixture.json index d019d880..31b3b57d 100644 --- a/tracex_project/extraction/fixtures/prompts_fixture.json +++ b/tracex_project/extraction/fixtures/prompts_fixture.json @@ -1,897 +1,1073 @@ [ - { +{ "model": "extraction.prompt", "pk": 1, "fields": { - "name": "TEXT_TO_ACTIVITY_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text understanding and summarization. Your Job is to take a given text about an illness and convert it into bullet points regarding all important points about the course of the disease. Do not include time dates and use a miximum of 6 words per bullet point. Include the number of the sentence in the text from which you take the bullet point. The related numbers are in front of the sentences. Only include ONE sentence number per bullet point!" - }, - { - "role": "user", - "content": "1: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever.\n2: Four days later I went to the doctor and got tested positive for Covid19.\n3: Then I got hospitalized for two weeks." - }, - { - "role": "assistant", - "content": "starting to experience symptoms #1\nvisiting doctor's #2\ntesting positive for Covid19 #2\ngetting admissioned to hospital #3\ngetting discharged from hospital #3" - }, - { - "role": "user", - "content": "8: Concerned about my condition, I contacted my primary care physician via phone.\n9: He advised me to monitor my symptoms and stay at home unless they became severe." - }, - { - "role": "assistant", - "content": "contacting primary care physician #8\nmonitoring symptoms at home #9" - }, - { - "role": "user", - "content": "5: First symptoms on 01/04/2020" - }, - { - "role": "assistant", - "content": "starting to experience symptoms #5" - }, - { - "role": "user", - "content": "1: On July 15, 2022, I started experiencing the first symptoms of Covid-19 for five days.\n2: Initially, I had a mild cough and fatigue." - }, - { - "role": "assistant", - "content": "starting to experience symptoms #1\nending to experience symptoms #1" - } - ] + "name": "TEXT_TO_ACTIVITY_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text understanding and summarization. Your Job is to take a given text about a person's course of disease and to convert it into bullet points. If you are asked to focus on a specific condition, follow these steps: First think about which events are typically present in a course of disease with the condition. Then scan the text and determine which of the events you find are relevant to the condition. Finally, summarize only the relevant events in bullet points. Do not include timestamps and use a maximum of 6 words per bullet point. Include the number of the sentence in the text from which you take the bullet point at the end of the sentence, like this '#number'. The related numbers are in front of the sentences." + }, + { + "role": "user", + "content": "Focus on those events that are related to the course of the disease of Covid-19.\n\n1: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever.\n2: Four days later I went to the doctor and got tested positive for Covid-19.\n3: Then I got hospitalized for two weeks." + }, + { + "role": "assistant", + "content": "starting to experience symptoms #1\nvisiting doctor's #2\ntesting positive for Covid-19 #2\ngetting admitted to hospital #3\ngetting discharged from hospital #3" + }, + { + "role": "user", + "content": "8: Concerned about my condition, I contacted my primary care physician via phone.\n9: He advised me to monitor my symptoms and stay at home unless they became severe." + }, + { + "role": "assistant", + "content": "contacting primary care physician #8\nmonitoring symptoms at home #9" + }, + { + "role": "user", + "content": "5: First symptoms on 01/04/2020" + }, + { + "role": "assistant", + "content": "starting to experience symptoms #5" + }, + { + "role": "user", + "content": "Focus on those events that are related to the course of the disease of Covid-19.\n\n1: On July 15, 2022, I started experiencing the first symptoms of Covid-19 for five days.\n2: Initially, I had a mild cough and fatigue." + }, + { + "role": "assistant", + "content": "starting to experience symptoms #1\nending to experience symptoms #1" + }, + { + "role": "user", + "content": "5:After surviving Covid-19, I made getting vaccinated a top priority. 6: I received my first dose of the vaccine in early February 2022 and the second dose three weeks later. 7: Despite the challenges I faced during my infection, I remained determined to protect myself and others from the virus by getting vaccinated." + }, + { + "role": "assistant", + "content": "receiving first dose of vaccine #6\nreceiving second dose of vaccine #6" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 2, "fields": { - "name": "START_DATE_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text and a given activity label and to extract a start date to this activity label. Only output the extracted start date! Rely also on the context." - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: experiencing mild symptoms" - }, - { - "role": "assistant", - "content": "20200401T0000" - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: testing positive for Covid19" - }, - { - "role": "assistant", - "content": "20200405T0000" - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: getting infected again" - }, - { - "role": "assistant", - "content": "20200601T0000" - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: having back pain" - }, - { - "role": "assistant", - "content": "N/A" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms" - }, - { - "role": "assistant", - "content": "20210701T0000" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: experiencing side effects of vaccination" - }, - { - "role": "assistant", - "content": "20211104T0000" - } - ] + "name": "START_DATE_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text and a given activity label and to extract a start date to this activity label. The text might contain timestamps in the format --YYYYMM/DD--, with two hyphens enclosing the date. Only use these timestamps as backup, in case no other time information is available. Only output the extracted start date! Rely on the context to determine the start date, as it might not be explicitly mentioned." + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever --2020/04/01--. Four days later I went to the doctor and got tested positive for Covid19--2020/04/01--. In June I got infected again--2020/04/01--. After that I had a back pain--2020/04/01--.\nActivity Label: experiencing mild symptoms" + }, + { + "role": "assistant", + "content": "20200401T0000" + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever --2020/04/01--. Four days later I went to the doctor and got tested positive for Covid19--2020/04/01--. In June I got infected again--2020/04/01--. After that I had a back pain--2020/04/01--.\nActivity Label: testing positive for Covid19" + }, + { + "role": "assistant", + "content": "20200405T0000" + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: getting infected again" + }, + { + "role": "assistant", + "content": "20200601T0000" + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: having back pain" + }, + { + "role": "assistant", + "content": "N/A" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21--2021/07/01--. I then got tested positive for Covid19--2021/07/01--. In October I got infected again--2021/10/01--. Then on the 4th of November I got my first dosage of the vaccine.--2021/11/04-- I had heavy side effects.\nActivity Label: starting to experience symptoms" + }, + { + "role": "assistant", + "content": "20210701T0000" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: experiencing side effects of vaccination" + }, + { + "role": "assistant", + "content": "20211104T0000" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 3, "fields": { - "name": "END_DATE_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text, a given activity label and a given timestamp for the beginning of this activity and to then extract an end date to this activity label. Only output the extracted start date! Rely also on the context. Use averages if necessary. If there is no information about the end date at all, please state the start date also as the end date." - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: experiencing mild symptoms\nStart Date: 20200401T0000" - }, - { - "role": "assistant", - "content": "20200405T0000" - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: testing positive for Covid19\nStart Date: 20200405T0000" - }, - { - "role": "assistant", - "content": "20200405T0000" - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: getting infected again\nStart Date: 20200601T0000" - }, - { - "role": "assistant", - "content": "20200615T0000" - }, - { - "role": "user", - "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: having back pain\nStart Date: N/A" - }, - { - "role": "assistant", - "content": "N/A" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: experiencing side effects of \nStart Date: 20211104T0000" - }, - { - "role": "assistant", - "content": "20211106T0000" - }, - { - "role": "user", - "content": "Text: Four days after the first april 2020 I went to the doctor and got tested positive for Covid19. I was then hospitalized for two weeks.\nActivity Label: getting hospitalized\nStart Date: 20200405T0000" - }, - { - "role": "assistant", - "content": "20200419T0000" - }, - { - "role": "user", - "content": "Text: In the next time I made sure to improve my mental well being.\nActivity Label: improving mental well being\nStart Date: 20210610T0000" - }, - { - "role": "assistant", - "content": "20210710T0000" - } - ] + "name": "END_DATE_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text, a given activity label and a given timestamp for the beginning of this activity and to then extract an end date to this activity label. The text might contain dates in the format --YYYYMM/DD--, with two hyphens enclosing the date. Only use these as backup, in case no other time information is available. Only output the extracted end date! Rely on the context to determine the end date, as it might not be explicitly mentioned. Use averages if necessary. If there is no information about the end date at all, please state the start date also as the end date." + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever --2020/04/01--. Four days later I went to the doctor and got tested positive for Covid19--2020/04/01--. In June I got infected again--2020/04/01--. After that I had a back pain--2020/04/01--.\nActivity Label: experiencing mild symptoms\nStart Date: 20200401T0000" + }, + { + "role": "assistant", + "content": "20200405T0000" + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever --2020/04/01--. Four days later I went to the doctor and got tested positive for Covid19--2020/04/01--. In June I got infected again--2020/04/01--. After that I had a back pain--2020/04/01--..\nActivity Label: testing positive for Covid19\nStart Date: 20200405T0000" + }, + { + "role": "assistant", + "content": "20200405T0000" + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: getting infected again\nStart Date: 20200601T0000" + }, + { + "role": "assistant", + "content": "20200615T0000" + }, + { + "role": "user", + "content": "Text: On April 1, 2020, I started experiencing mild symptoms such as a persistent cough, fatigue, and a low-grade fever. Four days later I went to the doctor and got tested positive for Covid19. In June I got infected again. After that I had a back pain.\nActivity Label: having back pain\nStart Date: N/A" + }, + { + "role": "assistant", + "content": "N/A" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21--2021/07/21--. I then got tested positive for Covid19--2021/07/21--. In October I got infected again--2021/10/01--. Then on the 4th of November I got my first dosage of the vaccine--2021/11/04--. I had heavy side effects--2021/11/04--.\nActivity Label: experiencing side effects \nStart Date: 20211104T0000" + }, + { + "role": "assistant", + "content": "20211106T0000" + }, + { + "role": "user", + "content": "Text: Four days after the first of April 2020 I went to the doctor and got tested positive for Covid19. I was then hospitalized for two weeks.\nActivity Label: getting hospitalized\nStart Date: 20200405T0000" + }, + { + "role": "assistant", + "content": "20200419T0000" + }, + { + "role": "user", + "content": "Text: In the next time I made sure to improve my mental well being.\nActivity Label: improving mental well being\nStart Date: 20210610T0000" + }, + { + "role": "assistant", + "content": "20210710T0000" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 4, "fields": { - "name": "EVENT_TYPE_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text categorization and your job is to take a given activity label and to classify it into one of the following event types: 'Symptom Onset', 'Symptom Offset', 'Diagnosis', 'Doctor Visit', 'Treatment', 'Hospital Admission', 'Hospital Discharge', 'Medication', 'Lifestyle Change' and 'Feelings'. Please consider the capitalization." - }, - { - "role": "user", - "content": "visiting doctor's" - }, - { - "role": "assistant", - "content": "Doctors Visit" - }, - { - "role": "user", - "content": "testing positive for Covid19" - }, - { - "role": "assistant", - "content": "Diagnosis" - }, - { - "role": "user", - "content": "getting hospitalized" - }, - { - "role": "assistant", - "content": "Hospital Admission" - }, - { - "role": "user", - "content": "isolating at home" - }, - { - "role": "assistant", - "content": "Lifestyle Change" - }, - { - "role": "user", - "content": "prescribed medication for discomfort" - }, - { - "role": "assistant", - "content": "Medication" - }, - { - "role": "user", - "content": "seeking consultation with specialist" - }, - { - "role": "assistant", - "content": "Doctors Visit" - }, - { - "role": "user", - "content": "receiving vaccines to protect against Covid19" - }, - { - "role": "assistant", - "content": "Treatment" - }, - { - "role": "user", - "content": "feeling a sense of relief" - }, - { - "role": "assistant", - "content": "Feeling" - }, - { - "role": "user", - "content": "starting to experience symptoms" - }, - { - "role": "assistant", - "content": "Symptom Onset" - } - ] + "name": "EVENT_TYPE_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text categorization and your job is to take a given activity label and to classify it into one of the following event types: 'Symptom Onset', 'Symptom Offset', 'Diagnosis', 'Doctor Visit', 'Treatment', 'Hospital Admission', 'Hospital Discharge', 'Medication', 'Lifestyle Change' and 'Feelings'. Please consider the capitalization." + }, + { + "role": "user", + "content": "visiting doctor's" + }, + { + "role": "assistant", + "content": "Doctors Visit" + }, + { + "role": "user", + "content": "testing positive for Covid19" + }, + { + "role": "assistant", + "content": "Diagnosis" + }, + { + "role": "user", + "content": "getting hospitalized" + }, + { + "role": "assistant", + "content": "Hospital Admission" + }, + { + "role": "user", + "content": "isolating at home" + }, + { + "role": "assistant", + "content": "Lifestyle Change" + }, + { + "role": "user", + "content": "prescribed medication for discomfort" + }, + { + "role": "assistant", + "content": "Medication" + }, + { + "role": "user", + "content": "seeking consultation with specialist" + }, + { + "role": "assistant", + "content": "Doctors Visit" + }, + { + "role": "user", + "content": "receiving vaccines to protect against Covid19" + }, + { + "role": "assistant", + "content": "Treatment" + }, + { + "role": "user", + "content": "feeling a sense of relief" + }, + { + "role": "assistant", + "content": "Feeling" + }, + { + "role": "user", + "content": "starting to experience symptoms" + }, + { + "role": "assistant", + "content": "Symptom Onset" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 5, "fields": { - "name": "LOCATION_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text categorization and your job is to take a given activity label and categorize it into: 'Home', 'Hospital' or 'Doctors'. Use the context to categorize." - }, - { - "role": "user", - "content": "visiting doctor's" - }, - { - "role": "assistant", - "content": "Doctors" - }, - { - "role": "user", - "content": "consulting doctor over phone" - }, - { - "role": "assistant", - "content": "Home" - }, - { - "role": "user", - "content": "testing positive for Covid19" - }, - { - "role": "assistant", - "content": "Doctors" - }, - { - "role": "user", - "content": "getting hospitalized" - }, - { - "role": "assistant", - "content": "Hospital" - }, - { - "role": "user", - "content": "isolating at home" - }, - { - "role": "assistant", - "content": "Home" - }, - { - "role": "user", - "content": "prescribed medication for discomfort" - }, - { - "role": "assistant", - "content": "Doctors" - }, - { - "role": "user", - "content": "receiving special care with a ventilator" - }, - { - "role": "assistant", - "content": "Hospital" - }, - { - "role": "user", - "content": "receiving vaccines to protect against Covid19" - }, - { - "role": "assistant", - "content": "Doctors" - }, - { - "role": "user", - "content": "feeling a sense of relief" - }, - { - "role": "assistant", - "content": "Home" - }, - { - "role": "user", - "content": "starting to experience symptoms" - }, - { - "role": "assistant", - "content": "Home" - } - ] + "name": "LOCATION_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text categorization and your job is to take a given activity label and categorize it into: 'Home', 'Hospital' or 'Doctors'. Use the context to categorize." + }, + { + "role": "user", + "content": "visiting doctor's" + }, + { + "role": "assistant", + "content": "Doctors" + }, + { + "role": "user", + "content": "consulting doctor over phone" + }, + { + "role": "assistant", + "content": "Home" + }, + { + "role": "user", + "content": "testing positive for Covid19" + }, + { + "role": "assistant", + "content": "Doctors" + }, + { + "role": "user", + "content": "getting hospitalized" + }, + { + "role": "assistant", + "content": "Hospital" + }, + { + "role": "user", + "content": "isolating at home" + }, + { + "role": "assistant", + "content": "Home" + }, + { + "role": "user", + "content": "prescribed medication for discomfort" + }, + { + "role": "assistant", + "content": "Doctors" + }, + { + "role": "user", + "content": "receiving special care with a ventilator" + }, + { + "role": "assistant", + "content": "Hospital" + }, + { + "role": "user", + "content": "receiving vaccines to protect against Covid19" + }, + { + "role": "assistant", + "content": "Doctors" + }, + { + "role": "user", + "content": "feeling a sense of relief" + }, + { + "role": "assistant", + "content": "Home" + }, + { + "role": "user", + "content": "starting to experience symptoms" + }, + { + "role": "assistant", + "content": "Home" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 6, "fields": { - "name": "METRIC_ACTIVITY_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text categorization and your job is to take a given bulletpoint and to categorize it into 'No Relevance', 'Low Relevance', 'Moderate Relevance' or 'High Relevance'. It is really important, that that relevance category is correct. Category definition: No Relevance: Events or actions that are not connected to the progression or impact of the disease of the patient in any way. Low Relevance: Events or actions that have limited potential to affect the progression of the disease of the patient and hold minimal significance in its course. Moderate Relevance: Events or actions that possess some potential to influence the disease's progression of the patient but may not be critical to its outcome. High Relevance: Events or actions that hold substantial potential to impact the disease's course of the patient and are crucial in understanding its trajectory." - }, - { - "role": "user", - "content": "receiving support from my children" - }, - { - "role": "assistant", - "content": "Low Relevance" - }, - { - "role": "user", - "content": "taking medicine" - }, - { - "role": "assistant", - "content": "High Relevance" - }, - { - "role": "user", - "content": "eating chips" - }, - { - "role": "assistant", - "content": "No Relevance" - }, - { - "role": "user", - "content": "starting to experience symptoms" - }, - { - "role": "assistant", - "content": "High Relevance" - }, - { - "role": "user", - "content": "feeling side effects from vaccination" - }, - { - "role": "assistant", - "content": "Moderate Relevance" - } - ] + "name": "METRIC_ACTIVITY_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text categorization and your job is to take a given bulletpoint and to categorize it into 'No Relevance', 'Low Relevance', 'Moderate Relevance' or 'High Relevance'. It is really important, that that relevance category is correct. Category definition: No Relevance: Events or actions that are not connected to the progression or impact of the disease of the patient in any way. Low Relevance: Events or actions that have limited potential to affect the progression of the disease of the patient and hold minimal significance in its course. Moderate Relevance: Events or actions that possess some potential to influence the disease's progression of the patient but may not be critical to its outcome. High Relevance: Events or actions that hold substantial potential to impact the disease's course of the patient and are crucial in understanding its trajectory." + }, + { + "role": "user", + "content": "receiving support from my children" + }, + { + "role": "assistant", + "content": "Low Relevance" + }, + { + "role": "user", + "content": "taking medicine" + }, + { + "role": "assistant", + "content": "High Relevance" + }, + { + "role": "user", + "content": "eating chips" + }, + { + "role": "assistant", + "content": "No Relevance" + }, + { + "role": "user", + "content": "starting to experience symptoms" + }, + { + "role": "assistant", + "content": "High Relevance" + }, + { + "role": "user", + "content": "feeling side effects from vaccination" + }, + { + "role": "assistant", + "content": "Moderate Relevance" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 7, "fields": { - "name": "METRIC_TIMESTAMP_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text and to check if a given start date and end date of a given bulletpoint are correct. Correct is a start and end date in the format YYYYMMDDTHHMM if the date is appearing in the patient journey related to bulletpoint. If the start date and end date appearing in the context of the bulletpoint, you should output True. If there is another start or end date in the patient journey, the given timestamps are wrong and you should output False. If the start or end date is not appearing in the patient journey, it could be that the timestamp is estimated. In this case check if the estimation is reasonable and output True if it is and False if it is not." - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 20210721T0000\nEnd Date: 20210721T0000" - }, - { - "role": "assistant", - "content": "True" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 20210721T0000\nEnd Date: 20210724T0000" - }, - { - "role": "assistant", - "content": "True" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 07/21/2021\nEnd Date: 20210721T0000" - }, - { - "role": "assistant", - "content": "False" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 20210721T0000\nEnd Date: N/A" - }, - { - "role": "assistant", - "content": "False" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: experiencing heavy side effects of vaccination\nStart Date: 20211104T0000\nEnd Date: 20211107T0000" - }, - { - "role": "assistant", - "content": "True" - }, - { - "role": "user", - "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: experiencing heavy side effects of vaccination\nStart Date: 20211201T0000\nEnd Date: 20211204T0000" - }, - { - "role": "assistant", - "content": "False" - } - ] + "name": "METRIC_TIMESTAMP_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text and to check if a given start date and end date of a given bulletpoint are correct. Correct is a start and end date in the format YYYYMMDDTHHMM if the date is appearing in the patient journey related to bulletpoint. If the start date and end date appearing in the context of the bulletpoint, you should output True. If there is another start or end date in the patient journey, the given timestamps are wrong and you should output False. If the start or end date is not appearing in the patient journey, it could be that the timestamp is estimated. In this case check if the estimation is reasonable and output True if it is and False if it is not." + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 20210721T0000\nEnd Date: 20210721T0000" + }, + { + "role": "assistant", + "content": "True" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 20210721T0000\nEnd Date: 20210724T0000" + }, + { + "role": "assistant", + "content": "True" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 07/21/2021\nEnd Date: 20210721T0000" + }, + { + "role": "assistant", + "content": "False" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: starting to experience symptoms\nStart Date: 20210721T0000\nEnd Date: N/A" + }, + { + "role": "assistant", + "content": "False" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: experiencing heavy side effects of vaccination\nStart Date: 20211104T0000\nEnd Date: 20211107T0000" + }, + { + "role": "assistant", + "content": "True" + }, + { + "role": "user", + "content": "Text: I started experiencing flu-like symptoms in July 21. I then got tested positive for Covid19. In October I got infected again. Then on the 4th of November I got my first dosage of the vaccine. I had heavy side effects.\nActivity Label: experiencing heavy side effects of vaccination\nStart Date: 20211201T0000\nEnd Date: 20211204T0000" + }, + { + "role": "assistant", + "content": "False" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 8, "fields": { - "name": "COMPARE_MESSAGES", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": " You are an expert in text understanding and your job is to understand the semantical meaning of bulletpoints and compare the semantic to each other. So you take two bulletpoints and check if they are semantically similar. You should return True if you think they are similar and False if you don't." - }, - { - "role": "user", - "content": "First: receiving support from my children\nSecond: taking medicine" - }, - { - "role": "assistant", - "content": "False" - }, - { - "role": "user", - "content": "First: visiting doctor's\nSecond: going to the doctor" - }, - { - "role": "assistant", - "content": "True" - }, - { - "role": "user", - "content": "First: experiencing covid 19 symptoms\nSecond: first symptoms of covid 19" - }, - { - "role": "assistant", - "content": "True" - }, - { - "role": "user", - "content": "First: experiencing first covid 19 symptoms\nSecond: experiencing worse symptoms" - }, - { - "role": "assistant", - "content": "False" - } - ] + "name": "COMPARE_MESSAGES", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": " You are an expert in text understanding and your job is to understand the semantical meaning of bulletpoints and compare the semantic to each other. So you take two bulletpoints and check if they are semantically similar. You should return True if you think they are similar and False if you don't." + }, + { + "role": "user", + "content": "First: receiving support from my children\nSecond: taking medicine" + }, + { + "role": "assistant", + "content": "False" + }, + { + "role": "user", + "content": "First: visiting doctor's\nSecond: going to the doctor" + }, + { + "role": "assistant", + "content": "True" + }, + { + "role": "user", + "content": "First: experiencing covid 19 symptoms\nSecond: first symptoms of covid 19" + }, + { + "role": "assistant", + "content": "True" + }, + { + "role": "user", + "content": "First: experiencing first covid 19 symptoms\nSecond: experiencing worse symptoms" + }, + { + "role": "assistant", + "content": "False" + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 9, "fields": { - "name": "COHORT_TAG_MESSAGES", - "category": "few-shot", - "text": [ - [ - "condition", - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the illness it is about." - }, - { - "role": "user", - "content": "In July I got infected with Covid-19 which resulted in similar symptoms like a heavy flu." - }, - { - "role": "assistant", - "content": "Covid-19" - }, - { - "role": "user", - "content": "I had a heavy flu in July." - }, - { - "role": "assistant", - "content": "Flu" - }, - { - "role": "user", - "content": "Last year I was feeling really well, when all of a sudden I had severe breathtaking problems and high fever. I thought it was a flu, but it turned out to be Covid-19." - }, - { - "role": "assistant", - "content": "Covid-19" - } - ], - [ - "sex", - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the gender of the author. If the gender isn't clear, you should take the context into account. Only if the context doesn't help, you should return 'N/A'." - }, - { - "role": "user", - "content": "I am a 25 year old software engineer living in California with my girlfriend. When I got Covid-19 last year I was really worried about my job and my girlfriend." - }, - { - "role": "assistant", - "content": "male" - }, - { - "role": "user", - "content": "I am a nurse living in Berlin with my boyfriend. When I got Covid-19 last year I was really worried about my job and my boyfriend." - }, - { - "role": "assistant", - "content": "female" - }, - { - "role": "user", - "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" - }, - { - "role": "assistant", - "content": "N/A" - }, - { - "role": "user", - "content": "I am a 25 year old software engineer living in California with my girlfriend. When I got Covid-19 that struck me as a mother of two really heavily." - }, - { - "role": "assistant", - "content": "female" - }, - { - "role": "user", - "content": "I am a nurse living in Berlin. When I got Covid-19 I had to stay home what really hit me. As a divorced father I only see my boy once every month and now I couldn't even do that." - }, - { - "role": "assistant", - "content": "male" - } - ], - [ - "age", - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the age of the author. If the gender isn't clear, you should take the context into account. Young means 25, middle aged 50 and old 75. Only if the context doesn't help, you should return 'N/A'." - }, - { - "role": "user", - "content": "I am a 22 year old software engineer living in California with my girlfriend. When I got Covid-19 last year I was really worried about my job and my girlfriend." - }, - { - "role": "assistant", - "content": "22" - }, - { - "role": "user", - "content": "I am a nurse living in Berlin. When I got Covid-19 I had to stay home what really hit me. Luckily as a young person I recovered quickly." - }, - { - "role": "assistant", - "content": "25" - }, - { - "role": "user", - "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" - }, - { - "role": "assistant", - "content": "N/A" - }, - { - "role": "user", - "content": "I am an old man, so Covid-19 wasn't all easy on me." - }, - { - "role": "assistant", - "content": "75" - } - ], - [ - "origin", - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the origin country of the author. If the origin isn't clear, you should take the context into account. Only if the context doesn't help, you should return 'N/A'." - }, - { - "role": "user", - "content": "I am a 25 year old software engineer living in California with my girlfriend. When I got Covid-19 last year I was really worried about my job and my girlfriend." - }, - { - "role": "assistant", - "content": "United States of America" - }, - { - "role": "user", - "content": "I am a nurse living in Berlin. When I got Covid-19 I had to stay home what really hit me. Luckily as a young person I recovered quickly." - }, - { - "role": "assistant", - "content": "Germany" - }, - { - "role": "user", - "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" - }, - { - "role": "assistant", - "content": "N/A" - } - ], - [ - "preexisting_condition", - { - "role": "system", - "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract previous diseases of the author. These diseases have to be EXPLICITLY MENTIONED. And they have to have occured BEFORE the illness the text is about!" - }, - { - "role": "user", - "content": "I got Covid-19 last year, which was hard since I since ever had to fight Asthma." - }, - { - "role": "assistant", - "content": "Asthma" - }, - { - "role": "user", - "content": "I infected me with Covid-19 right after I recovered from a heavy cold." - }, - { - "role": "assistant", - "content": "Cold" - }, - { - "role": "user", - "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" - }, - { - "role": "assistant", - "content": "N/A" - }, - { - "role": "user", - "content": "I got Covid-19 last year after I already got it right at the start in 2020." - }, - { - "role": "assistant", - "content": "Covid-19" - } + "name": "COHORT_TAG_MESSAGES", + "category": "few-shot", + "text": [ + [ + "condition", + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the illness it is about. Return only the condition using two words a most." + }, + { + "role": "user", + "content": "In July I got infected with Covid-19 which resulted in similar symptoms like a heavy flu." + }, + { + "role": "assistant", + "content": "Covid-19" + }, + { + "role": "user", + "content": "I had a heavy flu in July." + }, + { + "role": "assistant", + "content": "Flu" + }, + { + "role": "user", + "content": "Last year I was feeling really well, when all of a sudden I had severe breathtaking problems and high fever. I thought it was a flu, but it turned out to be Covid-19." + }, + { + "role": "assistant", + "content": "Covid-19" + } + ], + [ + "gender", + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the gender of the author. If the gender isn't clear, you should take the context into account. Only if the context doesn't help, you should return 'N/A'." + }, + { + "role": "user", + "content": "I am a 25 year old software engineer living in California with my girlfriend. When I got Covid-19 last year I was really worried about my job and my girlfriend." + }, + { + "role": "assistant", + "content": "male" + }, + { + "role": "user", + "content": "I am a nurse living in Berlin with my boyfriend. When I got Covid-19 last year I was really worried about my job and my boyfriend." + }, + { + "role": "assistant", + "content": "female" + }, + { + "role": "user", + "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" + }, + { + "role": "assistant", + "content": "N/A" + }, + { + "role": "user", + "content": "I am a 25 year old software engineer living in California with my girlfriend. When I got Covid-19 that struck me as a mother of two really heavily." + }, + { + "role": "assistant", + "content": "female" + }, + { + "role": "user", + "content": "I am a nurse living in Berlin. When I got Covid-19 I had to stay home what really hit me. As a divorced father I only see my boy once every month and now I couldn't even do that." + }, + { + "role": "assistant", + "content": "male" + } + ], + [ + "age", + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the age of the author. If the gender isn't clear, you should take the context into account. Young means 25, middle aged 50 and old 75. Only if the context doesn't help, you should return 'N/A'." + }, + { + "role": "user", + "content": "I am a 22 year old software engineer living in California with my girlfriend. When I got Covid-19 last year I was really worried about my job and my girlfriend." + }, + { + "role": "assistant", + "content": "22" + }, + { + "role": "user", + "content": "I am a nurse living in Berlin. When I got Covid-19 I had to stay home what really hit me. Luckily as a young person I recovered quickly." + }, + { + "role": "assistant", + "content": "25" + }, + { + "role": "user", + "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" + }, + { + "role": "assistant", + "content": "N/A" + }, + { + "role": "user", + "content": "I am an old man, so Covid-19 wasn't all easy on me." + }, + { + "role": "assistant", + "content": "75" + } + ], + [ + "origin", + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract the origin country of the author. If the origin isn't clear, you should take the context into account. Only if the context doesn't help, you should return 'N/A'. Return only the country of origin using two words a most." + }, + { + "role": "user", + "content": "I am a 25 year old software engineer living in California with my girlfriend. When I got Covid-19 last year I was really worried about my job and my girlfriend." + }, + { + "role": "assistant", + "content": "United States of America" + }, + { + "role": "user", + "content": "I am a nurse living in Berlin. When I got Covid-19 I had to stay home what really hit me. Luckily as a young person I recovered quickly." + }, + { + "role": "assistant", + "content": "Germany" + }, + { + "role": "user", + "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" + }, + { + "role": "assistant", + "content": "N/A" + } + ], + [ + "preexisting_condition", + { + "role": "system", + "content": "You are an expert in text understanding and your job is to take a given text about an illness and to extract previous diseases of the author. These diseases have to be EXPLICITLY MENTIONED. And they have to have occured BEFORE the illness the text is about! Return only the preexisting disease using two words a most." + }, + { + "role": "user", + "content": "I got Covid-19 last year, which was hard since I since ever had to fight Asthma." + }, + { + "role": "assistant", + "content": "Asthma" + }, + { + "role": "user", + "content": "I infected me with Covid-19 right after I recovered from a heavy cold." + }, + { + "role": "assistant", + "content": "Cold" + }, + { + "role": "user", + "content": "I got Covid-19 last year and I was really worried about my job. The diesease itself wasn't even that hard but it stressed me out, that I wasn't allowed to go to my job!" + }, + { + "role": "assistant", + "content": "N/A" + }, + { + "role": "user", + "content": "I got Covid-19 last year after I already got it right at the start in 2020." + }, + { + "role": "assistant", + "content": "Covid-19" + } + ] ] - ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 10, "fields": { - "name": "PREPROCESSING_SPELLCHECK", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text analysis with a focus on spelling accuracy. Your task is to identify any spelling errors in the provided text and correct them. Ensure the corrected text is accurate and readable. Please make sure to give out the full text without shorten it." - }, - { - "role": "user", - "content": "I remeber the day I first learnt about the importnce of spellchek. It was an eye-opener for me." - }, - { - "role": "assistant", - "content": "I remember the day I first learned about the importance of spellcheck. It was an eye-opener for me." - } - ] + "name": "PREPROCESSING_SPELLCHECK", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text analysis with a focus on spelling accuracy. Your task is to identify any spelling errors in the provided text and correct them. Ensure the corrected text is accurate and readable. Please make sure to give out the full text without shortening it." + }, + { + "role": "user", + "content": "I remeber the day I first learnt about the importnce of spellchek. It was an eye-opener for me." + }, + { + "role": "assistant", + "content": "I remember the day I first learned about the importance of spellcheck. It was an eye-opener for me." + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 11, "fields": { - "name": "PREPROCESSING_PUNCTUATION", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text analysis with a focus on grammatical accuracy, specifically punctuation and comma usage. Your task is to identify any punctuation or comma errors in the provided text and correct them. Ensure the corrected text is accurate, readable, and follows standard punctuation rules. Please make sure to give out the full text without shortening it." - }, - { - "role": "user", - "content": "Despite the rainy weather many people attended the outdoor concert, which, was surprising. The band played hit after hit, and the crowd's enthusiasm, was infectious even the most reserved attendees found themselves dancing." - }, - { - "role": "assistant", - "content": "Despite the rainy weather, many people attended the outdoor concert, which was surprising. The band played hit after hit, and the crowd's enthusiasm was infectious; even the most reserved attendees found themselves dancing." - } - ] + "name": "PREPROCESSING_PUNCTUATION", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text analysis with a focus on grammatical accuracy, specifically punctuation and comma usage. Your task is to identify any punctuation or comma errors in the provided text and correct them. Ensure the corrected text is accurate, readable, and follows standard punctuation rules. Please make sure to give out the full text without shortening it." + }, + { + "role": "user", + "content": "Despite the rainy weather many people attended the outdoor concert, which, was surprising. The band played hit after hit, and the crowd's enthusiasm, was infectious even the most reserved attendees found themselves dancing." + }, + { + "role": "assistant", + "content": "Despite the rainy weather, many people attended the outdoor concert, which was surprising. The band played hit after hit, and the crowd's enthusiasm was infectious; even the most reserved attendees found themselves dancing." + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 12, "fields": { - "name": "PREPROCESSING_IDENTIFY_TIMESTAMPS", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text analysis. Your task is to identify and extract any timestamps (specific dates, months, years, recognized holidays, timeframes like '12 weeks later', or periods between specific dates) mentioned in the context of an individual experiencing symptoms or being diagnosed with an illness. Highlight these timestamps within the text by surrounding them with $$$ symbols. Ensure the full text is presented without any omissions, and only the timestamps are highlighted in this manner." - }, - { - "role": "user", - "content": "I started feeling unwell around the middle of March 2021. The symptoms were quite severe by the 20th of March, which is when I decided to get tested. The test results came back positive for Covid-19 on March 22nd, 2021." - }, - { - "role": "assistant", - "content": "I started feeling unwell around the middle of $$$March 2021$$$. The symptoms were quite severe by the $$$20th of March$$$, which is when I decided to get tested. The test results came back positive for Covid-19 on $$$March 22nd, 2021$$$." - }, - { - "role": "user", - "content": "I started feeling unusually fatigued right before Thanksgiving 2020. The fatigue worsened over the holiday, and by the following Monday, I had developed a fever. I was tested for Covid-19 two days later and received a positive result on November 30th, 2020." - }, - { - "role": "assistant", - "content": "I started feeling unusually fatigued right before $$$Thanksgiving 2020$$$. The fatigue worsened over the holiday, and by the following Monday, I had developed a fever. I was tested for Covid-19 $$$two days later$$$ and received a positive result on $$$November 30th, 2020$$$." - } - ] + "name": "PREPROCESSING_TIME_IDENTIFICATION", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text analysis. Your task is to identify timestamps of events in the given text. Those can be: specific dates, months, years, recognized holidays, relative dates like '12 weeks later' or 'as the week progressed'. Highlight these timestamps within the text by surrounding them with $$$ symbols. Return the full text with the highlighted time specifications." + }, + { + "role": "user", + "content": "I started feeling unwell around the middle of March 2021. The symptoms were quite severe by the 20th of March, which is when I decided to get tested. The test results came back positive for Covid-19 on March 22nd, 2021." + }, + { + "role": "assistant", + "content": "I started feeling unwell around the $$$middle of March 2021$$$. The symptoms were quite severe by the $$$20th of March$$$, which is when I decided to get tested. The test results came back positive for Covid-19 on $$$March 22nd, 2021$$$." + }, + { + "role": "user", + "content": "I started feeling unusually fatigued right before Thanksgiving 2020. The fatigue worsened over the holiday, and by the following Monday, I had developed a fever. I was tested for Covid-19 two days later and received a positive result on November 30th, 2020." + }, + { + "role": "assistant", + "content": "I started feeling unusually fatigued right before $$$Thanksgiving 2020$$$. The fatigue worsened over the holiday, and by the $$$following Monday$$$, I had developed a fever. I was tested for Covid-19 $$$two days later$$$ and received a positive result on $$$November 30th, 2020$$$." + }, + { + "role": "user", + "content": "Two days after new years eve, I started feeling sick. In the following week my symptoms worsened." + }, + { + "role": "assistant", + "content": "$$$Two days after$$$ $$$new years eve$$$, I started feeling sick. $$$In the following week$$$ my symptoms worsened." + }, + { + "role": "user", + "content": "I was tested positive for Covid-19 on by birthday, the 12th of June. The day before I already felt light-headed. Two weeks after my birthday, I was admitted to the hospital." + }, + { + "role": "assistant", + "content": "I was tested positive for Covid-19 on by birthday, $$$the 12th of June$$$. $$$The day before$$$ I already felt light-headed. $$$Two weeks after my birthday$$$, I was admitted to the hospital." + }, + { + "role": "user", + "content": "Over the course of the next few days, my symptoms progressed, and I started experiencing high fever. After two weeks of isolation, I finally started feeling better." + }, + { + "role": "assistant", + "content": "$$$Over the course of the next few days$$$, my symptoms progressed, and I started experiencing high fever. $$$After two weeks$$$ of isolation, I finally started feeling better." + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 13, "fields": { - "name": "PREPROCESSING_TRANSFORM_TIMESTAMPS", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text analysis and date formatting. Your task is to identify any timestamps related to when an individual experienced symptoms or was diagnosed with an illness. Convert and present these timestamps in the specific format of YYYY/MM/DD. All relevant time specifications are already highlighted with $$$ $$$. To guarantee the completeness of the date you must make assumptions about the year, month and day based on the context. If the time specification is a duration, based on context, you must make assumptions about the start date of the duration. If there is no information about the year, month or day, you are allowed to assume the current year, month or day. Ensure the full text is presented without any omissions, and try to transform every timestamps as concrete as possible. Please make sure to give out the full text without shortening it." - }, - { - "role": "user", - "content": "I noticed the first symptoms shortly after my birthday in $$$April$$$, and exactly $$$12 weeks later$$$, my condition had deteriorated significantly. I was officially diagnosed with Lyme disease on $$$August 7th$$$. In $$$early 2025$$$, it will be gone!" - }, - { - "role": "assistant", - "content": "I noticed the first symptoms shortly after my birthday on 2024/04/01, and exactly 12 weeks later, on 2024/06/24, my condition had deteriorated significantly. I was officially diagnosed with Lyme disease on 2024/08/07. It will be gone on 2025/01/01!" - }, - { - "role": "user", - "content": "During the period between $$$the 01.02 and the 03.02$$$, I felt unusually tired, but I thought it was just stress. However, after attending a large event $$$two weeks later$$$, I developed a fever and was tested positive for the flu." - }, - { - "role": "assistant", - "content": "During the period between 2024/02/01 and 2024/02/03, I felt unusually tired, but I thought it was just stress. However, after attending a large event two weeks later, on 2024/02/17, I developed a fever and was tested positive for the flu." - } - ] + "name": "PREPROCESSING_TRANSFORM_TIMESTAMPS", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text analysis and date formatting. Convert these timestamps in the specific format of YYYY/MM/DD. Some relevant time specifications are highlighted with $$$ symbols in the text, focus on those. To guarantee the completeness of the date you must make assumptions about the year, month and day based on the context. If the time specification is a duration, based on context, you must make assumptions about the start date of the duration. If there is no information about the year, month or day, you are allowed to assume the current year, month or day. Ensure the full text is presented without any omissions and transform every timestamps as concrete as possible. Please make sure to give out the full text without shortening it." + }, + { + "role": "user", + "content": "I noticed the first symptoms shortly after my birthday in $$$April$$$, and exactly $$$12 weeks later$$$, my condition had deteriorated significantly. I was officially diagnosed with Lyme disease on $$$August 7th$$$. In $$$early 2025$$$, it will be gone!" + }, + { + "role": "assistant", + "content": "I noticed the first symptoms shortly after my birthday on 2024/04/01, and exactly 12 weeks later, on 2024/06/24, my condition had deteriorated significantly. I was officially diagnosed with Lyme disease on 2024/08/07. It will be gone on 2025/01/01!" + }, + { + "role": "user", + "content": "During the period between $$$the 01.02 and the 03.02$$$, I felt unusually tired, but I thought it was just stress. However, after attending a large event $$$two weeks later$$$, I developed a fever and was tested positive for the flu." + }, + { + "role": "assistant", + "content": "During the period between 2024/02/01 and 2024/02/03, I felt unusually tired, but I thought it was just stress. However, after attending a large event two weeks later, on 2024/02/17, I developed a fever and was tested positive for the flu." + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 14, "fields": { - "name": "PREPROCESSING_TIME_CALCULATION", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text analysis and date calculations. Your task is to identify timestamps related to health events or diagnoses and convert these into concrete dates in the format of YYYY/MM/DD. For relative timestamps (like 'a few weeks after' or 'months before'), calculate the exact dates based on provided or assumed known dates. Ensure the text is complete without omission, with all relevant timestamps accurately transformed to the specified format. Please make sure to give out the full text without shortening it." - }, - { - "role": "user", - "content": "After experiencing severe headaches starting in mid-$$$March 2022$$$, I went to see a neurologist. The MRI scan scheduled $$$three weeks later$$$ confirmed that I had a benign brain tumor. Post-surgery, I began my recovery phase, which lasted until $$$four months later$$$. During a follow-up visit $$$two months after my recovery$$$, my doctor confirmed that my condition had improved significantly." - }, - { - "role": "assistant", - "content": "After experiencing severe headaches starting on 2022/03/15, I went to see a neurologist. The MRI scan scheduled on 2022/04/05 confirmed that I had a benign brain tumor. Post-surgery, I began my recovery phase, which lasted until 2022/08/05. During a follow-up visit on 2022/10/05, my doctor confirmed that my condition had improved significantly." - }, - { - "role": "user", - "content": "Early July 2020, I started experiencing severe coughing and a high fever. It turned out I had contracted Covid-19. And in $$$early August$$$ I had lost my sense of taste." - }, - { - "role": "assistant", - "content": "On the 2020/06/01, I started experiencing severe coughing and a high fever. It turned out I had contracted Covid-19. And on 2020/08/01 I had lost my sense of taste." - } - ] + "name": "PREPROCESSING_TIME_RELATIVE", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text analysis and temporal relations. Your task is to convert relative time information (like 'a few weeks after' or 'in the following days') into concrete dates in the format of YYYY/MM/DD. For relative timestamps like 'two days after my birthday' or 'the day before that', calculate the exact dates based on other dates in the text. If this information is missing, make reasonable assumptions. Some relevant time specifications are highlighted with $$$ symbols in the text, focus on those. Return the full text with the transformed timestamps." + }, + { + "role": "user", + "content": "After experiencing severe headaches starting on 2022/03/15$, I went to see a neurologist. The MRI scan scheduled $$$three weeks later$$$ confirmed that I had a benign brain tumor. Post-surgery, I began my recovery phase, which lasted until $$$four months later$$$. During a follow-up visit $$$two weeks after my recovery$$$, my doctor confirmed that my condition had improved significantly." + }, + { + "role": "assistant", + "content": "After experiencing severe headaches starting on 2022/03/15, I went to see a neurologist. The MRI scan scheduled on 2022/04/05 confirmed that I had a benign brain tumor. Post-surgery, I began my recovery phase, which lasted until 2022/08/05. During a follow-up visit on 2022/08/19, my doctor confirmed that my condition had improved significantly." + }, + { + "role": "user", + "content": "On the 2020/01/06, I started experiencing severe coughing and a high fever. It turned out I had contracted Covid-19. And in $$$the following weeks$$$ I had lost my sense of taste." + }, + { + "role": "assistant", + "content": "On the 2020/06/01, I started experiencing severe coughing and a high fever. It turned out I had contracted Covid-19. And during 2020/06/01 and 2020/06/15 I lost my sense of taste." + }, + { + "role": "user", + "content": "I was diagnosed with diabetes on 2023/05/01. $$$A few days later$$$, I began experiencing extreme fatigue and dizziness." + }, + { + "role": "assistant", + "content": "I was diagnosed with diabetes on 2023/05/01. On 2023/05/04, I began experiencing extreme fatigue and dizziness." + }, + { + "role": "user", + "content": "I started chemotherapy on 2022/09/15. $$$Two weeks after the treatment$$$, my hair started falling out." + }, + { + "role": "assistant", + "content": "I started chemotherapy on 2022/09/15. On 2022/09/29, my hair started falling out." + }, + { + "role": "user", + "content": "I had surgery to remove a tumor on 2023/03/10. $$$In the following week$$$, I developed an infection at the surgical site." + }, + { + "role": "assistant", + "content": "I had surgery to remove a tumor on 2023/03/10. Between 2023/03/10 and 2023/0317, I developed an infection at the surgical site." + }, + { + "role": "user", + "content": "I began taking new medication for my condition on 2022/07/01. $$$A month after starting the medication$$$, I noticed significant improvements in my symptoms." + }, + { + "role": "assistant", + "content": "I began taking new medication for my condition on 2022/07/01. On 2022/08/01, I noticed significant improvements in my symptoms." + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 15, "fields": { - "name": "PREPROCESSING_TIME_INTERPRETATION", - "category": "few-shot", - "text": [ - { - "role": "system", - "content": "You are an expert in text analysis with a specialization in date formatting and interpretation. Your task is to transform general time references related to health events or any other context into specific dates in the format of YYYY/MM/DD. Specifically, convert 'early [month]' to the 1st of the month, 'mid [month]' to the 15th of the month, and 'end of [month]' to the last day of the month (use 30 for April, June, September, and November; 31 for January, March, May, July, August, October, and December; and 28 or 29 for February, depending on leap years). If the year is not mentioned, assume the current year. Provide the full text without omission, ensuring all general time references are accurately transformed into the specified format. Example transformations: 'early January 2020' becomes 2020/01/01, 'mid January 2020' becomes 2020/01/15, and 'end of January 2020' becomes 2020/01/31." - }, - { - "role": "user", - "content": "In early January, I noticed a persistent cough. By mid January, the cough had worsened, leading me to seek medical advice. A specialist finally saw me at the end of January, diagnosing me with a chronic condition." - }, - { - "role": "assistant", - "content": "In 2020/01/01, I noticed a persistent cough. By 2020/01/15, the cough had worsened, leading me to seek medical advice. A specialist finally saw me at 2020/01/31, diagnosing me with a chronic condition." - }, - { - "role": "user", - "content": "In the middle of 2023 I got a stroke. By the end of the year I had recovered. But in early 2024 I had a relapse." - }, - { - "role": "assistant", - "content": "On 2023/06/01, I got a stroke. By 2023/12/01, I had recovered, On 2024/01/01, I had a relapse." - } - ] + "name": "PREPROCESSING_TIME_GENERAL", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text analysis and date formatting. Your task is to transform unspecific time references into specific dates in the format of YYYY/MM/DD. Some relevant time specifications are highlighted with $$$ symbols in the text, focus on those. Specifically, convert 'early [month]' to the 1st of the month, 'mid [month]' to the 15th of the month, and 'end of [month]' to the last day of the month (use 30 for April, June, September, and November; 31 for January, March, May, July, August, October, and December; and 28 or 29 for February, depending on leap years). If the year is not mentioned, assume the current year. Return the full text, with the transformed timestamps." + }, + { + "role": "user", + "content": "$$$In early January$$$, I noticed a persistent cough. By $$$mid January$$$, the cough had worsened, leading me to seek medical advice. A specialist finally saw me $$$at the end of January$$$, diagnosing me with a chronic condition." + }, + { + "role": "assistant", + "content": "In 2020/01/01, I noticed a persistent cough. By 2020/01/15, the cough had worsened, leading me to seek medical advice. A specialist finally saw me at 2020/01/31, diagnosing me with a chronic condition." + }, + { + "role": "user", + "content": "In the $$$middle of 2023$$$ I got a stroke. By the $$$end of the year$$$ I had recovered. But in $$$early 2024$$$ I had a relapse." + }, + { + "role": "assistant", + "content": "On 2023/06/01, I got a stroke. By 2023/12/01, I had recovered. On 2024/01/01, I had a relapse." + }, + { + "role": "user", + "content": "I plan to start my new fitness routine in $$$early February 2024$$$. By $$$mid February$$$, I hope to see some initial results. By the $$$end of February$$$, I want to have a consistent habit." + }, + { + "role": "assistant", + "content": "I plan to start my new fitness routine on 2024/02/01. By 2024/02/15, I hope to see some initial results. By 2024/02/29, I want to have a consistent habit." + }, + { + "role": "user", + "content": "I usually experience seasonal allergies in $$$early April$$$. By $$$mid April$$$, they become severe, and by the $$$end of May$$$, I need to take stronger medication." + }, + { + "role": "assistant", + "content": "I usually experience seasonal allergies on 2024/04/01. By 2024/04/15, they become severe, and by 2024/05/31, I need to take stronger medication." + }, + { + "role": "user", + "content": "I started feeling unwell around the $$$middle of March 2021$$$. The symptoms were quite severe by the $$$20th of March$$$, which is when I decided to get tested. The test results came back positive for Covid-19 on $$$March 22nd, 2021$$$." + }, + { + "role": "assistant", + "content": "I started feeling unwell around the 2021/03/15. The symptoms were quite severe by the 2021/03/20, which is when I decided to get tested. The test results came back positive for Covid-19 on 2021/03/22." + } + ] } - }, - { +}, +{ "model": "extraction.prompt", "pk": 16, "fields": { - "name": "CREATE_PATIENT_JOURNEY", - "category": "zero-shot", - "text": [ - { - "role": "user", - "content": "Please outline the course of your Covid-19 infection, what you did (and when you did that) because of it and which doctors you may consulted. Please give some information about the time, in a few cases directly as a date and in the other as something in the lines of 'in the next days', 'the week after that' or similar. Give your outline as a continuous text. Also include if you later went for getting a vaccine and if so, how often. You don't have to include deals about who you are. Please include 100 to 400 words, but not more than 400." - } - ] + "name": "CREATE_PATIENT_JOURNEY", + "category": "zero-shot", + "text": [ + { + "role": "user", + "content": "Please outline the course of your Covid-19 infection, what you did (and when you did that) because of it and which doctors you may consulted. Please give some information about the time, in a few cases directly as a date and in the other as something in the lines of 'in the next days', 'the week after that' or similar. Give your outline as a continuous text. Also include if you later went for getting a vaccine and if so, how often. You don't have to include deals about who you are. Please include 100 to 400 words, but not more than 400." + } + ] + } +}, +{ + "model": "extraction.prompt", + "pk": 17, + "fields": { + "name": "PREPROCESSING_TIME_HOLIDAYS", + "category": "few shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text analysis and date formatting. Your task is to identify time information that is related to holidays and to convert them into concrete timestamps. Some relevant time specifications are highlighted with $$$ symbols in the text, focus on those. There are also time specifications highlighted, that are not holidays, ignore them. If no information about the year is given, assume the current year. Use the format YYYY/MM/DD. Only transform the time information that is related to holidays. Keep all other time information highlighted." + }, + { + "role": "user", + "content": "$$$Two days after$$$ $$$new years eve$$$, I started feeling sick." + }, + { + "role": "assistant", + "content": "$$$Two days after$$$ 2023/12/31, I started feeling sick." + }, + { + "role": "user", + "content": "I started feeling unusually fatigued right before $$$Thanksgiving 2020$$$." + }, + { + "role": "assistant", + "content": "I started feeling unusually fatigued right before 2020/11/26." + }, + { + "role": "assistant", + "content": "I always feel excited on 2023/10/31 and then exhausted the next day." + }, + { + "role": "user", + "content": "I visited my grandparents $$$two weeks before$$$ $$$Christmas$$$ last year." + }, + { + "role": "assistant", + "content": "I visited my grandparents $$$two weeks before$$$ 2022/12/25 last year." + }, + { + "role": "user", + "content": "We planned a big family reunion for $$$Easter$$$, but it got postponed." + }, + { + "role": "assistant", + "content": "We planned a big family reunion for 2023/04/09, but it got postponed." + }, + { + "role": "user", + "content": "My annual check-up is always scheduled for $$$mid June$$$, just after $$$Flag Day$$$." + }, + { + "role": "assistant", + "content": "My annual check-up is always scheduled for $$$mid June$$$, just after 2023/06/14." + } + ] + } +}, +{ + "model": "extraction.prompt", + "pk": 18, + "fields": { + "name": "PREPROCESSING_TIME_PROPAGATE", + "category": "few-shot", + "text": [ + { + "role": "system", + "content": "You are an expert in text understanding and information extraction. Your task is to propagate temporal information throughout a given text. For each sentence, append the latest known timestamp in the format --YYYY/MM/DD-- before the period. Instructions:1. Identify the most recent date mentioned up to and including the current sentence. This includes relative dates like 'after two weeks' or 'in the following das'. Translate these specifications into concrete dates, if you encounter them. 2. Only if no new temporal information is given, reuse the added timestamp from the previous sentence. 3.Append this date at the end of the current sentence before the period." + }, + { + "role": "user", + "content": "0: After experiencing the first symptoms of Covid-19 on 2020/09/13, I isolated myself at home.\n1: My symptoms started with a mild fever and worsened over the following days.\n2: By 2020/09/15, I developed difficulty breathing and consulted a doctor via telemedicine.\n3: The doctor advised me to monitor my symptoms closely and prescribed medications." + }, + { + "role": "assistant", + "content": "0: After experiencing the first symptoms of Covid-19 on 2020/09/13, I isolated myself at home--2020/09/13--.1: My symptoms started with a mild fever and worsened over the following days--2020/09/13--.2: By 2020/09/15, I developed difficulty breathing and consulted a doctor via telemedicine--2020/09/15--.3: The doctor advised me to monitor my symptoms closely and prescribed medications--2020/09/15--." + }, + { + "role": "user", + "content": "15: After a week in the hospital, my breathing got better, and they let me go home on 2022/01/25. 16: I was super happy to be back in my own bed, but I still felt exhausted." + }, + { + "role": "assistant", + "content": "15: After a week in the hospital, my breathing got better, and they let me go home on 2022/01/25--2022/01/25--.16: I was super happy to be back in my own bed, but I still felt exhausted--2022/01/25--." + } + ] } - } +} ] diff --git a/tracex_project/extraction/logic/modules/module_activity_labeler.py b/tracex_project/extraction/logic/modules/module_activity_labeler.py index e56789bf..ecb3228f 100644 --- a/tracex_project/extraction/logic/modules/module_activity_labeler.py +++ b/tracex_project/extraction/logic/modules/module_activity_labeler.py @@ -46,7 +46,7 @@ def execute( patient_journey_sentences ) activity_labels: pd.DataFrame = self.__extract_activities( - patient_journey_numbered, condition + patient_journey_numbered, condition, len(patient_journey_sentences) ) return activity_labels @@ -68,7 +68,7 @@ def __number_patient_journey_sentences(patient_journey_sentences: List[str]) -> @staticmethod def __extract_activities( - patient_journey_numbered: str, condition: Optional[str] + patient_journey_numbered: str, condition: Optional[str], number_of_senteces: int ) -> pd.DataFrame: """ Converts a Patient Journey, where every sentence is numbered, to a DataFrame with the activity labels by @@ -84,6 +84,12 @@ def __extract_activities( messages.append({"role": "user", "content": user_message}) activity_labels = u.query_gpt(messages).split("\n") df = pd.DataFrame(activity_labels, columns=[column_name]) - df[["activity", "sentence_id"]] = df["activity"].str.split(" #", expand=True) + try: + df[["activity", "sentence_id"]] = df["activity"].str.split( + " #", expand=True + ) + except ValueError: + scaling_factor = df.shape[0] / (number_of_senteces - 1) + df["sentence_id"] = df.reset_index().index * scaling_factor return df diff --git a/tracex_project/extraction/tests/test_orchestrator.py b/tracex_project/extraction/tests/test_orchestrator.py index 305b7a3e..c03a8522 100644 --- a/tracex_project/extraction/tests/test_orchestrator.py +++ b/tracex_project/extraction/tests/test_orchestrator.py @@ -118,7 +118,6 @@ def test_run(self): ) configuration.update( modules={ - "preprocessing": Preprocessor, "activity_labeling": ActivityLabeler, "cohort_tagging": CohortTagger, } diff --git a/tracex_project/extraction/tests/test_views.py b/tracex_project/extraction/tests/test_views.py index 383b2baa..af0d8cab 100644 --- a/tracex_project/extraction/tests/test_views.py +++ b/tracex_project/extraction/tests/test_views.py @@ -301,27 +301,6 @@ def test_get_context_data(self): self.assertIn("is_comparing", context) - # Non-deterministic test since orchestrator is executed - def test_form_valid(self): - """Test that a valid form submission redirects to the correct URL.""" - form_data = { - "modules_required": ["activity_labeling"], - "modules_optional": ["preprocessing", "event_type_classification"], - "event_types": ["Symptom Onset", "Symptom Offset"], - "locations": ["Home", "Hospital", "Doctors", "N/A"], - "activity_key": "event_type", - } - # Set up session data - session = self.client.session - session["is_comparing"] = False - session.save() - - # Submit the form using the test client - response = self.client.post(self.url, data=form_data) - - self.assertEqual(response.status_code, 302) - self.assertRedirects(response, reverse("result")) - def test_get_ajax(self): """ Test the `get` method when an AJAX request is made. @@ -338,70 +317,3 @@ def test_get_ajax(self): self.assertEqual( json.loads(response.content), {"progress": 50, "status": "running"} ) - - -class ResultViewTests(TestCase): - """Test cases for the ResultView.""" - - fixtures = ["tracex_project/tracex/fixtures/dataframe_fixtures.json"] - - def setUp(self): # pylint: disable=invalid-name - """Set up test client, a mock Patient Journey, session data and the URL.""" - self.client = Client() - self.mock_journey = PatientJourney.manager.create( - name="Test Journey", patient_journey="This is a test Patient Journey." - ) - self.session = self.client.session - self.session["selected_modules"] = ["activity_labeling", "cohort_tagging"] - self.session.save() - self.url = reverse("result") - - def test_view_get_request(self): - """Test that the view URL exists and is accessible by passing a GET request.""" - response = self.client.get(self.url) - resolver = resolve(self.url) - - self.assertEqual(response.status_code, 200) - self.assertEqual(resolver.func.view_class, ResultView) - - def test_uses_correct_template(self): - """Test that the view uses the correct template.""" - response = self.client.get(self.url) - - self.assertTemplateUsed(response, "result.html") - - def test_uses_correct_form(self): - """Test that the view uses the correct form.""" - response = self.client.get(self.url) - - self.assertIsInstance(response.context["form"], ResultForm) - - def test_get_form_kwargs(self): - """Test that correct form kwargs are passed to the form.""" - response = self.client.get(self.url) - - self.assertEqual(response.status_code, 200) - - form = response.context["form"] - - self.assertIsInstance(form, ResultForm) - self.assertEqual( - (form.initial["selected_modules"]), self.session["selected_modules"] - ) - - def test_get_context_data(self): - """Test that the view fetches the correct context data.""" - response = self.client.get(self.url) - - self.assertEqual(response.status_code, 200) - - context = response.context - - self.assertIn("form", context) - self.assertIsInstance(context["form"], ResultForm) - self.assertIn("journey", context) - self.assertEqual(context["journey"], self.mock_journey.patient_journey) - self.assertIn("dfg_img", context) - self.assertIn("trace_table", context) - self.assertIn("all_dfg_img", context) - self.assertIn("event_log_table", context) diff --git a/tracex_project/tracex/fixtures/dataframe_fixtures.json b/tracex_project/tracex/fixtures/dataframe_fixtures.json index fccef76f..48070174 100644 Binary files a/tracex_project/tracex/fixtures/dataframe_fixtures.json and b/tracex_project/tracex/fixtures/dataframe_fixtures.json differ diff --git a/tracex_project/tracex/settings.py b/tracex_project/tracex/settings.py index b360e9a9..bdfbf6e2 100644 --- a/tracex_project/tracex/settings.py +++ b/tracex_project/tracex/settings.py @@ -12,8 +12,6 @@ from pathlib import Path -from tracex.logic import constants as c - # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent