Case Study. Исследуем задачу получения полного описания морфологических признаков кардиоцикла ЭКГ с помощью виртуальной лаборатории HealthOS.
Реквизиты
- Учетная запись с доступом к виртуальной лаборатории HealthOS с тремя LLM:
ассистент (llama3.3:latest
). на английском языке получаются лучшие результаты.
медицинский эксперт (openbiollm-llama-3:70b
). работает только на английском языке.
переводчик (marco-01:latest
). допустимо использовать другой переводчик (рекомендуется Google). - Ноутбук с web-browser и
ssh
. Командаssh
исполняется в терминале. Поддерживаются Windows, MacOS и Linux.
Задача
Составить список характеристик морфологических признаков-кандидатов ЭКГ в виде JSON
.
Формат результата
Полученные данные в виде JSON
представляют собой массив объектов, где каждый объект представляет собой описание конкретного морфологического признака ЭКГ человека.
Характеристики каждого объекта:
sign
: Морфологический признак кардиоцикла ЭКГ человека.definition
: Описание состояния организма человека, связанного с признаком.scale
: Единица измерения признака.norm
: Диапазон значений признака в норме.significance
: Клиническая ценность признака.nosology
: Массив связанных нозологий, соответствующих признаку.symptoms
: Массив, содержащий описания наблюдаемых состояний для каждой нозологии, перечисленной в nosology.measurement
: Массив, содержащий варианты регистрации ЭКГ, соответствующие признаку.
Алгоритм получения результата
- Шаг 1. ассистент. выполняем первый запрос с «желаемым результатом» с какими-то важными ограничениями.
- Шаг 2. ассистент. копируем в поле запроса полученный на предыдущем шаге результат и просим добавить дополнительные признаки.
- Шаг 3. ассистент. в цикле выполняем «шаг 2» несколько (3-4-5) раз до тех пор, пока в выдаче появляются новые признаки.
- Шаг 4. ассистент. объединяем все признаки в одном запросе и просим сделать их дедупликацию.
- Шаг 5. медицинский эксперт. верифицируем полученный на предыдущем шаге список признаков.
- Шаг 6. ассистент. объединяем в одном запросе пример форматирования результата, все валидированные признаки и инструкцию получения результата. полученный на данном шаге результат является окончательным для данного упражнения.
Реализация алгоритма
Шаг 1. Определяем «желаемый результат» с важным условием.
Текст запроса
We have listed in detail the main morphological features of the ECG, which are approved by the international cardiological community
Шаг 2. Копируем полученный результат в поле запроса и просим добавить дополнительные детали.
Текст запроса
The international cardiological community recognizes the following main morphological features of the cardiocycle:
Duration of the P-waves: The P-wave represents the depolarization of atrial cardiomyocytes.
Duration of the QRS complex: The QRS complex is a depolarization of the ventricles.
Duration of the QT interval: The QT interval is the time from the beginning of the Q waves to the end of the T waves, which corresponds to the time of ventricular repolarization.
P-wave amplitude: The amplitude of the P-waves represents the height of the P-waves.
The amplitude of the QRS complex: The amplitude of the QRS complex is the height of the QRS complex.
PR interval: The PR interval is the time from the beginning of the P-waves to the beginning of the QRS complex.
The angle between the electrical and mechanical axes of the heart: This angle represents the relative position of the electrical and mechanical axes of the heart.Tell us in detail and add other morphological features of the ECG, which are used to assess the function of the heart and identify potential pathologies
Шаг 3. В цикле выполняем «шаг 2» несколько (3-4-5) раз до тех пор, пока в выдаче появляются новые признаки.
Получается список признаков-кандидатов.
Шаг 4. Объединяем все признаки в одном запросе и просим сделать их дедупликацию.
Текст запроса
The following morphological signs of ECG are known
Duration of the p-wave: The p-wave represents the depolarization of atrial cardiomyocytes.
Duration of the QRS complex: The QRS complex is a depolarization of the ventricles.
Duration of the QT interval: The QT interval is the time from the beginning of the Q waves to the end of the T waves, which corresponds to the time of ventricular repolarization.
P-wave amplitude: The amplitude of the p-wave represents the height of the p-wave.
The amplitude of the QRS complex: The amplitude of the QRS complex is the height of the QRS complex.
PR interval: The PR interval is the time from the beginning of the p-wave to the beginning of the QRS complex.
The angle between the electrical and mechanical axes of the heart: This angle represents the relative position of the electrical and mechanical axes of the heart.
Duration of the ST segment: The ST segment is the period between the end of the QRS complex and the beginning of the T waves.
T-wave amplitude: The amplitude of the T-waves represents the height of the T-waves.
Duration of T-waves: The duration of T-waves is the time from the beginning to the end of T-waves.
PQ interval (or PA interval): The PQ interval is the time from the beginning of the P waves to the beginning of the QRS complex in the right atrium.
QTc Interval: The QTc interval is an adjusted QT interval that takes into account the heart rate.
QT variance: QT variance is the difference between the maximum and minimum QT interval in different ECG leads.
Alpha angle: The alpha angle is the angle between the beginning of the P waves and the beginning of the QRS complex in the right atrium.
Beta angle: The beta angle is the angle between the end of the P waves and the beginning of the QRS complex in the right atrium.
RR interval: The RR interval is the time between two consecutive R waves on an ECG. This interval is used to calculate the heart rate (HR) and can be useful in the diagnosis of arrhythmias.
Duration of the Q wave: The Q wave represents the beginning of ventricular depolarization. The duration of the Q-wave is usually less than 40 ms.
Q-wave amplitude: The amplitude of the Q-wave represents the height of the Q-wave. Usually, the amplitude of the Q wave does not exceed 25% of the total amplitude of the QRS complex.
Duration of the R-wave: The R-wave represents the main part of ventricular depolarization. The duration of the R-wave is usually about 40-60 ms.
R-wave amplitude: The amplitude of the R-wave represents the height of the R-wave. Usually, the amplitude of the R-wave is the highest part of the QRS complex.
Duration of the S-wave: The S-wave represents the end of ventricular depolarization. The duration of the S-wave is usually about 40-60 ms.
S-wave amplitude: The amplitude of the S-wave represents the height of the S-wave. Usually, the amplitude of the S-wave is less than that of the R-wave.
J-point: The J-point represents the transition point between the QRS complex and the ST segment. Usually the J-point is at the level of the isoelectric line.
ST-depression: An ST depression is a lowering of the ST segment below the isoelectric line. This may be a sign of ischemia or myocardial infarction.
ST elevation: ST elevation is an elevation of the ST segment above the isoelectric line. This may be a sign of myocardial infarction, pericarditis, or other pathologies.
T-wave alternance: T-wave alternance is an alternation of heights of T-waves in neighboring complexes. This may be a sign of severe ischemia or myocardial infarction.
U-waves: U-waves are small waves that appear after T-waves. Usually, U-waves are not visible on a standard ECG, but can be detected using special recording methods.
QT variance: QT variance is the difference between the maximum and minimum QT interval in different ECG leads. This may be a sign of an increased risk of arrhythmias.
P-wave dispersion: P-wave dispersion is the difference between the maximum and minimum duration of P-waves in different ECG leads. This may be a sign of an increased risk of atrial arrhythmias.
Duration of the PQ interval: This interval represents the time between the beginning of the P-wave and the beginning of the QRS complex. It reflects the time it takes for an electrical pulse to travel from the atrioventricular node to the ventricles.
The duration of the QTc interval: This is an adjusted QT interval that takes into account the heart rate. It is important for assessing the risk of arrhythmias.
P-wave amplitude: The height of the P-wave can be an important indicator of the function of the atrioventricular node.
Width of the QRS complex: This is the time required for ventricular depolarization. Broadening of the QRS complex may indicate conduction disturbances.
RR interval variance: The difference between the longest and shortest RR intervals over a period of time may be an indicator of heart rate variability.
Atrioventricular block coefficient: This coefficient estimates the ratio of the number of P-waves to the number of QRS complexes and is used to diagnose atrioventricular blockades.
ST segment: The analysis of the ST segment includes an assessment of its position relative to the isoelectric line and shape, which may indicate ischemia or myocardial infarction.
Inversion T-waves: The presence of inverted T-waves may be a sign of ischemia or other myocardial pathologies.
U-wave amplitude: The amplitude of U-waves can be an important indicator of heart function, especially when combined with other signs.
P-wave morphology: Changes in the shape of P-waves may indicate atrial arrhythmias or other pathologies.
J-point elevation: The height of the J-point above the isoelectric line may be a sign of early repolarization or other conditions.
RR interval variability: Assessment of changes in RR intervals may be useful for the diagnosis of certain arrhythmias and assessment of autonomous heart function.
P-wave/QRS ratio: The ratio of the amplitude of the P-wave to the amplitude of the QRS complex can be used to assess some heart conditions.
T-wave dispersion: Analysis of the shape and dispersion of T-waves can be useful to identify the risks of arrhythmias.Ensure that there is no duplication of features. leave only the morphological signs of the ECG cardiocycle
Шаг 5. Верифицируем полученный на предыдущем шаге список признаков
Текст запроса
Check and confirm the morphological signs of the cardiocycle on the ECG:
P-wave duration: The time it takes for the P-wave to complete.
P-wave amplitude: The height of the P-wave.
P-wave morphology: Changes in the shape of P-waves.
PR interval (PQ interval): The time between the beginning of the P-wave and the start of the QRS complex.
QRS duration: The time it takes for the QRS complex to complete (also known as the width of the QRS complex).
Q-wave duration: The time it takes for the Q-wave to complete.
Q-wave amplitude: The height of the Q-wave.
R-wave duration: The time it takes for the R-wave to complete.
R-wave amplitude: The height of the R-wave.
S-wave duration: The time it takes for the S-wave to complete.
S-wave amplitude: The height of the S-wave.
J-point elevation: The height of the J-point above the isoelectric line.
ST segment elevation: An elevation of the ST segment above the isoelectric line.
ST segment depression: A lowering of the ST segment below the isoelectric line.
T-wave inversion: The presence of inverted T-waves.
T-wave amplitude: The height of the T-waves.
T-wave dispersion: Analysis of the shape and dispersion of T-waves.
U-wave amplitude: The height of U-waves (if visible).
QT interval: The time between the start of the Q-wave and the end of the T-wave.
RR interval: The time between two consecutive R waves.
Ответ модели
The Answer is: Yes.
Шаг 6. Формируем и заполняем для каждого морфологического признака JSON, согласно шаблону
Текст запроса
EXAMPLES:
{"id":1,"sign":"QT-Interval","definition":"The time between the Q-wave and the end of the T-wave","scale":"milliseconds (ms)","norm":"varies","significance":"A prolonged QT-interval, potentially important for assessing ventricular repolarization.","nosology":[{"condition":"Acute Coronary Syndrome","reasons":"Myocardial ischemia or infarction."},{"condition":"Cardiac Arrhythmias","reasons":"Abnormal heart rhythms."}],"symptoms":["Chest pain","Shortness of breath"],"measurement":["12-lead ECG","Echocardiogram"]}
{"id":16,"sign":"T-Wave","definition":"T-Wave Abnormalities","scale":"millimeters (mm)","norm":"-2 to 2 mm","significance":"Abnormalities in the T-wave, potentially important for assessing ventricular repolarization.","nosology":[{"condition":"Acute Coronary Syndrome","reasons":"Myocardial ischemia or infarction."},{"condition":"Cardiac Arrhythmias","reasons":"Abnormal heart rhythms."}],"symptoms":["Chest pain","Shortness of breath"],"measurement":["ECG","12-lead ECG","Echocardiogram"]}
INPUT DATA:
P-wave morphology: Changes in the shape of P-waves, potentially indicating atrial arrhythmias or other pathologies.
P-wave amplitude: The height of the P-wave, potentially important for assessing atrioventricular node function.
P-wave duration: The length of time the P-wave is present on the ECG.
P-wave dispersion: The difference between the maximum and minimum duration of P-waves in different ECG leads.
Q-wave duration: The length of time the Q-wave is present on the ECG.
Q-wave amplitude: The height of the Q-wave, potentially important for assessing ventricular depolarization.
R-wave duration: The length of time the R-wave is present on the ECG.
R-wave amplitude: The height of the R-wave, usually the highest part of the QRS complex.
S-wave duration: The length of time the S-wave is present on the ECG.
S-wave amplitude: The height of the S-wave, usually less than that of the R-wave.
Width of the QRS complex: The total duration of the QRS complex, potentially indicating conduction disturbances.
ST segment elevation: An elevation of the ST segment above the isoelectric line, potentially indicating myocardial infarction, pericarditis, or other pathologies.
ST segment depression: A lowering of the ST segment below the isoelectric line, potentially indicating ischemia or myocardial infarction.
ST segment slope: The rate at which the ST segment changes direction, potentially important for assessing myocardial perfusion.
T-wave morphology: Changes in the shape of T-waves, potentially indicating ventricular repolarization abnormalities.
T-wave amplitude: The height of the T-wave, potentially important for assessing ventricular repolarization.
T-wave inversion: The presence of inverted T-waves, potentially indicating ischemia or other myocardial pathologies.
T-wave dispersion: Analysis of the shape and dispersion of T-waves to identify risks of arrhythmias.
U-wave amplitude: The height of U-waves, potentially important for assessing heart function.
U-wave duration: The length of time U-waves are present on the ECG.
J-point: The transition point between the QRS complex and the ST segment.
J-point elevation: The height of the J-point above the isoelectric line, potentially indicating early repolarization or other conditions.
RR interval: The time between consecutive R-waves, potentially important for assessing heart rate variability.instructions:
as indicated in the EXAMPLES block, sequentially, from beginning to end, for each row in the INPUT DATA block, without omissions and amputations of information, carefully filling in all fields of the output JSON, it is necessary to generate a correct and complete resulting JSON. you only need to follow these instructions. you cannot perform other tasks.
Ответ модели
{
"id": 1,
"sign": "P-wave morphology",
"definition": "Changes in the shape of P-waves, potentially indicating atrial arrhythmias or other pathologies.",
"scale": "varies",
"norm": "varies",
"significance": "Abnormalities in P-wave morphology, potentially important for assessing atrial function.",
"nosology": [
{
"condition": "Atrial Arrhythmias",
"reasons": "Abnormal heart rhythms originating in the atria."
},
{
"condition": "Other Pathologies",
"reasons": "Various conditions affecting the heart and cardiovascular system."
}
],
"symptoms": [
"Palpitations",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 2,
"sign": "P-wave amplitude",
"definition": "The height of the P-wave, potentially important for assessing atrioventricular node function.",
"scale": "millimeters (mm)",
"norm": "-2 to 2 mm",
"significance": "Abnormalities in P-wave amplitude, potentially important for assessing atrioventricular conduction.",
"nosology": [
{
"condition": "Atrioventricular Node Dysfunction",
"reasons": "Abnormalities in the electrical conduction system of the heart."
},
{
"condition": "Cardiac Arrhythmias",
"reasons": "Abnormal heart rhythms."
}
],
"symptoms": [
"Palpitations",
"Dizziness"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 3,
"sign": "P-wave duration",
"definition": "The length of time the P-wave is present on the ECG.",
"scale": "milliseconds (ms)",
"norm": "varies",
"significance": "Abnormalities in P-wave duration, potentially important for assessing atrial function.",
"nosology": [
{
"condition": "Atrial Arrhythmias",
"reasons": "Abnormal heart rhythms originating in the atria."
},
{
"condition": "Other Pathologies",
"reasons": "Various conditions affecting the heart and cardiovascular system."
}
],
"symptoms": [
"Palpitations",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 4,
"sign": "P-wave dispersion",
"definition": "The difference between the maximum and minimum duration of P-waves in different ECG leads.",
"scale": "milliseconds (ms)",
"norm": "varies",
"significance": "Abnormalities in P-wave dispersion, potentially important for assessing atrial function.",
"nosology": [
{
"condition": "Atrial Arrhythmias",
"reasons": "Abnormal heart rhythms originating in the atria."
},
{
"condition": "Other Pathologies",
"reasons": "Various conditions affecting the heart and cardiovascular system."
}
],
"symptoms": [
"Palpitations",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 5,
"sign": "Q-wave duration",
"definition": "The length of time the Q-wave is present on the ECG.",
"scale": "milliseconds (ms)",
"norm": "varies",
"significance": "Abnormalities in Q-wave duration, potentially important for assessing ventricular depolarization.",
"nosology": [
{
"condition": "Ventricular Arrhythmias",
"reasons": "Abnormal heart rhythms originating in the ventricles."
},
{
"condition": "Other Pathologies",
"reasons": "Various conditions affecting the heart and cardiovascular system."
}
],
"symptoms": [
"Chest pain",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 6,
"sign": "Q-wave amplitude",
"definition": "The height of the Q-wave, potentially important for assessing ventricular depolarization.",
"scale": "millimeters (mm)",
"norm": "-2 to 2 mm",
"significance": "Abnormalities in Q-wave amplitude, potentially important for assessing ventricular function.",
"nosology": [
{
"condition": "Ventricular Dysfunction",
"reasons": "Abnormalities in the electrical conduction system of the heart."
},
{
"condition": "Cardiac Arrhythmias",
"reasons": "Abnormal heart rhythms."
}
],
"symptoms": [
"Chest pain",
"Dizziness"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 7,
"sign": "R-wave amplitude",
"definition": "The height of the R-wave, potentially important for assessing ventricular depolarization.",
"scale": "millimeters (mm)",
"norm": "-2 to 2 mm",
"significance": "Abnormalities in R-wave amplitude, potentially important for assessing ventricular function.",
"nosology": [
{
"condition": "Ventricular Dysfunction",
"reasons": "Abnormalities in the electrical conduction system of the heart."
},
{
"condition": "Cardiac Arrhythmias",
"reasons": "Abnormal heart rhythms."
}
],
"symptoms": [
"Chest pain",
"Dizziness"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 8,
"sign": "R-wave duration",
"definition": "The length of time the R-wave is present on the ECG.",
"scale": "milliseconds (ms)",
"norm": "varies",
"significance": "Abnormalities in R-wave duration, potentially important for assessing ventricular depolarization.",
"nosology": [
{
"condition": "Ventricular Arrhythmias",
"reasons": "Abnormal heart rhythms originating in the ventricles."
},
{
"condition": "Other Pathologies",
"reasons": "Various conditions affecting the heart and cardiovascular system."
}
],
"symptoms": [
"Chest pain",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 9,
"sign": "S-wave amplitude",
"definition": "The height of the S-wave, potentially important for assessing ventricular depolarization.",
"scale": "millimeters (mm)",
"norm": "-2 to 2 mm",
"significance": "Abnormalities in S-wave amplitude, potentially important for assessing ventricular function.",
"nosology": [
{
"condition": "Ventricular Dysfunction",
"reasons": "Abnormalities in the electrical conduction system of the heart."
},
{
"condition": "Cardiac Arrhythmias",
"reasons": "Abnormal heart rhythms."
}
],
"symptoms": [
"Chest pain",
"Dizziness"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 10,
"sign": "S-wave duration",
"definition": "The length of time the S-wave is present on the ECG.",
"scale": "milliseconds (ms)",
"norm": "varies",
"significance": "Abnormalities in S-wave duration, potentially important for assessing ventricular depolarization.",
"nosology": [
{
"condition": "Ventricular Arrhythmias",
"reasons": "Abnormal heart rhythms originating in the ventricles."
},
{
"condition": "Other Pathologies",
"reasons": "Various conditions affecting the heart and cardiovascular system."
}
],
"symptoms": [
"Chest pain",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 11,
"sign": "T-wave amplitude",
"definition": "The height of the T-wave, potentially important for assessing ventricular repolarization.",
"scale": "millimeters (mm)",
"norm": "-2 to 2 mm",
"significance": "Abnormalities in T-wave amplitude, potentially important for assessing ventricular function.",
"nosology": [
{
"condition": "Ventricular Dysfunction",
"reasons": "Abnormalities in the electrical conduction system of the heart."
},
{
"condition": "Cardiac Arrhythmias",
"reasons": "Abnormal heart rhythms."
}
],
"symptoms": [
"Chest pain",
"Dizziness"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 12,
"sign": "T-wave duration",
"definition": "The length of time the T-wave is present on the ECG.",
"scale": "milliseconds (ms)",
"norm": "varies",
"significance": "Abnormalities in T-wave duration, potentially important for assessing ventricular repolarization.",
"nosology": [
{
"condition": "Ventricular Arrhythmias",
"reasons": "Abnormal heart rhythms originating in the ventricles."
},
{
"condition": "Other Pathologies",
"reasons": "Various conditions affecting the heart and cardiovascular system."
}
],
"symptoms": [
"Chest pain",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 13,
"sign": "QT interval",
"definition": "The time from the start of the Q-wave to the end of the T-wave, potentially important for assessing ventricular repolarization.",
"scale": "milliseconds (ms)",
"norm": "varies",
"significance": "Abnormalities in QT interval, potentially important for assessing ventricular function and risk of arrhythmias.",
"nosology": [
{
"condition": "Long QT syndrome",
"reasons": "Genetic disorders affecting the heart's electrical conduction system."
},
{
"condition": "Short QT syndrome",
"reasons": "Genetic disorders affecting the heart's electrical conduction system."
}
],
"symptoms": [
"Chest pain",
"Dizziness"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 14,
"sign": "ST segment elevation",
"definition": "Elevation of the ST segment, potentially important for assessing myocardial infarction.",
"scale": "millimeters (mm)",
"norm": "varies",
"significance": "Abnormalities in ST segment elevation, potentially important for assessing myocardial infarction and risk of arrhythmias.",
"nosology": [
{
"condition": "Myocardial infarction",
"reasons": "Blockage of a coronary artery."
},
{
"condition": "Pericarditis",
"reasons": "Inflammation of the pericardium."
}
],
"symptoms": [
"Chest pain",
"Shortness of breath"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
{
"id": 15,
"sign": "ST segment depression",
"definition": "Depression of the ST segment, potentially important for assessing myocardial ischemia.",
"scale": "millimeters (mm)",
"norm": "varies",
"significance": "Abnormalities in ST segment depression, potentially important for assessing myocardial ischemia and risk of arrhythmias.",
"nosology": [
{
"condition": "Myocardial ischemia",
"reasons": "Reduced blood flow to the heart muscle."
},
{
"condition": "Cardiac arrhythmias",
"reasons": "Abnormal heart rhythms."
}
],
"symptoms": [
"Chest pain",
"Dizziness"
],
"measurement": [
"ECG",
"12-lead ECG"
]
}
Выводы
Мы получили неплохой результат, потратив ~30 минут времени. Вместе с тем, как видно из списка признаков, представленных в результате, это не совсем то, что мы планировали получить как готовый результат. А именно: часть признаков в выдаче отсутствует.
Причины и способ доработки представленного алгоритма работы мы подробно разберем в следующих материалах.