vaccine_availability
vaccine_availability copied to clipboard
Pincode based distance and Enhancements for Streamlit App
key changes:
- Added pin code based distance as another column
- made some changes in the streamlit app - some performance and some the way it is displayed
- filtered out centers with all slots as zero
- made email trigger to mail that there is no slot, instead of not sending any email at all.

love this @manujosephv
this fixes #11, as age is logical.
but getting
👉 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
@bhavsarpratik have resolved the merge conflicts. And fixed the api pull issue. It is now working
on more investigation... the requests are going through from my local, but not from the Github Action. Not sure why
hi @manujosephv, the JSON decode error is resolved after the changes. thanks!

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

but if I do this,

then slots are shown.

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

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.