diff --git a/examples/extract_key_values_from_cbc_reports_in_different_layout.ipynb b/examples/extract_key_values_from_cbc_reports_in_different_layout.ipynb index a553b43..10dc195 100644 --- a/examples/extract_key_values_from_cbc_reports_in_different_layout.ipynb +++ b/examples/extract_key_values_from_cbc_reports_in_different_layout.ipynb @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -59,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -78,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -100,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -171,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -267,6 +267,10 @@ " 'MONOCYTES': '7.0',\n", " 'EOSINOPHILS': '3.0',\n", " 'BASOPHIL': '0.0',\n", + " 'PROMYELOCYTES': 'NA',\n", + " 'MYELOCYTES': 'NA',\n", + " 'METAMYELOCYTES': 'NA',\n", + " 'BLASTS': 'NA',\n", " 'PLATELETS': '210.0',\n", " 'RETICULOCYTE COUNT': 'NA'}]},\n", " {'result': [{'NAME': 'Test Patient 14',\n", @@ -325,7 +329,7 @@ "metadata": {}, "source": [ "## Output Analysis\n", - "Now, we will analyze the output and compare it with the expected result. We'll take not of any missing keys, any additional keys added by OpenParser, and any incorrect values." + "Now, we will analyze the output and compare it with the expected result. We'll take note of any missing keys, any additional keys added by OpenParser, and any incorrect values." ] }, { @@ -346,11 +350,7 @@ "REPORT 2\n", "\n", "Key DIFFERENTIAL LEUCOCYTE COUNT not found in report 2\n", - "Key PROMYELOCYTES not found in report 2\n", - "Key MYELOCYTES not found in report 2\n", - "Key METAMYELOCYTES not found in report 2\n", - "Key BLASTS not found in report 2\n", - "Summary: {'missing_keys': ['DIFFERENTIAL LEUCOCYTE COUNT', 'PROMYELOCYTES', 'MYELOCYTES', 'METAMYELOCYTES', 'BLASTS'], 'additional_keys': [], 'incorrect_keys': []}\n", + "Summary: {'missing_keys': ['DIFFERENTIAL LEUCOCYTE COUNT'], 'additional_keys': [], 'incorrect_keys': []}\n", "---------------------------------------------------\n", "REPORT 3\n", "\n", @@ -417,185 +417,177 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/var/folders/39/ddf_qmj154l0k4jvqgngmxjm0000gn/T/ipykernel_59224/2497480378.py:16: FutureWarning: Styler.applymap has been deprecated. Use Styler.map instead.\n", - " styled_df = df.style.applymap(highlight_incorrect_keys)\n" - ] - }, { "data": { "text/html": [ "\n", - "
\n", - " | CBC_ReportSample_1.png | \n", - "CBC_ReportSample_12.jpeg | \n", - "CBC_ReportSample_14.jpeg | \n", - "CBC_ReportSample_20.jpeg | \n", + "CBC_ReportSample_1.png | \n", + "CBC_ReportSample_12.jpeg | \n", + "CBC_ReportSample_14.jpeg | \n", + "CBC_ReportSample_20.jpeg | \n", "|
---|---|---|---|---|---|---|---|---|---|
NAME | \n", - "Test Patient A | \n", - "TEST PATIENT 12 | \n", - "Test Patient 14 | \n", - "Test Patient 20 | \n", + "NAME | \n", + "Test Patient A | \n", + "TEST PATIENT 12 | \n", + "Test Patient 14 | \n", + "Test Patient 20 | \n", "
HAEMOGLOBIN | \n", - "12.6 | \n", - "12.8 | \n", - "14.8 | \n", - "11.3 | \n", + "HAEMOGLOBIN | \n", + "12.6 | \n", + "12.8 | \n", + "14.8 | \n", + "11.3 | \n", "
RBC (RED CELLS COUNT) | \n", - "4.54 | \n", - "4.5 | \n", - "5.22 | \n", - "4.2 | \n", + "RBC (RED CELLS COUNT) | \n", + "4.54 | \n", + "4.5 | \n", + "5.22 | \n", + "4.2 | \n", "
HAEMATOCRIT(PCV) | \n", - "38.1 | \n", - "42.0 | \n", - "45.2 | \n", - "35 | \n", + "HAEMATOCRIT(PCV) | \n", + "38.1 | \n", + "42.0 | \n", + "45.2 | \n", + "35 | \n", "
MCV | \n", - "83.9 | \n", - "93.0 | \n", - "86.6 | \n", - "82 | \n", + "MCV | \n", + "83.9 | \n", + "93.0 | \n", + "86.6 | \n", + "82 | \n", "
MCH | \n", - "27.8 | \n", - "28.0 | \n", - "28.4 | \n", - "27 | \n", + "MCH | \n", + "27.8 | \n", + "28.0 | \n", + "28.4 | \n", + "27 | \n", "
MCHC | \n", - "33.1 | \n", - "31.0 | \n", - "32.7 | \n", - "33 | \n", + "MCHC | \n", + "33.1 | \n", + "31.0 | \n", + "32.7 | \n", + "33 | \n", "
TOTAL LEUCOCYTE COUNT | \n", - "4.62 | \n", - "12.6 | \n", - "5.45 | \n", - "9,600 | \n", + "TOTAL LEUCOCYTE COUNT | \n", + "4.62 | \n", + "12.6 | \n", + "5.45 | \n", + "9,600 | \n", "
DIFFERENTIAL LEUCOCYTE COUNT | \n", - "Missing | \n", - "Missing | \n", - "NA | \n", - "NA | \n", + "DIFFERENTIAL LEUCOCYTE COUNT | \n", + "Missing | \n", + "Missing | \n", + "NA | \n", + "NA | \n", "
NEUTROPHILS | \n", - "66 | \n", - "67.0 | \n", - "64.3 | \n", - "58 | \n", + "NEUTROPHILS | \n", + "66 | \n", + "67.0 | \n", + "64.3 | \n", + "58 | \n", "
LYMPHOCYTES | \n", - "28 | \n", - "23.0 | \n", - "25.1 | \n", - "40 | \n", + "LYMPHOCYTES | \n", + "28 | \n", + "23.0 | \n", + "25.1 | \n", + "40 | \n", "
MONOCYTES | \n", - "06 | \n", - "7.0 | \n", - "7.2 | \n", - "01 | \n", + "MONOCYTES | \n", + "06 | \n", + "7.0 | \n", + "7.2 | \n", + "01 | \n", "
EOSINOPHILS | \n", - "00 | \n", - "3.0 | \n", - "2.8 | \n", - "01 | \n", + "EOSINOPHILS | \n", + "00 | \n", + "3.0 | \n", + "2.8 | \n", + "01 | \n", "
BASOPHIL | \n", - "00 | \n", - "0.0 | \n", - "0.6 | \n", - "NA | \n", + "BASOPHIL | \n", + "00 | \n", + "0.0 | \n", + "0.6 | \n", + "NA | \n", "
PROMYELOCYTES | \n", - "NA | \n", - "Missing | \n", - "NA | \n", - "NA | \n", + "PROMYELOCYTES | \n", + "NA | \n", + "NA | \n", + "NA | \n", + "NA | \n", "
MYELOCYTES | \n", - "NA | \n", - "Missing | \n", - "NA | \n", - "NA | \n", + "MYELOCYTES | \n", + "NA | \n", + "NA | \n", + "NA | \n", + "NA | \n", "
METAMYELOCYTES | \n", - "NA | \n", - "Missing | \n", - "NA | \n", - "NA | \n", + "METAMYELOCYTES | \n", + "NA | \n", + "NA | \n", + "NA | \n", + "NA | \n", "
BLASTS | \n", - "NA | \n", - "Missing | \n", - "NA | \n", - "NA | \n", + "BLASTS | \n", + "NA | \n", + "NA | \n", + "NA | \n", + "NA | \n", "
PLATELETS | \n", - "195 | \n", - "210.0 | \n", - "287 | \n", - "238,000 | \n", + "PLATELETS | \n", + "195 | \n", + "210.0 | \n", + "287 | \n", + "238,000 | \n", "
RETICULOCYTE COUNT | \n", - "NA | \n", - "NA | \n", - "NA | \n", - "NA | \n", + "RETICULOCYTE COUNT | \n", + "NA | \n", + "NA | \n", + "NA | \n", + "NA | \n", "