{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "566afa18", "metadata": {}, "outputs": [], "source": [ "import gc\n", "gc.collect()\n", "import os\n", "import pandas as pd\n", "import json\n", "from tqdm.auto import tqdm" ] }, { "cell_type": "code", "execution_count": 30, "id": "52d4f4de", "metadata": {}, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "code", "execution_count": 31, "id": "7e6b0854", "metadata": {}, "outputs": [], "source": [ "extraction_df = pd.read_parquet(r\"D:\\Xelp_work\\FSL Project\\Sprint_2\\HCFA_Results\\HCFA_UHG_data_results.parquet\")" ] }, { "cell_type": "code", "execution_count": 32, "id": "ff3dba07", "metadata": {}, "outputs": [ { "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", "
Field_NameValueImage_Name
09_SecInsFullName[BLANK]M517U1RU026_001.tiff
19D_SecInsPlanName[BLANK]M517U1RU026_001.tiff
29B_SecInsSexM[BLANK]M517U1RU026_001.tiff
39B_SecInsSexF[BLANK]M517U1RU026_001.tiff
49B_SecInsDOB[BLANK]M517U1RU026_001.tiff
\n", "
" ], "text/plain": [ " Field_Name Value Image_Name\n", "0 9_SecInsFullName [BLANK] M517U1RU026_001.tiff\n", "1 9D_SecInsPlanName [BLANK] M517U1RU026_001.tiff\n", "2 9B_SecInsSexM [BLANK] M517U1RU026_001.tiff\n", "3 9B_SecInsSexF [BLANK] M517U1RU026_001.tiff\n", "4 9B_SecInsDOB [BLANK] M517U1RU026_001.tiff" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "extraction_df.head()" ] }, { "cell_type": "code", "execution_count": 33, "id": "4ac65224", "metadata": {}, "outputs": [], "source": [ "uhg_data = pd.read_parquet(r\"D:\\Xelp_work\\FSL Project\\Sprint_2\\HCFA_data\\UHG_HCFA\\initial_uhg_testing_data.parquet\")" ] }, { "cell_type": "code", "execution_count": 34, "id": "5c272c76", "metadata": {}, "outputs": [ { "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", "
DataTRANS_ValueGroup_nameImage_widthImage_heightField_Namex1x2y1y2...OCR_OMNIOCR_IGEAROCR_ATOCR_OptimizerCommentsKey_file_name24A_FromDate_Count21_DiagCode_CountStratify_Columnsource
0122682580None1A_PriInsIDNumber179422031A_PriInsIDNumber10761214281301...122682580122682580122682580122682580None1059C442AZ004_000_HCFA.KEY1.01.01_1UHG
1WASHINGTON ARIANANone2_PatFullName179422032_PatFullName70343347368...WASHINGTON ARIANAWASHINGTON ARIANAWASHINGTON ARIANAWASHINGTON ARIANANone1059C442AZ004_000_HCFA.KEY1.01.01_1UHG
208171994None3_PatDOB179422033_PatDOB697852347368...08171994081719940817199408171994None1059C442AZ004_000_HCFA.KEY1.01.01_1UHG
3NoneNonePatGroup179422035_PatAddr171295408429...NoneNoneNoneNoneNone1059C442AZ004_000_HCFA.KEY1.01.01_1UHG
4NoneNonePatGroup179422035_PatCity71181479499...NoneNoneNoneNoneNone1059C442AZ004_000_HCFA.KEY1.01.01_1UHG
\n", "

5 rows × 21 columns

\n", "
" ], "text/plain": [ " Data TRANS_Value Group_name Image_width Image_height \\\n", "0 122682580 None 1A_PriInsIDNumber 1794 2203 \n", "1 WASHINGTON ARIANA None 2_PatFullName 1794 2203 \n", "2 08171994 None 3_PatDOB 1794 2203 \n", "3 None None PatGroup 1794 2203 \n", "4 None None PatGroup 1794 2203 \n", "\n", " Field_Name x1 x2 y1 y2 ... OCR_OMNI \\\n", "0 1A_PriInsIDNumber 1076 1214 281 301 ... 122682580 \n", "1 2_PatFullName 70 343 347 368 ... WASHINGTON ARIANA \n", "2 3_PatDOB 697 852 347 368 ... 08171994 \n", "3 5_PatAddr1 71 295 408 429 ... None \n", "4 5_PatCity 71 181 479 499 ... None \n", "\n", " OCR_IGEAR OCR_AT OCR_Optimizer Comments \\\n", "0 122682580 122682580 122682580 None \n", "1 WASHINGTON ARIANA WASHINGTON ARIANA WASHINGTON ARIANA None \n", "2 08171994 08171994 08171994 None \n", "3 None None None None \n", "4 None None None None \n", "\n", " Key_file_name 24A_FromDate_Count 21_DiagCode_Count \\\n", "0 1059C442AZ004_000_HCFA.KEY 1.0 1.0 \n", "1 1059C442AZ004_000_HCFA.KEY 1.0 1.0 \n", "2 1059C442AZ004_000_HCFA.KEY 1.0 1.0 \n", "3 1059C442AZ004_000_HCFA.KEY 1.0 1.0 \n", "4 1059C442AZ004_000_HCFA.KEY 1.0 1.0 \n", "\n", " Stratify_Column source \n", "0 1_1 UHG \n", "1 1_1 UHG \n", "2 1_1 UHG \n", "3 1_1 UHG \n", "4 1_1 UHG \n", "\n", "[5 rows x 21 columns]" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uhg_data.head()" ] }, { "cell_type": "code", "execution_count": 35, "id": "f9dcecc7", "metadata": {}, "outputs": [], "source": [ "error_img = [\n", " \"M518202I036_001.tiff\",\n", " \"M517U1QA037_001.tiff\",\n", " \"M517U1OG015_001.tiff\",\n", " \"M51870X5027_001.tiff\",\n", " \"M517T18S007_001.tiff\",\n", " \"M517T19O046_001.tiff\",\n", " \"M517U1PN004_001.tiff\",\n", " \"117974KNAZ027_001.tiff\",\n", " \"1588J44IAZ019_001.tiff\",\n", " \"M518202H022_001.tiff\",\n", " \"M517V0LQ002_001.tiff\",\n", " \"M5186192041_001.tiff\",\n", " \"1178G44RAZ048_001.tiff\",\n", " \"M51871A7029_001.tiff\",\n", " \"1178G481AZ046_001.tiff\",\n", " \"1178G46QAZ023_001.tiff\",\n", " \"M5187217038_001.tiff\",\n", " \"M51871NL013_001.tiff\",\n", " \"M517T17C011_001.tiff\",\n", " \"M517V0M8043_001.tiff\",\n", " \"M51871AG037_001.tiff\",\n", " \"M5182039006_001.tiff\",\n", " \"M518618C034_001.tiff\",\n", " \"M51810F6045_001.tiff\"\n", "]" ] }, { "cell_type": "code", "execution_count": 36, "id": "5737a4ba", "metadata": {}, "outputs": [], "source": [ "uhg_data['FileName'] = uhg_data['Key_file_name'].apply(lambda x: f\"{x[:-10]}1.tiff\")" ] }, { "cell_type": "code", "execution_count": 37, "id": "edd75c18", "metadata": {}, "outputs": [ { "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", "
DataTRANS_ValueGroup_nameImage_widthImage_heightField_Namex1x2y1y2...OCR_IGEAROCR_ATOCR_OptimizerCommentsKey_file_name24A_FromDate_Count21_DiagCode_CountStratify_ColumnsourceFileName
0122682580None1A_PriInsIDNumber179422031A_PriInsIDNumber10761214281301...122682580122682580122682580None1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff
1WASHINGTON ARIANANone2_PatFullName179422032_PatFullName70343347368...WASHINGTON ARIANAWASHINGTON ARIANAWASHINGTON ARIANANone1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff
208171994None3_PatDOB179422033_PatDOB697852347368...081719940817199408171994None1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff
3NoneNonePatGroup179422035_PatAddr171295408429...NoneNoneNoneNone1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff
4NoneNonePatGroup179422035_PatCity71181479499...NoneNoneNoneNone1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff
\n", "

5 rows × 22 columns

\n", "
" ], "text/plain": [ " Data TRANS_Value Group_name Image_width Image_height \\\n", "0 122682580 None 1A_PriInsIDNumber 1794 2203 \n", "1 WASHINGTON ARIANA None 2_PatFullName 1794 2203 \n", "2 08171994 None 3_PatDOB 1794 2203 \n", "3 None None PatGroup 1794 2203 \n", "4 None None PatGroup 1794 2203 \n", "\n", " Field_Name x1 x2 y1 y2 ... OCR_IGEAR \\\n", "0 1A_PriInsIDNumber 1076 1214 281 301 ... 122682580 \n", "1 2_PatFullName 70 343 347 368 ... WASHINGTON ARIANA \n", "2 3_PatDOB 697 852 347 368 ... 08171994 \n", "3 5_PatAddr1 71 295 408 429 ... None \n", "4 5_PatCity 71 181 479 499 ... None \n", "\n", " OCR_AT OCR_Optimizer Comments Key_file_name \\\n", "0 122682580 122682580 None 1059C442AZ004_000_HCFA.KEY \n", "1 WASHINGTON ARIANA WASHINGTON ARIANA None 1059C442AZ004_000_HCFA.KEY \n", "2 08171994 08171994 None 1059C442AZ004_000_HCFA.KEY \n", "3 None None None 1059C442AZ004_000_HCFA.KEY \n", "4 None None None 1059C442AZ004_000_HCFA.KEY \n", "\n", " 24A_FromDate_Count 21_DiagCode_Count Stratify_Column source \\\n", "0 1.0 1.0 1_1 UHG \n", "1 1.0 1.0 1_1 UHG \n", "2 1.0 1.0 1_1 UHG \n", "3 1.0 1.0 1_1 UHG \n", "4 1.0 1.0 1_1 UHG \n", "\n", " FileName \n", "0 1059C442AZ004_001.tiff \n", "1 1059C442AZ004_001.tiff \n", "2 1059C442AZ004_001.tiff \n", "3 1059C442AZ004_001.tiff \n", "4 1059C442AZ004_001.tiff \n", "\n", "[5 rows x 22 columns]" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uhg_data = uhg_data[~uhg_data['FileName'].isin(error_img)]\n", "uhg_data.head()" ] }, { "cell_type": "code", "execution_count": 38, "id": "d718a7b6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3562" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uhg_data['FileName'].nunique()" ] }, { "cell_type": "code", "execution_count": 39, "id": "4602c096", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3562" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "extraction_df['Image_Name'].nunique()" ] }, { "cell_type": "code", "execution_count": 40, "id": "07be99c3", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "(Index(['Data', 'TRANS_Value', 'Group_name', 'Image_width', 'Image_height',\n", " 'Field_Name', 'x1', 'x2', 'y1', 'y2', 'Page', 'OCR_OMNI', 'OCR_IGEAR',\n", " 'OCR_AT', 'OCR_Optimizer', 'Comments', 'Key_file_name',\n", " '24A_FromDate_Count', '21_DiagCode_Count', 'Stratify_Column', 'source',\n", " 'FileName'],\n", " dtype='object'),\n", " Index(['Field_Name', 'Value', 'Image_Name'], dtype='object'))" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uhg_data.columns, extraction_df.columns" ] }, { "cell_type": "code", "execution_count": 41, "id": "de0834fa", "metadata": {}, "outputs": [], "source": [ "extraction_df.rename(columns={'Image_Name': 'FileName'}, inplace=True)\n", "# Rename Value columns for clarity\n", "extraction_df.rename(columns={'Value': 'XELP_Output'}, inplace=True)\n", "uhg_data.rename(columns={'Data': 'Ground_truth'}, inplace=True) " ] }, { "cell_type": "code", "execution_count": 42, "id": "f5703737", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "((639365, 22), (659595, 3))" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uhg_data.shape, extraction_df.shape" ] }, { "cell_type": "code", "execution_count": 43, "id": "d824f9ee", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(Index(['Ground_truth', 'TRANS_Value', 'Group_name', 'Image_width',\n", " 'Image_height', 'Field_Name', 'x1', 'x2', 'y1', 'y2', 'Page',\n", " 'OCR_OMNI', 'OCR_IGEAR', 'OCR_AT', 'OCR_Optimizer', 'Comments',\n", " 'Key_file_name', '24A_FromDate_Count', '21_DiagCode_Count',\n", " 'Stratify_Column', 'source', 'FileName'],\n", " dtype='object'),\n", " Index(['Field_Name', 'XELP_Output', 'FileName'], dtype='object'))" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uhg_data.columns, extraction_df.columns" ] }, { "cell_type": "code", "execution_count": 44, "id": "273e6bb4", "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/plain": [ "1261" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gc.collect()" ] }, { "cell_type": "code", "execution_count": 70, "id": "89bf0570", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████████████████████████████████████████████████████████████████████████| 3562/3562 [08:14<00:00, 7.20it/s]\n" ] } ], "source": [ "import pandas as pd\n", "from tqdm import tqdm\n", "\n", "# Initialize an empty DataFrame to store the merged results\n", "Merged_data_frame_all_images = pd.DataFrame()\n", "gc.collect()\n", "# Iterate over each group of images in the master DataFrame\n", "for img_name, grp_b_im in tqdm(uhg_data.groupby('FileName')):\n", " # Handle duplicates in the master DataFrame\n", " counts_master = grp_b_im['Field_Name'].value_counts()\n", " mask_master = grp_b_im['Field_Name'].map(counts_master) > 1\n", " grp_b_im.loc[mask_master, 'Field_Name'] = grp_b_im['Field_Name'] + (grp_b_im.groupby('Field_Name').cumcount() + 1).astype(str)\n", " \n", " # Filter and handle duplicates in the extraction DataFrame\n", " extraction_for_img = extraction_df[extraction_df[\"FileName\"] == img_name]\n", " counts_extraction = extraction_for_img['Field_Name'].value_counts()\n", " mask_extraction = extraction_for_img['Field_Name'].map(counts_extraction) > 1\n", " extraction_for_img.loc[mask_extraction, 'Field_Name'] = extraction_for_img['Field_Name'] + (extraction_for_img.groupby('Field_Name').cumcount() + 1).astype(str)\n", " \n", " # Merge the processed groups\n", " each_image_merged = pd.merge(grp_b_im, extraction_for_img, on=['FileName','Field_Name'], how='outer')\n", " \n", " # Concatenate the merged data to the final DataFrame\n", " Merged_data_frame_all_images = pd.concat([Merged_data_frame_all_images, each_image_merged], ignore_index=True)\n", "\n", "# Display the final merged DataFrame\n", "Merged_data_frame_all_images.fillna('[BLANK]', inplace=True)\n", "Merged_data_frame_all_images[\"XELP_Output\"] = Merged_data_frame_all_images[\"XELP_Output\"].str.replace(\"\", \"1\", regex=False)" ] }, { "cell_type": "code", "execution_count": 71, "id": "24edafbf", "metadata": {}, "outputs": [], "source": [ "# set(uhg_data[uhg_data['FileName'] == '1059C442AZ004_001.tiff']['Field_Name'].tolist())" ] }, { "cell_type": "code", "execution_count": 72, "id": "fa7522d2", "metadata": {}, "outputs": [], "source": [ "# set(extraction_df[extraction_df['FileName'] == '1059C442AZ004_001.tiff']['Field_Name'].tolist())" ] }, { "cell_type": "code", "execution_count": 73, "id": "b3cce963", "metadata": {}, "outputs": [], "source": [ "# set(extraction_df[extraction_df['FileName'] == '1059C442AZ004_001.tiff']['Field_Name'].tolist()) - set(uhg_data[uhg_data['FileName'] == '1059C442AZ004_001.tiff']['Field_Name'].tolist())" ] }, { "cell_type": "code", "execution_count": 74, "id": "9ce59f06", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(665702, 23)" ] }, "execution_count": 74, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images.shape" ] }, { "cell_type": "code", "execution_count": 75, "id": "24f698b9", "metadata": {}, "outputs": [ { "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", "
Ground_truthTRANS_ValueGroup_nameImage_widthImage_heightField_Namex1x2y1y2...OCR_ATOCR_OptimizerCommentsKey_file_name24A_FromDate_Count21_DiagCode_CountStratify_ColumnsourceFileNameXELP_Output
0122682580[BLANK]1A_PriInsIDNumber179422031A_PriInsIDNumber10761214281301...122682580122682580[BLANK]1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff122682580
1WASHINGTON ARIANA[BLANK]2_PatFullName179422032_PatFullName70343347368...WASHINGTON ARIANAWASHINGTON ARIANA[BLANK]1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiffWASHINGTON ARIANA
208171994[BLANK]3_PatDOB179422033_PatDOB697852347368...0817199408171994[BLANK]1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff08171994
3[BLANK][BLANK]PatGroup179422035_PatAddr171295408429...[BLANK][BLANK][BLANK]1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiff5210 3 MILE DR
4[BLANK][BLANK]PatGroup179422035_PatCity71181479499...[BLANK][BLANK][BLANK]1059C442AZ004_000_HCFA.KEY1.01.01_1UHG1059C442AZ004_001.tiffDETROIT
\n", "

5 rows × 23 columns

\n", "
" ], "text/plain": [ " Ground_truth TRANS_Value Group_name Image_width Image_height \\\n", "0 122682580 [BLANK] 1A_PriInsIDNumber 1794 2203 \n", "1 WASHINGTON ARIANA [BLANK] 2_PatFullName 1794 2203 \n", "2 08171994 [BLANK] 3_PatDOB 1794 2203 \n", "3 [BLANK] [BLANK] PatGroup 1794 2203 \n", "4 [BLANK] [BLANK] PatGroup 1794 2203 \n", "\n", " Field_Name x1 x2 y1 y2 ... OCR_AT \\\n", "0 1A_PriInsIDNumber 1076 1214 281 301 ... 122682580 \n", "1 2_PatFullName 70 343 347 368 ... WASHINGTON ARIANA \n", "2 3_PatDOB 697 852 347 368 ... 08171994 \n", "3 5_PatAddr1 71 295 408 429 ... [BLANK] \n", "4 5_PatCity 71 181 479 499 ... [BLANK] \n", "\n", " OCR_Optimizer Comments Key_file_name 24A_FromDate_Count \\\n", "0 122682580 [BLANK] 1059C442AZ004_000_HCFA.KEY 1.0 \n", "1 WASHINGTON ARIANA [BLANK] 1059C442AZ004_000_HCFA.KEY 1.0 \n", "2 08171994 [BLANK] 1059C442AZ004_000_HCFA.KEY 1.0 \n", "3 [BLANK] [BLANK] 1059C442AZ004_000_HCFA.KEY 1.0 \n", "4 [BLANK] [BLANK] 1059C442AZ004_000_HCFA.KEY 1.0 \n", "\n", " 21_DiagCode_Count Stratify_Column source FileName \\\n", "0 1.0 1_1 UHG 1059C442AZ004_001.tiff \n", "1 1.0 1_1 UHG 1059C442AZ004_001.tiff \n", "2 1.0 1_1 UHG 1059C442AZ004_001.tiff \n", "3 1.0 1_1 UHG 1059C442AZ004_001.tiff \n", "4 1.0 1_1 UHG 1059C442AZ004_001.tiff \n", "\n", " XELP_Output \n", "0 122682580 \n", "1 WASHINGTON ARIANA \n", "2 08171994 \n", "3 5210 3 MILE DR \n", "4 DETROIT \n", "\n", "[5 rows x 23 columns]" ] }, "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images.head()" ] }, { "cell_type": "code", "execution_count": 78, "id": "98b19b2a", "metadata": {}, "outputs": [], "source": [ "# Merged_data_frame_all_images = Merged_data_frame_all_images[~Merged_data_frame_all_images['FileName'].isin(error_images)]" ] }, { "cell_type": "code", "execution_count": 79, "id": "a9bc6b7c", "metadata": {}, "outputs": [], "source": [ "def strip_whitespace(x):\n", " if isinstance(x, str): # Check if the value is a string\n", " return x.strip()\n", " return x" ] }, { "cell_type": "code", "execution_count": 80, "id": "c78a56ee", "metadata": {}, "outputs": [], "source": [ "Merged_data_frame_all_images = Merged_data_frame_all_images.applymap(strip_whitespace)" ] }, { "cell_type": "code", "execution_count": 81, "id": "d4293a83", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|███████████████████████████████████████████████████████████████████████| 665702/665702 [00:10<00:00, 64020.29it/s]\n" ] } ], "source": [ "tqdm.pandas()\n", "\n", "# Apply the lambda function with progress tracking to add the 'Matching' column\n", "Merged_data_frame_all_images['Matching'] = Merged_data_frame_all_images.progress_apply(\n", " lambda x: 1 if str(x['Ground_truth']).strip() == str(x['XELP_Output']).strip() else 0,\n", " axis=1\n", ")" ] }, { "cell_type": "code", "execution_count": 82, "id": "a604f948", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Matching\n", "1 0.901617\n", "0 0.098383\n", "Name: proportion, dtype: float64" ] }, "execution_count": 82, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images['Matching'].value_counts(normalize=True)" ] }, { "cell_type": "code", "execution_count": 103, "id": "2b044f73", "metadata": {}, "outputs": [ { "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", "
FileNameField_NameXELP_OutputGround_truthMatching
211059C442AZ004_001.tiff11A_PriInsDOB08171994[BLANK]0
1781059C442AZ006_001.tiff11A_PriInsDOB04222004[BLANK]0
3351059C442AZ009_001.tiff11A_PriInsDOB07102009[BLANK]0
4941059C442AZ015_001.tiff11A_PriInsDOB08282013[BLANK]0
6991145K43FAZ024_001.tiff11A_PriInsDOB[BLANK][BLANK]1
..................
664863M52810SS005_001.tiff11A_PriInsDOB12131991[BLANK]0
665026M528230O001_001.tiff11A_PriInsDOB02171978[BLANK]0
665206M528230O002_001.tiff11A_PriInsDOB02171978[BLANK]0
665386M528230O003_001.tiff11A_PriInsDOB07271992[BLANK]0
665564M528722L016_001.tiff11A_PriInsDOB[BLANK][BLANK]1
\n", "

3562 rows × 5 columns

\n", "
" ], "text/plain": [ " FileName Field_Name XELP_Output Ground_truth \\\n", "21 1059C442AZ004_001.tiff 11A_PriInsDOB 08171994 [BLANK] \n", "178 1059C442AZ006_001.tiff 11A_PriInsDOB 04222004 [BLANK] \n", "335 1059C442AZ009_001.tiff 11A_PriInsDOB 07102009 [BLANK] \n", "494 1059C442AZ015_001.tiff 11A_PriInsDOB 08282013 [BLANK] \n", "699 1145K43FAZ024_001.tiff 11A_PriInsDOB [BLANK] [BLANK] \n", "... ... ... ... ... \n", "664863 M52810SS005_001.tiff 11A_PriInsDOB 12131991 [BLANK] \n", "665026 M528230O001_001.tiff 11A_PriInsDOB 02171978 [BLANK] \n", "665206 M528230O002_001.tiff 11A_PriInsDOB 02171978 [BLANK] \n", "665386 M528230O003_001.tiff 11A_PriInsDOB 07271992 [BLANK] \n", "665564 M528722L016_001.tiff 11A_PriInsDOB [BLANK] [BLANK] \n", "\n", " Matching \n", "21 0 \n", "178 0 \n", "335 0 \n", "494 0 \n", "699 1 \n", "... ... \n", "664863 0 \n", "665026 0 \n", "665206 0 \n", "665386 0 \n", "665564 1 \n", "\n", "[3562 rows x 5 columns]" ] }, "execution_count": 103, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images[Merged_data_frame_all_images['Field_Name'] == '11A_PriInsDOB'][['FileName','Field_Name','XELP_Output', 'Ground_truth', 'Matching']]" ] }, { "cell_type": "code", "execution_count": 99, "id": "a8cba0ae", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Field_Name\n", "12_PatSignonFile 3515\n", "31_RenDateSigned 3104\n", "5_PatAddr1 3044\n", "5_PatCity 3044\n", "33_BillProvPhone 3033\n", "5_PatState 2980\n", "5_PatPostCode 2968\n", "11D_PriInsOtherPlanN 2952\n", "11A_PriInsDOB 2946\n", "29_AmountPaid 2521\n", "11C_PriInsPlanName 2131\n", "11A_PriInsSexF 1520\n", "32_FacProvOrgName 1448\n", "11A_PriInsSexM 1385\n", "31_PrnRenProvFullName 1188\n", "33_BillProvOrgName 1182\n", "33_BillProvAddr1 1143\n", "32_FacProvAddr1 1080\n", "14_PatCurrentDateQual 880\n", "32_FacProvPostCode 758\n", "32_FacProvCity 687\n", "32_FacProvFullName 659\n", "9_SecInsFullName 615\n", "30_BalanceDue 596\n", "33_BillProvFullName 593\n", "24J_RenProvOtherIdQual1 585\n", "24J_RenProvOtherIdQual2 583\n", "24J_RenProvOtherId2 580\n", "24J_RenProvOtherIdQual 573\n", "33_BillProvPostCode 507\n", "33_BillProvCity 492\n", "26_PatAcctNo 492\n", "11D_PriInsOtherPlanY 479\n", "32_FacProvState 479\n", "4_PriInsFullName 375\n", "2_PatFullName 356\n", "18_PatHospFromDate 352\n", "10B_PatAAState 332\n", "24J_RenProvOtherIdQual3 324\n", "24J_RenProvOtherId3 321\n", "15_PatFirstDateOfIll 306\n", "14_PatCurrentDate 300\n", "11_PriInsPolGrpNumber 276\n", "33_BillProvNPIId 256\n", "1A_PriInsIDNumber 249\n", "15_PatFirstDateOfIllQual 242\n", "22_MedicaidCode 234\n", "7_PriInsAddr1 226\n", "24A_ToDate1 221\n", "33_BillProvState 221\n", "Name: count, dtype: int64" ] }, "execution_count": 99, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images[Merged_data_frame_all_images['Matching'] == '0'][['FileName','Field_Name','XELP_Output', 'Ground_truth']]['Field_Name'].value_counts()[:50]" ] }, { "cell_type": "code", "execution_count": null, "id": "c972e181", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 90, "id": "65f68540", "metadata": {}, "outputs": [ { "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", " \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", "
FileNameField_NameXELP_OutputGround_truth
15991158C48GAZ001_001.tiff33_BillProvFullNameDR JEFF HILL, OD[BLANK]
16001158C48GAZ001_001.tiff33_BillProvAddr12129 SW WANAMAKER RD STE B[BLANK]
16011158C48GAZ001_001.tiff33_BillProvCityTOPEKATOPEK?
16021158C48GAZ001_001.tiff33_BillProvStateKSK?
16031158C48GAZ001_001.tiff33_BillProvPostCode666146661?
16041158C48GAZ001_001.tiff33_BillProvPhone[BLANK][BLANK]
16051158C48GAZ001_001.tiff33_BillProvNPIId1518051614[BLANK]
16061158C48GAZ001_001.tiff33_BillProvOtherIdFull[BLANK][BLANK]
16071158C48GAZ001_001.tiff33_MediBillProvOrgName[BLANK][BLANK]
16081158C48GAZ001_001.tiff33_MediBillProvAddr1[BLANK][BLANK]
16091158C48GAZ001_001.tiff33_MediBillProvCity[BLANK][BLANK]
16101158C48GAZ001_001.tiff33_MediBillProvState[BLANK][BLANK]
16111158C48GAZ001_001.tiff33_MediBillProvPostCode[BLANK][BLANK]
16121158C48GAZ001_001.tiff33_MediBillProvPhone[BLANK][BLANK]
16131158C48GAZ001_001.tiff33_MediBillProvNPIId[BLANK][BLANK]
16141158C48GAZ001_001.tiff33_MediBillProvOtherIdFull[BLANK][BLANK]
16151158C48GAZ001_001.tiff32_MedicaidTaxId[BLANK][BLANK]
16161158C48GAZ001_001.tiff33_MedicaidTaxId[BLANK][BLANK]
16171158C48GAZ001_001.tiff24_MedicaidPaidAmount[BLANK][BLANK]
16181158C48GAZ001_001.tiff3_PatSexM[BLANK]?
16191158C48GAZ001_001.tiff3_PatSexFX?
16201158C48GAZ001_001.tiff6_PatRelShipSelfX?
16211158C48GAZ001_001.tiff6_PatRelShipSpouse[BLANK]?
16221158C48GAZ001_001.tiff6_PatRelShipChild[BLANK]?
16231158C48GAZ001_001.tiff6_PatRelShipOther[BLANK]?
16241158C48GAZ001_001.tiff8_PatStatusSingle[BLANK][BLANK]
16251158C48GAZ001_001.tiff8_PatStatusMarried[BLANK][BLANK]
16261158C48GAZ001_001.tiff8_PatStatusOther[BLANK][BLANK]
16271158C48GAZ001_001.tiff8_PatEmpStatusCode[BLANK][BLANK]
16281158C48GAZ001_001.tiff8_PatStudentStatusCodeFT[BLANK][BLANK]
16291158C48GAZ001_001.tiff8_PatStudentStatusCodePT[BLANK][BLANK]
16301158C48GAZ001_001.tiff9B_SecInsSexM[BLANK][BLANK]
16311158C48GAZ001_001.tiff9B_SecInsSexF[BLANK][BLANK]
16321158C48GAZ001_001.tiff10A_PatConditionEmpY[BLANK]?
16331158C48GAZ001_001.tiff10A_PatConditionEmpN[BLANK]?
16341158C48GAZ001_001.tiff10B_PatConditionAutoY[BLANK]?
16351158C48GAZ001_001.tiff10B_PatConditionAutoN[BLANK]?
16361158C48GAZ001_001.tiff10C_PatConditionOtherY[BLANK]?
16371158C48GAZ001_001.tiff10C_PatConditionOtherN[BLANK]?
16381158C48GAZ001_001.tiff11A_PriInsSexM[BLANK][BLANK]
16391158C48GAZ001_001.tiff11A_PriInsSexF[BLANK][BLANK]
16401158C48GAZ001_001.tiff11D_PriInsOtherPlanY[BLANK]?
16411158C48GAZ001_001.tiff11D_PriInsOtherPlanN[BLANK]?
16421158C48GAZ001_001.tiff19_LocalUse[BLANK][BLANK]
16431158C48GAZ001_001.tiff19_LocalUsePrefix[BLANK][BLANK]
16441158C48GAZ001_001.tiff20_OSLabY[BLANK][BLANK]
16451158C48GAZ001_001.tiff20_OSLabN[BLANK][BLANK]
16461158C48GAZ001_001.tiff25_BillProvSSN[BLANK]?
16471158C48GAZ001_001.tiff25_BillProvEINX?
16481158C48GAZ001_001.tiff27_AcceptAssignmentYX?
16491158C48GAZ001_001.tiff27_AcceptAssignmentN[BLANK]?
16501158C48GAZ001_001.tiff31_RenDateSigned[BLANK][BLANK]
16511158C48GAZ001_001.tiff24_AnesUnits[BLANK][BLANK]
16521158C48GAZ001_001.tiff24_AnesTotalTime[BLANK][BLANK]
16531158C48GAZ001_001.tiff24_AnesTotalMin[BLANK][BLANK]
16541158C48GAZ001_001.tiff24_AnesStartTime[BLANK][BLANK]
16551158C48GAZ001_001.tiff24_AnesMod[BLANK][BLANK]
16561158C48GAZ001_001.tiff24_AnesEndTime[BLANK][BLANK]
\n", "
" ], "text/plain": [ " FileName Field_Name \\\n", "1599 1158C48GAZ001_001.tiff 33_BillProvFullName \n", "1600 1158C48GAZ001_001.tiff 33_BillProvAddr1 \n", "1601 1158C48GAZ001_001.tiff 33_BillProvCity \n", "1602 1158C48GAZ001_001.tiff 33_BillProvState \n", "1603 1158C48GAZ001_001.tiff 33_BillProvPostCode \n", "1604 1158C48GAZ001_001.tiff 33_BillProvPhone \n", "1605 1158C48GAZ001_001.tiff 33_BillProvNPIId \n", "1606 1158C48GAZ001_001.tiff 33_BillProvOtherIdFull \n", "1607 1158C48GAZ001_001.tiff 33_MediBillProvOrgName \n", "1608 1158C48GAZ001_001.tiff 33_MediBillProvAddr1 \n", "1609 1158C48GAZ001_001.tiff 33_MediBillProvCity \n", "1610 1158C48GAZ001_001.tiff 33_MediBillProvState \n", "1611 1158C48GAZ001_001.tiff 33_MediBillProvPostCode \n", "1612 1158C48GAZ001_001.tiff 33_MediBillProvPhone \n", "1613 1158C48GAZ001_001.tiff 33_MediBillProvNPIId \n", "1614 1158C48GAZ001_001.tiff 33_MediBillProvOtherIdFull \n", "1615 1158C48GAZ001_001.tiff 32_MedicaidTaxId \n", "1616 1158C48GAZ001_001.tiff 33_MedicaidTaxId \n", "1617 1158C48GAZ001_001.tiff 24_MedicaidPaidAmount \n", "1618 1158C48GAZ001_001.tiff 3_PatSexM \n", "1619 1158C48GAZ001_001.tiff 3_PatSexF \n", "1620 1158C48GAZ001_001.tiff 6_PatRelShipSelf \n", "1621 1158C48GAZ001_001.tiff 6_PatRelShipSpouse \n", "1622 1158C48GAZ001_001.tiff 6_PatRelShipChild \n", "1623 1158C48GAZ001_001.tiff 6_PatRelShipOther \n", "1624 1158C48GAZ001_001.tiff 8_PatStatusSingle \n", "1625 1158C48GAZ001_001.tiff 8_PatStatusMarried \n", "1626 1158C48GAZ001_001.tiff 8_PatStatusOther \n", "1627 1158C48GAZ001_001.tiff 8_PatEmpStatusCode \n", "1628 1158C48GAZ001_001.tiff 8_PatStudentStatusCodeFT \n", "1629 1158C48GAZ001_001.tiff 8_PatStudentStatusCodePT \n", "1630 1158C48GAZ001_001.tiff 9B_SecInsSexM \n", "1631 1158C48GAZ001_001.tiff 9B_SecInsSexF \n", "1632 1158C48GAZ001_001.tiff 10A_PatConditionEmpY \n", "1633 1158C48GAZ001_001.tiff 10A_PatConditionEmpN \n", "1634 1158C48GAZ001_001.tiff 10B_PatConditionAutoY \n", "1635 1158C48GAZ001_001.tiff 10B_PatConditionAutoN \n", "1636 1158C48GAZ001_001.tiff 10C_PatConditionOtherY \n", "1637 1158C48GAZ001_001.tiff 10C_PatConditionOtherN \n", "1638 1158C48GAZ001_001.tiff 11A_PriInsSexM \n", "1639 1158C48GAZ001_001.tiff 11A_PriInsSexF \n", "1640 1158C48GAZ001_001.tiff 11D_PriInsOtherPlanY \n", "1641 1158C48GAZ001_001.tiff 11D_PriInsOtherPlanN \n", "1642 1158C48GAZ001_001.tiff 19_LocalUse \n", "1643 1158C48GAZ001_001.tiff 19_LocalUsePrefix \n", "1644 1158C48GAZ001_001.tiff 20_OSLabY \n", "1645 1158C48GAZ001_001.tiff 20_OSLabN \n", "1646 1158C48GAZ001_001.tiff 25_BillProvSSN \n", "1647 1158C48GAZ001_001.tiff 25_BillProvEIN \n", "1648 1158C48GAZ001_001.tiff 27_AcceptAssignmentY \n", "1649 1158C48GAZ001_001.tiff 27_AcceptAssignmentN \n", "1650 1158C48GAZ001_001.tiff 31_RenDateSigned \n", "1651 1158C48GAZ001_001.tiff 24_AnesUnits \n", "1652 1158C48GAZ001_001.tiff 24_AnesTotalTime \n", "1653 1158C48GAZ001_001.tiff 24_AnesTotalMin \n", "1654 1158C48GAZ001_001.tiff 24_AnesStartTime \n", "1655 1158C48GAZ001_001.tiff 24_AnesMod \n", "1656 1158C48GAZ001_001.tiff 24_AnesEndTime \n", "\n", " XELP_Output Ground_truth \n", "1599 DR JEFF HILL, OD [BLANK] \n", "1600 2129 SW WANAMAKER RD STE B [BLANK] \n", "1601 TOPEKA TOPEK? \n", "1602 KS K? \n", "1603 66614 6661? \n", "1604 [BLANK] [BLANK] \n", "1605 1518051614 [BLANK] \n", "1606 [BLANK] [BLANK] \n", "1607 [BLANK] [BLANK] \n", "1608 [BLANK] [BLANK] \n", "1609 [BLANK] [BLANK] \n", "1610 [BLANK] [BLANK] \n", "1611 [BLANK] [BLANK] \n", "1612 [BLANK] [BLANK] \n", "1613 [BLANK] [BLANK] \n", "1614 [BLANK] [BLANK] \n", "1615 [BLANK] [BLANK] \n", "1616 [BLANK] [BLANK] \n", "1617 [BLANK] [BLANK] \n", "1618 [BLANK] ? \n", "1619 X ? \n", "1620 X ? \n", "1621 [BLANK] ? \n", "1622 [BLANK] ? \n", "1623 [BLANK] ? \n", "1624 [BLANK] [BLANK] \n", "1625 [BLANK] [BLANK] \n", "1626 [BLANK] [BLANK] \n", "1627 [BLANK] [BLANK] \n", "1628 [BLANK] [BLANK] \n", "1629 [BLANK] [BLANK] \n", "1630 [BLANK] [BLANK] \n", "1631 [BLANK] [BLANK] \n", "1632 [BLANK] ? \n", "1633 [BLANK] ? \n", "1634 [BLANK] ? \n", "1635 [BLANK] ? \n", "1636 [BLANK] ? \n", "1637 [BLANK] ? \n", "1638 [BLANK] [BLANK] \n", "1639 [BLANK] [BLANK] \n", "1640 [BLANK] ? \n", "1641 [BLANK] ? \n", "1642 [BLANK] [BLANK] \n", "1643 [BLANK] [BLANK] \n", "1644 [BLANK] [BLANK] \n", "1645 [BLANK] [BLANK] \n", "1646 [BLANK] ? \n", "1647 X ? \n", "1648 X ? \n", "1649 [BLANK] ? \n", "1650 [BLANK] [BLANK] \n", "1651 [BLANK] [BLANK] \n", "1652 [BLANK] [BLANK] \n", "1653 [BLANK] [BLANK] \n", "1654 [BLANK] [BLANK] \n", "1655 [BLANK] [BLANK] \n", "1656 [BLANK] [BLANK] " ] }, "execution_count": 90, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images[Merged_data_frame_all_images['FileName'] == '1158C48GAZ001_001.tiff'][['FileName','Field_Name','XELP_Output', 'Ground_truth']][120:]" ] }, { "cell_type": "code", "execution_count": 92, "id": "77dcb4b0", "metadata": {}, "outputs": [], "source": [ "Merged_data_frame_all_images = Merged_data_frame_all_images.astype('str')" ] }, { "cell_type": "code", "execution_count": 95, "id": "7a636085", "metadata": {}, "outputs": [ { "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", " \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", "
FileNameField_NameXELP_OutputGround_truth
15501158C48GAZ001_001.tiff24A_ToDate207292024[BLANK]
15511158C48GAZ001_001.tiff24B_POS211[BLANK]
15531158C48GAZ001_001.tiff24D_ProcCode292015[BLANK]
15551158C48GAZ001_001.tiff24E_DiagPtr2A[BLANK]
15571158C48GAZ001_001.tiff24G_Units21[BLANK]
15621158C48GAZ001_001.tiff24J_RenProvNPIId21265524565[BLANK]
15651158C48GAZ001_001.tiff24_NDC2[BLANK]?????
15731158C48GAZ001_001.tiff29_AmountPaid[BLANK]000
15781158C48GAZ001_001.tiff31_PrnRenProvFullName#[BLANK]
15821158C48GAZ001_001.tiff32_FacProvFullNameDR JEFF HILL, ODJEFF HILL, OD
15991158C48GAZ001_001.tiff33_BillProvFullNameDR JEFF HILL, OD[BLANK]
16001158C48GAZ001_001.tiff33_BillProvAddr12129 SW WANAMAKER RD STE B[BLANK]
16011158C48GAZ001_001.tiff33_BillProvCityTOPEKATOPEK?
16021158C48GAZ001_001.tiff33_BillProvStateKSK?
16031158C48GAZ001_001.tiff33_BillProvPostCode666146661?
16051158C48GAZ001_001.tiff33_BillProvNPIId1518051614[BLANK]
16181158C48GAZ001_001.tiff3_PatSexM[BLANK]?
16191158C48GAZ001_001.tiff3_PatSexFX?
16201158C48GAZ001_001.tiff6_PatRelShipSelfX?
16211158C48GAZ001_001.tiff6_PatRelShipSpouse[BLANK]?
16221158C48GAZ001_001.tiff6_PatRelShipChild[BLANK]?
16231158C48GAZ001_001.tiff6_PatRelShipOther[BLANK]?
16321158C48GAZ001_001.tiff10A_PatConditionEmpY[BLANK]?
16331158C48GAZ001_001.tiff10A_PatConditionEmpN[BLANK]?
16341158C48GAZ001_001.tiff10B_PatConditionAutoY[BLANK]?
16351158C48GAZ001_001.tiff10B_PatConditionAutoN[BLANK]?
16361158C48GAZ001_001.tiff10C_PatConditionOtherY[BLANK]?
16371158C48GAZ001_001.tiff10C_PatConditionOtherN[BLANK]?
16401158C48GAZ001_001.tiff11D_PriInsOtherPlanY[BLANK]?
16411158C48GAZ001_001.tiff11D_PriInsOtherPlanN[BLANK]?
16461158C48GAZ001_001.tiff25_BillProvSSN[BLANK]?
16471158C48GAZ001_001.tiff25_BillProvEINX?
16481158C48GAZ001_001.tiff27_AcceptAssignmentYX?
16491158C48GAZ001_001.tiff27_AcceptAssignmentN[BLANK]?
16581158D44AAZ014_001.tiff2_PatFullNameWHITLEY ALONZO FWHITLEY, ALONZO F
16601158D44AAZ014_001.tiff5_PatAddr12223 CAROL LN[BLANK]
16611158D44AAZ014_001.tiff5_PatCityE NORTHON[BLANK]
16621158D44AAZ014_001.tiff5_PatStatePA[BLANK]
16631158D44AAZ014_001.tiff5_PatPostCode19401[BLANK]
16651158D44AAZ014_001.tiff4_PriInsFullNameWHITLEY ALONZO FWHITLEY ALONZO, F
16671158D44AAZ014_001.tiff7_PriInsCityE NORTHONE NORRITON
16751158D44AAZ014_001.tiff10B_PatAAState[BLANK]PA
16781158D44AAZ014_001.tiff11A_PriInsDOB12241952[BLANK]
16831158D44AAZ014_001.tiff12_PatSignonFileSOF[BLANK]
16941158D44AAZ014_001.tiff17_RefProvFullNameDANIEL GOLDSTEIN TODD[BLANK]
17121158D44AAZ014_001.tiff24E_DiagPtrAB[BLANK]
17131158D44AAZ014_001.tiff24F_LineCharges15500[BLANK]
17141158D44AAZ014_001.tiff24G_Units1[BLANK]
17191158D44AAZ014_001.tiff24J_RenProvNPIId1841291800000X[BLANK]
17221158D44AAZ014_001.tiff24_NDC[BLANK]?????
17291158D44AAZ014_001.tiff28_TotalCharges15500[BLANK]
17381158D44AAZ014_001.tiff32_FacProvOrgNamePTEPMF
17401158D44AAZ014_001.tiff32_FacProvAddr17165 OGOMIZA AVE[BLANK]
17411158D44AAZ014_001.tiff32_FacProvCityPHILADELPHIA[BLANK]
17421158D44AAZ014_001.tiff32_FacProvStateCAPA
17431158D44AAZ014_001.tiff32_FacProvPostCode913622364223822364
17451158D44AAZ014_001.tiff32_FacProvOtherIdFull239822364[BLANK]
17571158D44AAZ014_001.tiff33_BillProvAddr17165 OGOMIZA AVENUE[BLANK]
17581158D44AAZ014_001.tiff33_BillProvCityPHILADELPHIA[BLANK]
17601158D44AAZ014_001.tiff33_BillProvPostCode10136204191362047
\n", "
" ], "text/plain": [ " FileName Field_Name \\\n", "1550 1158C48GAZ001_001.tiff 24A_ToDate2 \n", "1551 1158C48GAZ001_001.tiff 24B_POS2 \n", "1553 1158C48GAZ001_001.tiff 24D_ProcCode2 \n", "1555 1158C48GAZ001_001.tiff 24E_DiagPtr2 \n", "1557 1158C48GAZ001_001.tiff 24G_Units2 \n", "1562 1158C48GAZ001_001.tiff 24J_RenProvNPIId2 \n", "1565 1158C48GAZ001_001.tiff 24_NDC2 \n", "1573 1158C48GAZ001_001.tiff 29_AmountPaid \n", "1578 1158C48GAZ001_001.tiff 31_PrnRenProvFullName \n", "1582 1158C48GAZ001_001.tiff 32_FacProvFullName \n", "1599 1158C48GAZ001_001.tiff 33_BillProvFullName \n", "1600 1158C48GAZ001_001.tiff 33_BillProvAddr1 \n", "1601 1158C48GAZ001_001.tiff 33_BillProvCity \n", "1602 1158C48GAZ001_001.tiff 33_BillProvState \n", "1603 1158C48GAZ001_001.tiff 33_BillProvPostCode \n", "1605 1158C48GAZ001_001.tiff 33_BillProvNPIId \n", "1618 1158C48GAZ001_001.tiff 3_PatSexM \n", "1619 1158C48GAZ001_001.tiff 3_PatSexF \n", "1620 1158C48GAZ001_001.tiff 6_PatRelShipSelf \n", "1621 1158C48GAZ001_001.tiff 6_PatRelShipSpouse \n", "1622 1158C48GAZ001_001.tiff 6_PatRelShipChild \n", "1623 1158C48GAZ001_001.tiff 6_PatRelShipOther \n", "1632 1158C48GAZ001_001.tiff 10A_PatConditionEmpY \n", "1633 1158C48GAZ001_001.tiff 10A_PatConditionEmpN \n", "1634 1158C48GAZ001_001.tiff 10B_PatConditionAutoY \n", "1635 1158C48GAZ001_001.tiff 10B_PatConditionAutoN \n", "1636 1158C48GAZ001_001.tiff 10C_PatConditionOtherY \n", "1637 1158C48GAZ001_001.tiff 10C_PatConditionOtherN \n", "1640 1158C48GAZ001_001.tiff 11D_PriInsOtherPlanY \n", "1641 1158C48GAZ001_001.tiff 11D_PriInsOtherPlanN \n", "1646 1158C48GAZ001_001.tiff 25_BillProvSSN \n", "1647 1158C48GAZ001_001.tiff 25_BillProvEIN \n", "1648 1158C48GAZ001_001.tiff 27_AcceptAssignmentY \n", "1649 1158C48GAZ001_001.tiff 27_AcceptAssignmentN \n", "1658 1158D44AAZ014_001.tiff 2_PatFullName \n", "1660 1158D44AAZ014_001.tiff 5_PatAddr1 \n", "1661 1158D44AAZ014_001.tiff 5_PatCity \n", "1662 1158D44AAZ014_001.tiff 5_PatState \n", "1663 1158D44AAZ014_001.tiff 5_PatPostCode \n", "1665 1158D44AAZ014_001.tiff 4_PriInsFullName \n", "1667 1158D44AAZ014_001.tiff 7_PriInsCity \n", "1675 1158D44AAZ014_001.tiff 10B_PatAAState \n", "1678 1158D44AAZ014_001.tiff 11A_PriInsDOB \n", "1683 1158D44AAZ014_001.tiff 12_PatSignonFile \n", "1694 1158D44AAZ014_001.tiff 17_RefProvFullName \n", "1712 1158D44AAZ014_001.tiff 24E_DiagPtr \n", "1713 1158D44AAZ014_001.tiff 24F_LineCharges \n", "1714 1158D44AAZ014_001.tiff 24G_Units \n", "1719 1158D44AAZ014_001.tiff 24J_RenProvNPIId \n", "1722 1158D44AAZ014_001.tiff 24_NDC \n", "1729 1158D44AAZ014_001.tiff 28_TotalCharges \n", "1738 1158D44AAZ014_001.tiff 32_FacProvOrgName \n", "1740 1158D44AAZ014_001.tiff 32_FacProvAddr1 \n", "1741 1158D44AAZ014_001.tiff 32_FacProvCity \n", "1742 1158D44AAZ014_001.tiff 32_FacProvState \n", "1743 1158D44AAZ014_001.tiff 32_FacProvPostCode \n", "1745 1158D44AAZ014_001.tiff 32_FacProvOtherIdFull \n", "1757 1158D44AAZ014_001.tiff 33_BillProvAddr1 \n", "1758 1158D44AAZ014_001.tiff 33_BillProvCity \n", "1760 1158D44AAZ014_001.tiff 33_BillProvPostCode \n", "\n", " XELP_Output Ground_truth \n", "1550 07292024 [BLANK] \n", "1551 11 [BLANK] \n", "1553 92015 [BLANK] \n", "1555 A [BLANK] \n", "1557 1 [BLANK] \n", "1562 1265524565 [BLANK] \n", "1565 [BLANK] ????? \n", "1573 [BLANK] 000 \n", "1578 # [BLANK] \n", "1582 DR JEFF HILL, OD JEFF HILL, OD \n", "1599 DR JEFF HILL, OD [BLANK] \n", "1600 2129 SW WANAMAKER RD STE B [BLANK] \n", "1601 TOPEKA TOPEK? \n", "1602 KS K? \n", "1603 66614 6661? \n", "1605 1518051614 [BLANK] \n", "1618 [BLANK] ? \n", "1619 X ? \n", "1620 X ? \n", "1621 [BLANK] ? \n", "1622 [BLANK] ? \n", "1623 [BLANK] ? \n", "1632 [BLANK] ? \n", "1633 [BLANK] ? \n", "1634 [BLANK] ? \n", "1635 [BLANK] ? \n", "1636 [BLANK] ? \n", "1637 [BLANK] ? \n", "1640 [BLANK] ? \n", "1641 [BLANK] ? \n", "1646 [BLANK] ? \n", "1647 X ? \n", "1648 X ? \n", "1649 [BLANK] ? \n", "1658 WHITLEY ALONZO F WHITLEY, ALONZO F \n", "1660 2223 CAROL LN [BLANK] \n", "1661 E NORTHON [BLANK] \n", "1662 PA [BLANK] \n", "1663 19401 [BLANK] \n", "1665 WHITLEY ALONZO F WHITLEY ALONZO, F \n", "1667 E NORTHON E NORRITON \n", "1675 [BLANK] PA \n", "1678 12241952 [BLANK] \n", "1683 SOF [BLANK] \n", "1694 DANIEL GOLDSTEIN TODD [BLANK] \n", "1712 AB [BLANK] \n", "1713 15500 [BLANK] \n", "1714 1 [BLANK] \n", "1719 1841291800000X [BLANK] \n", "1722 [BLANK] ????? \n", "1729 15500 [BLANK] \n", "1738 PTE PMF \n", "1740 7165 OGOMIZA AVE [BLANK] \n", "1741 PHILADELPHIA [BLANK] \n", "1742 CA PA \n", "1743 913622364 223822364 \n", "1745 239822364 [BLANK] \n", "1757 7165 OGOMIZA AVENUE [BLANK] \n", "1758 PHILADELPHIA [BLANK] \n", "1760 10136204 191362047 " ] }, "execution_count": 95, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images[Merged_data_frame_all_images['Matching'] == '0'][['FileName','Field_Name','XELP_Output', 'Ground_truth']][200:260]" ] }, { "cell_type": "code", "execution_count": 94, "id": "1b09aa92", "metadata": {}, "outputs": [], "source": [ "Merged_data_frame_all_images.to_parquet(\"HCFA_UHG_test_split_evaluation.parquet\", index=False)" ] }, { "cell_type": "code", "execution_count": 209, "id": "cc4fce57", "metadata": {}, "outputs": [], "source": [ "Merged_data_frame_all_images_wo_blank = Merged_data_frame_all_images[Merged_data_frame_all_images[\"XELP_Output\"] != '[BLANK]']" ] }, { "cell_type": "code", "execution_count": 212, "id": "1161ccfe", "metadata": {}, "outputs": [ { "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", "
FileNameKeyNameGround_truthXELP_OutputMatching
0BSC134A9O003_000_HCFA.tiff1A_PriInsIDNumberR6J588215755R6J5882157551
1BSC134A9O003_000_HCFA.tiff2_PatFullNameSUMANTRI, TEGUHSUMANTRI, TEGUH1
2BSC134A9O003_000_HCFA.tiff3_PatDOB10151973101519731
3BSC134A9O003_000_HCFA.tiff5_PatAddr114360 VOSE ST APT21914360 VOSE ST APT2191
4BSC134A9O003_000_HCFA.tiff5_PatCityVAN NUYSVAN NUYS1
..................
1269996PHP8843RO035_000_HCFA.tiff10A_PatConditionEmpNXX1
1269998PHP8843RO035_000_HCFA.tiff10B_PatConditionAutoNXX1
1270000PHP8843RO035_000_HCFA.tiff10C_PatConditionOtherNXX1
1270010PHP8843RO035_000_HCFA.tiff25_BillProvEINXX1
1270011PHP8843RO035_000_HCFA.tiff27_AcceptAssignmentYXX1
\n", "

443019 rows × 5 columns

\n", "
" ], "text/plain": [ " FileName KeyName \\\n", "0 BSC134A9O003_000_HCFA.tiff 1A_PriInsIDNumber \n", "1 BSC134A9O003_000_HCFA.tiff 2_PatFullName \n", "2 BSC134A9O003_000_HCFA.tiff 3_PatDOB \n", "3 BSC134A9O003_000_HCFA.tiff 5_PatAddr1 \n", "4 BSC134A9O003_000_HCFA.tiff 5_PatCity \n", "... ... ... \n", "1269996 PHP8843RO035_000_HCFA.tiff 10A_PatConditionEmpN \n", "1269998 PHP8843RO035_000_HCFA.tiff 10B_PatConditionAutoN \n", "1270000 PHP8843RO035_000_HCFA.tiff 10C_PatConditionOtherN \n", "1270010 PHP8843RO035_000_HCFA.tiff 25_BillProvEIN \n", "1270011 PHP8843RO035_000_HCFA.tiff 27_AcceptAssignmentY \n", "\n", " Ground_truth XELP_Output Matching \n", "0 R6J588215755 R6J588215755 1 \n", "1 SUMANTRI, TEGUH SUMANTRI, TEGUH 1 \n", "2 10151973 10151973 1 \n", "3 14360 VOSE ST APT219 14360 VOSE ST APT219 1 \n", "4 VAN NUYS VAN NUYS 1 \n", "... ... ... ... \n", "1269996 X X 1 \n", "1269998 X X 1 \n", "1270000 X X 1 \n", "1270010 X X 1 \n", "1270011 X X 1 \n", "\n", "[443019 rows x 5 columns]" ] }, "execution_count": 212, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images_wo_blank" ] }, { "cell_type": "code", "execution_count": 210, "id": "dc18dcc2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Matching\n", "1 0.975811\n", "0 0.024189\n", "Name: proportion, dtype: float64" ] }, "execution_count": 210, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images_wo_blank['Matching'].value_counts(normalize=True)" ] }, { "cell_type": "code", "execution_count": 216, "id": "cd718a27", "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/plain": [ "KeyName\n", "33_BillProvState 6940\n", "5_PatState 6927\n", "3_PatDOB 6875\n", "25_BillProvFedIdCode 6871\n", "33_BillProvCity 6863\n", " ... \n", "24_NDCUnitsQual6 7\n", "24_NDC5 6\n", "10A_PatConditionEmpY 6\n", "24_NDC6 3\n", "24_AnesStartTime2 1\n", "Name: count, Length: 202, dtype: int64" ] }, "execution_count": 216, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images_wo_blank[Merged_data_frame_all_images_wo_blank['Matching'] == 1]['KeyName'].value_counts()" ] }, { "cell_type": "code", "execution_count": 226, "id": "f3c01d65", "metadata": {}, "outputs": [], "source": [ "Merged_data_frame_all_images[\"XELP_Output\"] = Merged_data_frame_all_images[\"XELP_Output\"].str.replace(\"\", \"1\", regex=False)" ] }, { "cell_type": "code", "execution_count": 230, "id": "8d1a785f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
FileNameKeyNameGround_truthXELP_OutputMatching
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [FileName, KeyName, Ground_truth, XELP_Output, Matching]\n", "Index: []" ] }, "execution_count": 230, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "Merged_data_frame_all_images[(Merged_data_frame_all_images['XELP_Output'] != '[BLANK]')&(Merged_data_frame_all_images['KeyName'] == '24_AnesStartTime') & (Merged_data_frame_all_images['Matching'] == 0)][:60]\n" ] }, { "cell_type": "code", "execution_count": 177, "id": "38573620", "metadata": {}, "outputs": [], "source": [ "blank_keys = [\"20_OSLabCharges\", \"11D_PriInsOtherPlanY\", \"19_LocalUse\", '17_RefProvOrgName',\n", " '30_BalanceDue',\n", " '24_NDCCharges',\n", " '24_NDCQualifier',\n", " '7_PriInsPhoneNumber','32_AmbToFacProvPostCodeExt',\n", " '20_OSLabY',\n", " '31_RenProvTaxonomyCode',\n", " '24C_EMG',\n", " '11D_PriInsOtherPlanN',\n", " '5_PatPhoneNumber',\n", " '20_OSLabN',\n", " '22_MedicaidCode',\n", " '29_AmountPaid',\n", " '33_BillProvPhone',\n", " '16_PatUTWToDate',\n", " '22_MedicaidRefNum',\n", " '24_AnesMod']" ] }, { "cell_type": "code", "execution_count": 182, "id": "5b951dd3", "metadata": {}, "outputs": [], "source": [ "dummy = Merged_data_frame_all_images[Merged_data_frame_all_images['KeyName'].isin(blank_keys)]" ] }, { "cell_type": "code", "execution_count": 183, "id": "7d244a8c", "metadata": {}, "outputs": [ { "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", "
FileNameKeyNameGround_truthXELP_OutputMatching
7BSC134A9O003_000_HCFA.tiff5_PatPhoneNumber[BLANK][BLANK]1
13BSC134A9O003_000_HCFA.tiff7_PriInsPhoneNumber[BLANK][BLANK]1
33BSC134A9O003_000_HCFA.tiff16_PatUTWToDate[BLANK][BLANK]1
38BSC134A9O003_000_HCFA.tiff17_RefProvOrgName[BLANK][BLANK]1
42BSC134A9O003_000_HCFA.tiff20_OSLabCharges[BLANK][BLANK]1
..................
1270004PHP8843RO035_000_HCFA.tiff11D_PriInsOtherPlanN[BLANK][BLANK]1
1270005PHP8843RO035_000_HCFA.tiff19_LocalUse[BLANK][BLANK]1
1270007PHP8843RO035_000_HCFA.tiff20_OSLabY[BLANK][BLANK]1
1270008PHP8843RO035_000_HCFA.tiff20_OSLabN[BLANK][BLANK]1
1270017PHP8843RO035_000_HCFA.tiff24_AnesMod[BLANK][BLANK]1
\n", "

136532 rows × 5 columns

\n", "
" ], "text/plain": [ " FileName KeyName Ground_truth \\\n", "7 BSC134A9O003_000_HCFA.tiff 5_PatPhoneNumber [BLANK] \n", "13 BSC134A9O003_000_HCFA.tiff 7_PriInsPhoneNumber [BLANK] \n", "33 BSC134A9O003_000_HCFA.tiff 16_PatUTWToDate [BLANK] \n", "38 BSC134A9O003_000_HCFA.tiff 17_RefProvOrgName [BLANK] \n", "42 BSC134A9O003_000_HCFA.tiff 20_OSLabCharges [BLANK] \n", "... ... ... ... \n", "1270004 PHP8843RO035_000_HCFA.tiff 11D_PriInsOtherPlanN [BLANK] \n", "1270005 PHP8843RO035_000_HCFA.tiff 19_LocalUse [BLANK] \n", "1270007 PHP8843RO035_000_HCFA.tiff 20_OSLabY [BLANK] \n", "1270008 PHP8843RO035_000_HCFA.tiff 20_OSLabN [BLANK] \n", "1270017 PHP8843RO035_000_HCFA.tiff 24_AnesMod [BLANK] \n", "\n", " XELP_Output Matching \n", "7 [BLANK] 1 \n", "13 [BLANK] 1 \n", "33 [BLANK] 1 \n", "38 [BLANK] 1 \n", "42 [BLANK] 1 \n", "... ... ... \n", "1270004 [BLANK] 1 \n", "1270005 [BLANK] 1 \n", "1270007 [BLANK] 1 \n", "1270008 [BLANK] 1 \n", "1270017 [BLANK] 1 \n", "\n", "[136532 rows x 5 columns]" ] }, "execution_count": 183, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dummy" ] }, { "cell_type": "code", "execution_count": 184, "id": "5bc30647", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "KeyName\n", "32_FacProvOrgName 1044\n", "31_PrnRenProvFullName 815\n", "26_PatAcctNo 612\n", "33_BillProvOrgName 608\n", "33_BillProvAddr1 544\n", "32_FacProvAddr1 520\n", "32_FacProvFullName 465\n", "31_RenDateSigned 359\n", "2_PatFullName 347\n", "4_PriInsFullName 327\n", "33_BillProvFullName 303\n", "1A_PriInsIDNumber 282\n", "13_PriSignonFileList 256\n", "32_FacProvPostCode 253\n", "33_BillProvPostCode 239\n", "17_RefProvFullName 214\n", "33_BillProvNPIId 206\n", "7_PriInsAddr1 180\n", "5_PatAddr1 177\n", "11_PriInsPolGrpNumber 167\n", "12_PatSignonFile 155\n", "9_SecInsFullName 143\n", "11C_PriInsPlanName 142\n", "28_TotalCharges 141\n", "32_FacProvCity 125\n", "32_FacProvNPIId 116\n", "21_DiagCode2 108\n", "33_BillProvCity 108\n", "25_BillProvEIN 108\n", "25_BillProvFedIdCode 104\n", "24J_RenProvNPIId 97\n", "21_DiagCode1 93\n", "33_BillProvOtherIdFull 91\n", "25_BillProvSSN 89\n", "5_PatCity 88\n", "23_PriorAuthNum 88\n", "3_PatDOB 87\n", "24J_RenProvNPIId1 83\n", "24J_RenProvNPIId2 82\n", "5_PatPostCode 81\n", "9A_SecInsPolGrpNumber 78\n", "17B_RefProvNPI 77\n", "7_PriInsPostCode 76\n", "7_PriInsCity 75\n", "24J_RenProvOtherId2 74\n", "11B_PriInsEmpName 74\n", "11A_PriInsDOB 71\n", "24A_FromDate2 68\n", "24F_LineCharges2 67\n", "24J_RenProvOtherId1 66\n", "24_NDC3 65\n", "24A_FromDate1 64\n", "21_DiagCode 63\n", "24_NDC2 59\n", "21_DiagCode4 59\n", "21_DiagCode3 57\n", "24E_DiagPtr1 57\n", "32_FacProvOtherIdFull 56\n", "24F_LineCharges1 56\n", "11B_OtherClaimIdCode 56\n", "Name: count, dtype: int64" ] }, "execution_count": 184, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Merged_data_frame_all_images[Merged_data_frame_all_images['Matching'] == 0]['KeyName'].value_counts()[:60]" ] }, { "cell_type": "code", "execution_count": null, "id": "89d033b0", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" } }, "nbformat": 4, "nbformat_minor": 5 }