Simple map of communties with the number of households and number of each of the 6 IDI groups in each and a tool to allow us to draw paths on them
Map
Below is an interactive map that plots all the communities we are working in.
The size of the circle is proportional to the number of estimated compounds in each community.
Note: these are all compounds, based on the satellite data
Hover or click on a community to see the number of study households
The color indicates the district (Karaga, Mion, Sagnarigu) with the the fill indcating whether we have at least one household in each of the 6 IDI groups
Hover over a circle to see the exact counts
I have split the Risky arm into 3 groups. However, I used to different criteria reflected in the maps:
The split at 3 indicates any HHs > 3 are categorized as “high” (same for low)
For the split at 4/2, any HHs > 4 are categorized as “high” and any HHs < 2 are categorized as “low”
Note
Note: 832 / 1067 risky participants have completed all six draws (77%). 1529 / 1871 (82%) for all treated arms. This map only includes these people (all 6 draws).
Code
```{python}import foliumfrom folium.plugins import Draw# Create a map centered on a locationm = folium.Map( location=[communities["centroid_lat"].mean(), communities["centroid_lon"].mean()], zoom_start=9,)m2 = folium.Map( location=[communities["centroid_lat"].mean(), communities["centroid_lon"].mean()], zoom_start=9,)# 3. Define a simple function to assign a color based on the 'category' columndef get_color(row, desaturate: bool): district = row["district"] if district.lower() == "karaga": color = "lightblue" if desaturate else "darkblue" elif district.lower() == "mion": color = "lightgreen" if desaturate else "darkgreen" elif district.lower() == "tolon": color = "grey" if desaturate else "black" else: color = "red" if desaturate else "darkred" return color# 4. Loop through each row in the DataFrame to add a CircleMarkerfor idx, row in communities.iterrows(): radius = row["estimated_compounds"] * 3 info_textm2 = f""" Community: {row["community"]}<br> Estimated Cpds: {row["estimated_compounds"]}<br> Households: {row["num_hh"]}<br> R_High: {row["risky_vhigh"]}<br> R_Bal: {row["risky_balanced"]}<br> R_Low: {row["risky_vlow"]}<br> Control: {row["control"]}<br> Pred : {row["predictable"]}<br> Stable: {row["stable"]} """ desaturatem2 = ( True if ( (row["risky_vhigh"] > 0) & (row["risky_balanced"] > 0) & (row["risky_vlow"] > 0) & (row["control"] > 0) & (row["predictable"] > 0) & (row["stable"] > 0) ) else False ) fill = get_color(row, desaturatem2) border = get_color(row, desaturatem2) # Add the CircleMarker to the map folium.Circle( location=[row["centroid_lat"], row["centroid_lon"]], radius=radius, color=border, fill=True, fill_color=fill, fill_opacity=1, popup=info_textm2, tooltip=info_textm2, ).add_to(m2) info_text = f""" Community: {row["community"]}<br> Estimated Cpds: {row["estimated_compounds"]}<br> Households: {row["num_hh"]}<br> R_High: {row["risky_high"]}<br> R_Bal: {row["risky_balanced"]}<br> R_Low: {row["risky_low"]}<br> Control: {row["control"]}<br> Pred : {row["predictable"]}<br> Stable: {row["stable"]} """ desaturate = ( True if ( (row["risky_high"] > 0) & (row["risky_balanced"] > 0) & (row["risky_low"] > 0) & (row["control"] > 0) & (row["predictable"] > 0) & (row["stable"] > 0) ) else False ) fill = get_color(row, desaturate) border = get_color(row, desaturate) folium.Circle( location=[row["centroid_lat"], row["centroid_lon"]], radius=radius, color=border, fill=True, fill_color=fill, fill_opacity=1, popup=info_text, tooltip=info_text, ).add_to(m)```