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

Pincode based distance and Enhancements for Streamlit App #8

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

manujosephv
Copy link

@manujosephv manujosephv commented May 3, 2021

key changes:

  1. Added pin code based distance as another column
  2. made some changes in the streamlit app - some performance and some the way it is displayed
  3. filtered out centers with all slots as zero
  4. made email trigger to mail that there is no slot, instead of not sending any email at all.

@aahnik
Copy link

aahnik commented May 7, 2021

image

love this @manujosephv

this fixes #11, as age is logical.

@aahnik
Copy link

aahnik commented May 7, 2021

but getting

error-screenshot

👉 full traceback
File "/home/aahnik/Desktop/vaccine_availability/.venv/lib/python3.9/site-packages/streamlit/script_runner.py", line 337, in _run_script
    exec(code, module.__dict__)
File "/home/aahnik/Desktop/vaccine_availability/streamlit_app.py", line 77, in <module>
    main()
File "/home/aahnik/Desktop/vaccine_availability/streamlit_app.py", line 53, in main
    df = cached_availability(next_n_days, district_ids, min_age_limit, pincode_search, free_paid)
File "/home/aahnik/Desktop/vaccine_availability/.venv/lib/python3.9/site-packages/streamlit/caching.py", line 573, in wrapped_func
    return get_or_create_cached_value()
File "/home/aahnik/Desktop/vaccine_availability/.venv/lib/python3.9/site-packages/streamlit/caching.py", line 557, in get_or_create_cached_value
    return_value = func(*args, **kwargs)
File "/home/aahnik/Desktop/vaccine_availability/streamlit_app.py", line 10, in cached_availability
    df= get_availability(next_n_days, district_ids, min_age_limit, pincode_search)
File "/home/aahnik/Desktop/vaccine_availability/availability.py", line 51, in get_availability
    data = get_data(URL)
File "/home/aahnik/Desktop/vaccine_availability/.venv/lib/python3.9/site-packages/cachetools/func.py", line 66, in wrapper
    v = func(*args, **kwargs)
File "/home/aahnik/Desktop/vaccine_availability/.venv/lib/python3.9/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
File "/home/aahnik/Desktop/vaccine_availability/.venv/lib/python3.9/site-packages/retry/api.py", line 73, in retry_decorator
    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File "/home/aahnik/Desktop/vaccine_availability/.venv/lib/python3.9/site-packages/retry/api.py", line 33, in __retry_internal
    return f()
File "/home/aahnik/Desktop/vaccine_availability/availability.py", line 37, in get_data
    data = json.loads(response.text)['centers']
File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

-- added options to show empty slots
-- added option to send/not send empty emails
@manujosephv
Copy link
Author

@bhavsarpratik have resolved the merge conflicts. And fixed the api pull issue. It is now working

@manujosephv
Copy link
Author

on more investigation... the requests are going through from my local, but not from the Github Action. Not sure why

@aahnik
Copy link

aahnik commented May 8, 2021

hi @manujosephv, the JSON decode error is resolved after the changes. thanks!

image

46 is greater than 45, so it should show all slots with min age 45 ... right ?

it shows nothing,

image

but if I do this,

image

then slots are shown.

image

@aahnik
Copy link

aahnik commented May 8, 2021

without the "show full slots" being checked, nothing is being shown ever

image

@aahnik
Copy link

aahnik commented May 8, 2021

hi @manujosephv, it would be more logical to have a download pdf button.

df.to_html() # will give HTML of the dataframe

import pdfkit as pdf

# pip install pdfkit
# sudo apt install wkhtmltopdf

pdf.from_file("/path/to/html.html","/path/to/pdf.pdf")

the user of this app will be common human, and csv is for machines to read. if a programmer wants data, they will take from the official API, not after downloading csv from this app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants