Giter Site home page Giter Site logo

ina-covid-bed's Introduction

ina-covid-bed

This project is no longer maintained and has been made publicly accessible in an archived state.

In the early days of the COVID-19 pandemic, I stumbled upon a way to scrape bed availability data from a government website and decided to share my findings on Twitter. My tweet quickly gained traction, receiving many retweets and likes.

tweet

One of the people who saw my tweet was @masbagal, who was inspired to create a web app that would make this information more easily accessible to the public. @yogiw joined the project and added a map page to the web app, while @pveyes implemented geolocation support.

@irsyaadbp stepped in and purchased the domain bed.ina-covid.com, which was then assigned to the web app. @galihlprakoso helped us to make the site more discoverable with the best SEO.

tweet

As more and more collaborators joined the project, new ideas and bug fixes were implemented, and the project eventually evolved into a real API endpoint that served not just to supply the information to users but also as an example for those learning to code.

Thanks to the help from @memetj_, the project eventually reached the hands of influencers like @jejouw and started to gain even more visibility.

As the number of COVID-19 cases began to decline in 2022, many hospitals began to have more available beds, and the project started to become less relevant. Now in 2023, the project has been archived, but it will always be available for others to see, learn from, and build upon in the future.

I am grateful to everyone who contributed to this project and helped to make it a success. Thank you!

All Contributors & Collaborators
@masbagal @yogiw
@pveyes @irsyaadbp
@galihlprakoso @memetj_
@kelilipan @beliga44
@syauqy @dorman99
@ekafyi @codingki

Inspiration

ina-covid-bed's People

Contributors

agallio avatar beliga44 avatar codingki avatar dorman99 avatar ekafyi avatar galihlprakoso avatar masbagal avatar pveyes avatar syauqy avatar yogiw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ina-covid-bed's Issues

Add SEO

Description

Add basic SEO such as opengraph image, title, description. So when users share the link it shows some useful information.

Implementation Model

Maybe we can use next-seo or we can add them natively with Next.js <Head> component.

Add dark mode

Description

Self-explanatory. Add dark mode to all pages.

Implementation Model

Use the chakra-ui dark mode feature. Add a toggle button in the upper right of the page.

Optimize user current location marker on map

Description

Optimize user current location marker on map.

Implementation Model

If there's no user location marker, then add it. If users click the location button again, remove the old marker and add a new marker to the newest location.

Show the distance between user's location and the hospital location

Description

Show the distance between user's location and the hospital location in the HospitalCard.

Implementation Model

I don't have any design iteration for this. It's up to you. The important thing is that the user can understand how far the hospital is from its location.

Safari iOS full height overlap

Description

On Safari iOS the 100vh height is not rendered correctly. The page should be a full browser height with no vertical scroll, but on Safari it doesn't.

Expected Behaviour

All pages or components that use 100vh height should adapt to Safari WebKit implementation of full-height page.

See it here

Add info text when API doesn't response after 10s

Description

Add info text when API doesn't yet response after 10s. Because right now, API response is being cache for only 5 minutes. When the cache expires, users have to get the data directly from the API endpoint that scrape SIRANAP page. Because of the large dataset these provinces listed below is very slow to scrape:

  • jawa_barat: 9s-11s
  • banten: 8s-12s
  • jawa_tengah: 10s-15s
  • jawa_timur: 10s-12s

Without the info text, users doesn't know that this loading gonna resolve at the end.

Implementation Model

Add info text in the loading screen, at the bottom of the loading animation. The info text would be something like "Pengambilan data memerlukan waktu yang lebih lama. Mohon tunggu" or if you have any idea on how to say that we're needed more time to fetch data, just comment.

Add last updated info in hospital card

Description

Add last updated info in hospital card.

Implementation Model

The API returns updated_at_minutes that can be used. Its value is the hospital's last updated information for the availability of the bed. Its value is in minutes. So it should be displayed as:

  • If updated_at_minutes > 60, shows Diperbarui x jam yang lalu
  • If updated_at_minutes <= 60, shows Diperbarui x menit yang lalu

API is very slow

I know the origin application by Kemenkes was very slow.

But when try to improve the experience from the existing applications, it's better to not just improve the UI but also improve the speed.

Some of recommendation:

  • Cache the API for 5-10 minute
  • Serve static data and add a cronjob to update the latest static data in every 5-10 minutes

5-10 minutes is just an estimation, if you afraid with the data validity, just start with a very short time, if you think okay, you can increase the cache expiration along the way.

Refine province when using geo location

Description

When using geo location to define province, show alternatives of nearby provinces.

Reasons:

  • Geo location is not accurate
  • People are living near province border
    • Example case 1: they maybe easier to go to Tangerang rather than Jakarta
    • Example case 2: hospital in Jogja ran out of capacity, they search in Central Java (Solo or Klaten)

Implementation Model

  • Show 2 alternatives nearby selected geo province
  • When navigating to alternative, keep geo data to be able to sort nearest hospital

Add API timeout handler

Description

Add handler when the API is timeout.

Expected Behaviour

Vercel only limits the network request time to 10s, otherwise it will stop and returns gateway timeout. Handle it with refresh button or something that users know that they must refresh the page. Or make the API caching expires longer (but the data accuracy is decreasing).

Add get user location & sort the data from the nearest location

Description

Get user location from the browser, and then calculate the distance from the user's location to every available hospital.

Implementation Model

I think it's more easy to implement at the list page first, and then after that we can replicate the behavior to the map page. We can use haversine formula to calculate the distance.

function deg2rad(deg: number) {
  return deg * (Math.PI / 180);
}

export function getDistanceFromLatLonInKm(lat1: number, lon1: number, lat2: number, lon2: number) {
  const R = 6371; // Radius of the earth in km
  const dLat = deg2rad(lat2 - lat1); // deg2rad below
  const dLon = deg2rad(lon2 - lon1);
  const a =
    Math.sin(dLat / 2) * Math.sin(dLat / 2) +
    Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
  const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
  const d = R * c; // Distance in km
  return d.toFixed(2);
}

Tasks

  • Add button to get current location
  • Clicking the button will get the nearest province
  • Redirect to /[province] page with geo info
  • Update data to sort by geo info if any

Data is inconsistent

Description

The data is inconsistent. Some of the hospital has a false address and details.

Make links in mapbox feature box (hospital info) more prominent

Description

Currently the hotline link and the detail (Siranap) link are styled like the surrounding text. Users may not be aware these are clickable.

current UI

Proposed feature: make the links more prominent so users are aware of the possible actions.

Screen Shot 2021-07-11 at 03 17 00

Implementation Model

Modify the markup and either inline the new CSS styles or add them to global CSS

Happy to submit PR if this is considered necessary. Other UI suggestions welcome.

Some Province can't reload

Description

Getting Error on params prov=jawa_timur, jawa_barat, jawa_tengah :

An error occurred with your deployment

FUNCTION_INVOCATION_TIMEOUT

Display the hospital data even when the bed capacity is full

Description

Keep the hospital data even when the bed capacity is full, but handle the rendered card differently. Let's modify the HospitalCard that when the bed is full, it has some info like "Kamar IGD Penuh" or other words similar to that. Give it some red border or something, but with less visibility so the the bed available still being the card that's highlighted to the users. I'll sort the data from the most available to none, if needed.

How? @masbagal @yogiwisesa @galihlprakoso

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.