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", + "
\n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 CBC_ReportSample_1.pngCBC_ReportSample_12.jpegCBC_ReportSample_14.jpegCBC_ReportSample_20.jpegCBC_ReportSample_1.pngCBC_ReportSample_12.jpegCBC_ReportSample_14.jpegCBC_ReportSample_20.jpeg
NAMETest Patient ATEST PATIENT 12Test Patient 14Test Patient 20NAMETest Patient ATEST PATIENT 12Test Patient 14Test Patient 20
HAEMOGLOBIN12.612.814.811.3HAEMOGLOBIN12.612.814.811.3
RBC (RED CELLS COUNT)4.544.55.224.2RBC (RED CELLS COUNT)4.544.55.224.2
HAEMATOCRIT(PCV)38.142.045.235HAEMATOCRIT(PCV)38.142.045.235
MCV83.993.086.682MCV83.993.086.682
MCH27.828.028.427MCH27.828.028.427
MCHC33.131.032.733MCHC33.131.032.733
TOTAL LEUCOCYTE COUNT4.6212.65.459,600TOTAL LEUCOCYTE COUNT4.6212.65.459,600
DIFFERENTIAL LEUCOCYTE COUNTMissingMissingNANADIFFERENTIAL LEUCOCYTE COUNTMissingMissingNANA
NEUTROPHILS6667.064.358NEUTROPHILS6667.064.358
LYMPHOCYTES2823.025.140LYMPHOCYTES2823.025.140
MONOCYTES067.07.201MONOCYTES067.07.201
EOSINOPHILS003.02.801EOSINOPHILS003.02.801
BASOPHIL000.00.6NABASOPHIL000.00.6NA
PROMYELOCYTESNAMissingNANAPROMYELOCYTESNANANANA
MYELOCYTESNAMissingNANAMYELOCYTESNANANANA
METAMYELOCYTESNAMissingNANAMETAMYELOCYTESNANANANA
BLASTSNAMissingNANABLASTSNANANANA
PLATELETS195210.0287238,000PLATELETS195210.0287238,000
RETICULOCYTE COUNTNANANANARETICULOCYTE COUNTNANANANA
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 10, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -616,7 +608,7 @@ " return ''\n", "\n", "# Apply the style to the DataFrame\n", - "styled_df = df.style.applymap(highlight_incorrect_keys)\n", + "styled_df = df.style.map(highlight_incorrect_keys)\n", "\n", "# Display the styled DataFrame\n", "styled_df\n"