input:
The list below provides examples of items and services that should not be billed separately. Please note that the list is not all inclusive.
1. Routine Supplies - The hospital basic room and critical care area room (emergency department, observation, treatment room, cardiac, medical, surgical, pediatric, respiratory, burn, neonate (level III and IV), neurological, rehabilitative,post-anesthesia or recovery, andtrauma) daily charge shall include all of the following services, personal care and supply items and equipment
2. Medical Equipment- The hospital basic room and critical care area room(emergency department, observation, treatment room, cardiac,medical, surgical, pediatric,respiratory, burn, neonate (level III and IV), neurological, rehabilitative, post- anesthesia or recovery, andtrauma) daily charge shall include all of the following services, personal care and supply items and equipment
This is my code but it not give accurate output that I want
import pdfplumber
import re
demo = []
with pdfplumber.open('HCSC IL Inpatient_Outpatient Unbundling Policy- Facility.pdf') as pdf:
for i in range(0, 50):
try:
text = pdf.pages[i]
clean_text = text.filter(lambda obj: obj["object_type"] == "char")
demo.append(str(re.findall(r'(\d+\.\s.*\n?)+', clean_text.extract_text())).replace('[]', ' '))
except IndexError:
print("")
break
Output that I want in CSV or table
Section description
Routine Supplies The hospital basic room and critical care area room (emergency
department, observation, treatment room, cardiac, medical,
surgical, pediatric, respiratory, burn, neonate (level III and
IV), neurological, rehabilitative,post-anesthesia or recovery,
andtrauma) daily charge shall include all of the following
services, personal care and supply items and equipment
Medical Equipment The hospital basic room and critical care area room(emergency
department, observation, treatment room, cardiac,medical,
surgical, pediatric,respiratory, burn, neonate (level III and
IV), neurological, rehabilitative, post- anesthesia or
recovery, andtrauma) daily charge shall include all of the
following services, personal care and supply items and
equipment