Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to get images to can OCR number out. no images found #258

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions covid_data_briefing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pandas as pd
from bs4 import BeautifulSoup
from dateutil.parser import parse as d
from tika import unpack

import covid_plot_cases
import covid_plot_deaths
Expand Down Expand Up @@ -794,6 +795,8 @@ def get_cases_by_prov_briefings():
pages = parse_file(file, html=True, paged=True)
pages = [BeautifulSoup(page, 'html.parser') for page in pages]

unvaccinated = get_unvaccinated(pages, file)

today_types = briefing_case_types(date, pages, briefing_url)
types = types.combine_first(today_types)

Expand Down Expand Up @@ -941,6 +944,15 @@ def vac_briefing_provs(df, date, file, page, text):
"Vac Given 2 Cum"]).set_index(["Date", "Province"]))


def get_unvaccinated(pages, file):
for soup in pages:
text = str(soup)
if "ผู้ติดเชื้อ ผู้ป่วยปอดอักเสบ ผู้ป่วยใส่ท่อช่วยหายใจ และผู้เสียชีวิต" not in text:
continue
imgs = unpack.from_file(file, serverEndpoint="http://localhost:9998")['attachments']
soup.find_all("img")


if __name__ == '__main__':
briefings_prov, cases_briefings = get_cases_by_prov_briefings()
briefings = import_csv("cases_briefings", ["Date"], False)
Expand Down