Gravitate-Health / mvp-issues

Gateway for issues/discussions/comments regarding MVPs development.
0 stars 0 forks source link

[SL] Create summary Lenses #30

Open joofio opened 5 months ago

joofio commented 5 months ago

starting it here. I have the infraestrucutre. I need to correct the prompt and how to convey the info, but the idea is this one. https://github.com/joofio/summary-lens

i am using openai. But we can explore others like mixtral's and meta's for example

joofio commented 5 months ago

13.2.2024: talk with Petra regarding the disclaimer. .joao add metadata about the model. (at least version, datetime and prompt). EDIT: [DONE]

aalonsolopez commented 4 months ago

hi there! for the moment, despite is not yet implemented as an "official" lens in the FOSPS, we have the first example of some tests I've been doing applying some prompt engineering. One is more formal, but it doesn't recognize the language, and the other is more informal and recognizes the language.

Test 1:

{
    "author": [
        {
            "display": "llama"
        }
    ],
    "category": [
        {
            "coding": [
                {
                    "code": "LP183761-8",
                    "display": "Report",
                    "system": "http://loinc.org"
                }
            ]
        }
    ],
    "date": "Mon, 11 Mar 2024 16:03:45 GMT",
    "id": "example",
    "identifier": [
        {
            "system": "http://healthintersections.com.au/test",
            "value": "1"
        }
    ],
    "note": [
        {
            "text": "Please provide me input of the most important aspects of taking the medicine namedBLASTON 1 mg tablets. Please explain it in a way a person with 77 years old can understand. Also take into account the patient is a female with the following diagnostics COPD - Chronic obstructive pulmonary disease and Congestive heart failure and Osteoporosis and Diabetes mellitus type 2 and medications Karvea 75 mg/ 1 tablet, Tablet and Boots Decongestant 0.05% w/v Nasal spray and Skilarence 120 mg gastro-resistant tablets. Please explain the pros and cons of the medication. Especially for the other medication i am taking and conditions. Please respond in Spanish"
        }
    ],
    "resourceType": "Composition",
    "section": [
        {
            "code": {
                "coding": [
                    {
                        "code": "10157-6",
                        "display": "History of family member diseases Narrative",
                        "system": "http://loinc.org"
                    }
                ]
            },
            "emptyReason": {
                "coding": [
                    {
                        "code": "withheld",
                        "display": "Information Withheld",
                        "system": "http://terminology.hl7.org/CodeSystem/list-empty-reason"
                    }
                ]
            },
            "text": {
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">¡Hola! Entiendo que quieres conocer los aspectos más importantes de tomar los tabletas BLASTON 1 mg. Para ayudarte a entender mejor, te proporciono la información en un lenguaje fácil de entender y considerando tus condiciones médicas actuales y las medicaciones que estás tomando.\n\nFirstly, BLASTON 1 mg es un medicamento utilizado para tratar el síndrome del sueño por problemas respiratorios no relacionados con la falta de sueño. Es importante tener en cuenta que este medicamento solo debe ser tomado bajo supervisión médica y debe ser utilizado según las instrucciones del profesional de la salud.\n\nA continuación, te menciono algunos aspectos importantes de BLASTON 1 mg:\n\n1. Indicaciones: El BLASTON 1 mg es indicado para el síndrome del sueño por problemas respiratorios no relacionados con la falta de sueño. Es importante tener en cuenta que este medicamento solo debe ser tomado bajo supervisión médica y debe ser utilizado según las instrucciones del profesional de la salud.\n2. Contraindicaciones: El BLASTON 1 mg no debe ser utilizado en caso de:\n\t* Alergias a los componentes del medicamento o a otros medicamentos similares.\n\t* Problemas respiratorios graves, como la apnea del sueño o la fibrosis quística.\n\t* Edad avanzada (mayor de 70 años).\n3. Efectos secundarios: Los efectos secundarios más comunes del BLASTON 1 mg incluyen somnolencia, confusión, dolor de cabeza, náuseas y vómitos. Es importante tener en cuenta que estos efectos secundarios pueden ser temporales y disminuyen con el tiempo.\n4. Interacciones con otras medicaciones: El BLASTON 1 mg puede interactuar con ciertas medicaciones, como las betabloqueantes, los inhibidores de la monoaminooxidasa (IMAO) y los antidepresivos. Es importante informar al profesional de la salud de todas las medicaciones que estás tomando para evitar cualquier interacción adversa.\n5. Dosis y duración del tratamiento: La dosis recomendada de BLASTON 1 mg es una tableta única por noche. Es importante seguir las instrucciones del profesional de la salud y tomar el medicamento exactamente como indiquen. El tratamiento debe ser continuo durante un período de tiempo prolongado para asegurarse de que los síntomas son controlados adecuadamente.\n6. Preguntas frecuentes: ¿Cómo puedo tomar el BLASTON 1 mg? ¿Cuánto tiempo debe durar el tratamiento? ¿Qué sucede si no tomo el medicamento según las instrucciones del profesional de la salhe? Es importante tener en cuenta que estas preguntas pueden ser resueltas por tu profesional de la salud.\n\nEn cuanto a las medicaciones que estás tomando actualmente, es importante mencionar que el Karvea 75 mg puede interactuar con el BLASTON 1 mg. Es importante informar al profesional de la salud de todas las medicaciones que estás tomando para evitar cualquier interacción adversa.\n\nEn cuanto a la osteoporosis, es importante mencionar que el Skilarence 120 mg no interactúa con el BLASTON 1 mg. Sin embargo, es importante mencionar que el Skilarence puede causar somnolencia y confusión, lo que puede afectar la capacidad para realizar actividades diarias.\n\nEn cuanto al Diabetes mellitus tipo 2, es importante mencionar que el Boots Decongestant 0.05% w/v Nasal spray no interactúa con el BLASTON 1 mg. Sin embargo, es importante mencionar que el Boots Decongestant puede causar somnolencia y confusión, lo que puede afectar la capacidad para realizar actividades diarias.\n\nEspero que esta información te sea útil y ayude a entender mejor los aspectos más importantes de tomar los tabletas BLASTON 1 mg. Recuerda siempre consultar con tu profesional de la salud antes de tomar cualquier medicamento o realizar cualquier cambio en tus medicamentos existentes. ¡Manténme informado sobre cualquier otro tema médico que te interese!</div>",
                "status": "generated"
            },
            "title": "History of family member diseases"
        }
    ],
    "status": "final",
    "title": "Consultation Note",
    "type": {
        "coding": [
            {
                "code": "11488-4",
                "display": "Consult note",
                "system": "http://loinc.org"
            }
        ]
    }
}

