Inspiration

Health Care System Monitoring has become a must for every country. In the pandemic, we all saw the burden on the Health Care System. We also have to think about how to maintain the system without causing too much load in some areas.

How to check if your medical health care system is sufficient for your population ? What is the hospitals per population ratio of your country?

In the pandemic we got to know, accessibility to Hospital is a privilege. Far more often, we would find cluster of hospitals in urban and rich areas of a city. The distribution of hospital location can become a good indicator of the land prices in an area.

Location of a hospital is very crucial information. Informations like how much beds does the hospital have and how much are filled should be available to public in real time. This can be called as the available capacity of the hospital.

Monitoring the information of hospitals in the real time can help us understand where there is more need for development. Also, we have to keep in mind that most of the population have a hospital near to them under an hour of travel. In serious cases, reducing the distance and time taken to bring a patient to the hospital can save his life.

The Problem become even more broad and wide spread for a heavily densely populated country like India, china, Bangladesh and other developing countries.

What is health care system Monitoring ?

System health monitoring is a set of activities undertaken to maintain a system in operable condition and may be limited to an observation of current system states, with maintenance and repair being prompted by these observations.

Here, are some question that we should be able to answer with our system.

  • Which nearest hospital i can visit the fastest?
  • Who is the nearest person to me who can help me out?
  • Are Beds available in your nearest hospital ?
  • If not, what is the capacity and do we need to increase it ?
  • What are other hospitals that you can visit?
  • How many people are infected with the virus?
  • Is the nearest person to me infected as well?

I tried to create a Health Case System Monitoring Dashboard with Tiger Graph.

Features

Dashboard has following features:

  • Map based Visualisation of Hospitals and Person.
  • Add Hospital.
  • Add Person.
  • Find the nearest Hospital to you.
  • Find the nearest Person to you.
  • Find the distance to the Nearest Hospital.
  • UI with basic display of information like email and name
  • Admit a person to a hospital (edge)

How the System Works?

Let’s consider a hospital with a capacity of caring and treating around 1,000 Patients. Now, Let’s draw a radius of around 5 kilo meters around that hospital. In the 5 km area, some people like A ( infected ) would be admitted already in the hospital and some people like B are not infected . We would have to keep a check if there is an increase in number of People like A, we would have to increase the capacity of the hospital.

Considering in mind the Population of the area, we can have a better understanding how fast and how much we should increase the capacity of a hospital.

Social to Social interaction.

A person can send an email for help to its nearest neighbours. Knowing if you neighbours is infected or not, can be crucial information for you.

Use of Tiger Graph

I started by creating a CRUD features for creating, reading, updating and deleting Hospitals and People with the fastapi, pytigergraph and uvicorn for server.

CRUD features were super easy with the library and I used the build in methods to create vertex and edges.

I also went through the GSQL 101 Certification. The Certification gave a bit of confidence for sure.

I would like to give thanks to John Herke from the tiger graph developer relations. He was of great help and gave me good instructions about how to run a custom query. I build the euclidean feature with a custom query. Downloaded the code from

https://github.com/tigergraph/gsql-graph-algorithms/blob/277349ce0414ba797edcad1488b6caf1904d5beb/algorithms/Similarity/approximate_nearest_neighbors/tg_euclidean_distance.hpp

and Uploaded to cloud.

Finding the Nearest person and Nearest Hospital is down on the server side. I have provided the code for the same. It was the most tedious task for me.

Code Repo

Client : https://github.com/pratiksharm/tiger-graph-hackathon

Api : https://github.com/pratiksharm/tiger-graph-api

Techstack

  • create-react-app
  • Tiger Graph cloud
  • Rest API for fetching data
  • React Leaflet
  • Google maps

Heres is how we are finding the nearest person and hospital.


def dist_between_two_lat_lon(*args):
    from math import asin, cos, radians, sin, sqrt
    lat1, lat2, long1, long2 = map(radians, args)

    dist_lats = abs(lat2 - lat1) 
    dist_longs = abs(long2 - long1) 
    a = sin(dist_lats/2)**2 + cos(lat1) * cos(lat2) * sin(dist_longs/2)**2
    c = asin(sqrt(a)) * 2
    radius_earth = 6378 # the "Earth radius" R varies from 6356.752 km at the poles to 6378.137 km at the equator.
    return c * radius_earth

def find_closest_lat_lon(data, v):
    try:
        return min(data, key=lambda p: dist_between_two_lat_lon(v['lat'],p['lat'],v['lon'],p['lon']))
    except TypeError:
        print('Not a list or not a number.')

# city = {'lat_key': value, 'lon_key': value}  # type:dict()
new_york = {'lat': 40.712776, 'lon': -74.005974}
washington = {'lat': 47.751076,  'lon': -120.740135}
san_francisco = {'lat': 37.774929, 'lon': -122.419418}

city_list = [new_york, washington, san_francisco]

city_to_find = {'lat': 29.760427, 'lon': -95.369804}  # Houston
print(find_closest_lat_lon(city_list, city_to_find))

For Finding the distance we are using Euclidean distance measure which is not the best but gives us a good measure of distance.

References

https://en.wikipedia.org/wiki/Health_system

https://cprimestudios.com/blog/5-reasons-build-health-monitoring-system-hospital

https://www.hindawi.com/journals/wcmc/2021/5592454/

Health Care inequality in India

** I got to know the geolocation api was not working due to screen sharing...

Share this project:

Updates