I have been somewhat related to the Covid 19 fight in the city of Chihuahua in México as a volunteer for the Health Services Department of Chihuahua regarding the geospatial distribution of Covid-19. This has made me think about how it could be possible to gain insight of the spread of the virus, and I have been thinking about graphs to better understand this. When I saw the kind of problems in the hackaton, I immediately knew that the Covid 19 starter kit would be the one that will keep me stick to this contest, although I know it could be one of the most recurrent problems as is a very actual. This is not a problem for me, because my real interest here is to learn and hopefully to bring this knowledge to my community. I think that doing this I have only good things to win and none to lose.
What it does
There are three main parts in the web-app. A Graphistry interface and two that depend on two new streamlit components build specially for this web-app. In the first part, the whole graph can be seen. The data in that graph comes from the allConnections GSQL query. In that part, the user can choose a cluster of interest and take the ID of one of the patients. That ID can be given to a Patient ID box in the sidebar, which prepares the data for the next part. The second part displays a subgraph of the patient using the stvis component, a new component which allows to render an interactive graph on streamlit using the pyvis library, and helps to understand that structure. The third part also depends on a new Streamlit component called pxmap which allows to render a scatter mapbox with plotly express. The idea is that combining the graphs and the map, we can gain insight on how was the contact between the patients and where it was the place of contagion.
How we built it
Integrating Graphistry and Tigergraph on Streamlit is somewhat direct using pyTigerGraphBeta and graphistry libraries. In order to render the graph, we can use iframe method of streamlit components. For stvis and pxmap I used more or less the same approach but in this case worked the components as python packages in order that other user can install them. If you are interested, you can play with these components by doing:
pip install stvis pip install pxmap
Challenges we ran into
For me it was challenging to understand the GSQL queries. Writing one for doing what I wanted was hard, but finally it worked. After that, it was also difficult to understand the structure of the data, as I had in mind from the beginning that I wanted to get the coordinates of the cluster around a given patient. Fortunately, everything worked more or less I expected.
Accomplishments that we're proud of
I have to say, I am proud of the whole task. At first the challenge looked like a paramount job. However I decided to progress making small steps. Making the two components was not in my original plan, but it was something that was rounding my mind and finally I decided to do it.
What we learned
- I didn't knew about Tigergraph and Graphistry before, so I had to learn from the very beginning.
- I had some experience with streamlit components but with this I have realized a couple of things.
What's next for Covid 19 exploration
There are lots of patients that for some reason don't have coordinates. When the user selects one of these, the app send an error message. The app needs to be improved in that part. Also, for now it is based on static components, and the next step would be to do bidirectional components, maybe for taking the information with a mouse click.