Test 2


{
    "author": [
        {
            "display": "graviting-llama"
        }
    ],
    "category": [
        {
            "coding": [
                {
                    "code": "LP183761-8",
                    "display": "Report",
                    "system": "http://loinc.org"
                }
            ]
        }
    ],
    "date": "Wed, 13 Mar 2024 13:22:35 GMT",
    "id": "example",
    "identifier": [
        {
            "system": "http://healthintersections.com.au/test",
            "value": "1"
        }
    ],
    "note": [
        {
            "text": "The drug name is BLASTON 1 mg tablets. Please explain it in a way a person with 77 years old can understand. Also take into account the patient is a female with the following diagnostics COPD - Chronic obstructive pulmonary diseaseCongestive heart failureOsteoporosisDiabetes mellitus type 2 and medications Karvea 75 mg/ 1 tablet, TabletBoots Decongestant 0.05% w/v Nasal spraySkilarence 120 mg gastro-resistant tablets. Please explain the pros and cons of the medication. Especially for the other medication I am taking and conditions. You must answer in Spanish"
        }
    ],
    "resourceType": "Composition",
    "section": [
        {
            "code": {
                "coding": [
                    {
                        "code": "10157-6",
                        "display": "History of family member diseases Narrative",
                        "system": "http://loinc.org"
                    }
                ]
            },
            "emptyReason": {
                "coding": [
                    {
                        "code": "withheld",
                        "display": "Information Withheld",
                        "system": "http://terminology.hl7.org/CodeSystem/list-empty-reason"
                    }
                ]
            },
            "text": {
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\nBLASTON is a medicine that helps to prevent or treat asthma symptoms. It contains an active ingredient called montelukast which blocks the action of chemicals released by cells in the body during an allergic reaction. The patient's COPD, Congestive heart failure, Osteoporosis and Diabetes mellitus type 2 are conditions that could be worsened if she takes this medication. It is important to consult with her doctor about the risks of taking BLASTON considering her medical history. The leaflet provides information on how to use the drug, its potential side effects and interactions, as well as what to do in case of an overdose or other emergencies. It's a good idea for the patient to read it carefully.\nThe patient should be aware that BLASTON is not intended for people with severe liver disease, kidney disease, heart failure, or lung disease. She also needs to know that this medication can increase the risk of bleeding in people with stomach ulcers or other gastrointestinal problems. Also, it's important to note that BLASTON may interact with other medications she is taking such as warfarin or cimetidine. It's essential that her doctor monitors her closely and adjusts the dose of any drugs she's taking if necessary.</div>",
                "status": "generated"
            },
            "title": "History of family member diseases"
        }
    ],
    "status": "final",
    "title": "Consultation Note",
    "type": {
        "coding": [
            {
                "code": "11488-4",
                "display": "Consult note",
                "system": "http://loinc.org"
            }
        ]
    }
}

@joofio 2 disclaimers: The first one is with basic llama and the chat mode, and the second one is using a custom modelfile "Graviting-LLaMa" which modifies a bit the parameters of the model "medllama2" and using "gererate" mode instead of "chat" mode.

I hope you like this and all the feedback is welcome :)

joofio commented 4 months ago

can i access it by a specific url?

aalonsolopez commented 4 months ago

http://gravitate-health.lst.tfo.upm.es/ai/summary/bundlepackageleaflet-es-da0fc2395ce219262dfd4f0c9a9f72e1?preprocessors=preprocessing-service-manual&patientIdentifier=Cecilia-1&lenses=lens-summary-2&model=graviting-llama

joofio commented 4 months ago

how did you add the configs to llama?

aalonsolopez commented 4 months ago

Oh, i do it manually... Uploading the modelfile to our ollama server. The modelfile is here

joofio commented 4 months ago

ok seems ok. Is the version updated in the fosps? It seems to still respond wit the "of course..." and please change the datetime to another format like "2023-06-27T10:09:22Z"

aalonsolopez commented 4 months ago

noted, i will revise it... regarding to the 2 tests I sent, which one you prefer the most?

joofio commented 4 months ago

the second since it doesnt have the part of the "certainly and so". but can we change it so it speaks "to" the person, instead of "someone taking care of the person"?

aalonsolopez commented 4 months ago

great!