Package: aedes
AEDESThis repository contains codes that demonstrate the use of Project AEDES for data collection on remote sensing using LANDSAT, MODIS and SENTINEL. Full repository is linkedhere.Author: Xavier PuspusAffiliation:Cirrolytix Research ServicesInstallationInstall using:foo@bar:~$pipinstallaedesSatellite DataImport the modules of the package using:import aedes
from aedes.remote_sensing_utils import generate_random_ee_points, df_to_ee_points, get_satellite_measures_from_points
from aedes.remote_sensing_utils import visualize_on_map

from aedes.osm_utils import reverse_geocode_points

from aedes.automl_utils import perform_clustering, perform_classificationAuthentication and InitializationThis packages uses Google Earth Engine (sign-up for accesshere) to query remote sensing data. To authenticate, simply use:aedes.remote_sensing_utils.authenticate()This script will open a google authenticator that uses your email (provided you've signed up earlier) to authenticate your script to query remote sensing data. After authentication, initialize access using:aedes.remote_sensing_utils.initialize()Area of InterestFirst, find the bounding box geojson of an Area of Interest (AOI) of your choice using thislink.Get Normalized Difference Indices and Weather DataUse the one-liner codeget_satellite_measures_from_pointsto extract NDVI, NDWI, NDBI, Aerosol Index (Air Quality), Surface Temperature, Precipitation Rate and Relative Humidity for your preset number of points of interestsample_pointswithin a specified date durationdate_fromtodate_to.%%time
QC_AOI = [[[120.98976275,14.58936896],
           [121.13383232,14.58936896],
           [121.13383232,14.77641364],
           [120.98976275,14.77641364],
           [120.98976275,14.58936896]]] # Quezon city
           
# Get random points sampled from the AOI if you don't have ground truth data points yet.
# You can also generate your own Earth Engine Points from your own long-lat pairs using generate_random_ee_points()
points = generate_random_ee_points(QC_AOI, sample_points=50)

# Get satellite features on each point
qc_df = get_satellite_measures_from_points(points, QC_AOI, 
                                              date_from='2017-07-01', 
                                              date_to='2017-09-30')Reverse GeocodingThis package also provides an easy-to-use one-liner reverse geocoder that usesNominatim%%time
rev_geocode_qc_df = reverse_geocode_points(qc_df)
rev_geocode_qc_df.head()Geospatial ClusteringThis packages uses KMeans as the unsupervised learning technique of choice to perform clustering on the geospatial data enriched with normalized indices, air quality and surface temperatures with your chosen number of clusters.clustering_model = perform_clustering(rev_geocode_qc_df, n_clusters=3)
rev_geocode_qc_df['labels'] = pd.Series(clustering_model.labels_)Visualize Hotspots on a MapThis packages also provides the capability of visualizing all the points of interest with their proper labels using one line of code.vizo = visualize_on_map(rev_geocode_qc_df)
vizoOpenStreetMap DataThe package needed is imported as follows:from aedes.osm_utils import initialize_OSM_network, get_OSM_network_dataSpatial Data from Map NetworksIn order to initialize and create an OpenStreetMap (OSM) network from a geojson of an AOI, use:%%time
network = initialize_OSM_network(aoi_geojson)Query Amenities DataIn order to pull data for, say, healthcare facilities (more documentation on amenitieshere), use this one-liner:final_df, amenities_df, count_distance_df = get_OSM_network_data(network,
                     satellite_df,
                     aoi_geojson,
                    ['clinic', 'hospital', 'doctors'],
                    5,
                    5000,
                    show_viz=True)This function pulls the count and distance of each node from a possible healthcare facility (for this example). It also outputs the original dataframe concatenated with the count and distances. The actual amenities data is also returned. We can then pass the resultingfinal_dfdataframe into another clustering algorithm to produce dengue risk clusters with the added health capacity features.Social Listening DataTo query for Google search trends, import:from aedes.social_listening_utils import get_search_trendsthen use:iso_geotag = "PH-00"
search_df = get_search_trends(iso_geotag)This pulls data for the top 5 dengue-related searches within a geolocation dictated by an ISO tag listed and describedhere. Below is a sample:datedenguedengue symptomsdengue feversymptoms of denguedengue sintomasisPartial2021-09-12 00:00:00172301False2021-09-19 00:00:00123111False2021-09-26 00:00:0061001False2021-10-03 00:00:0051000False2021-10-10 00:00:0091000False2021-10-17 00:00:0091000False2021-10-24 00:00:0091000False2021-10-31 00:00:0051100False2021-11-07 00:00:0081100False2021-11-14 00:00:0081000False2021-11-21 00:00:00122100False2021-11-28 00:00:00142210False2021-12-05 00:00:00103100False2021-12-12 00:00:0060000False2021-12-19 00:00:0072110False2021-12-26 00:00:0071211False2022-01-02 00:00:00115111False2022-01-09 00:00:00104210False2022-01-16 00:00:0073110False2022-01-23 00:00:0071100TrueAEDES Demo Web ApplicationIn order to demonstrate the functionalities of using the AEDES python package, we can use Streamlit to display a web application that takes in a geojson and outputs the hotspots and the recommended cities at risk. Clone this repository,cdinto it and follow the instructions below.Streamlit SetupInstall streamlit using:foo@bar:~$pipinstallstreamlitRunstreamlit helloto see if the installation was successful.Running the sample web applicationSimply run the code below to run a local version of your web application that outputs the at-risk areas as hotspots on a map as well as a subsequent list of places to prioritize disease-related proactive measures.The one below is for a dengue hotspot map for Quezon City, Philippines.This other screenshot shows the web application demonstrating the use of the geospatial modelling in outputting locations of high-risk areas.Another example for Cotabato City, Philippines is shown below.AEDES Automated Machine LearningWe have also added functionality to this package that performs tree-based pipeline optimization (TPOT) that optimizes machine learning pipelines using genetic algorithm as describedhere.Data preparation is still required as we as train-test splitting as needed. Using the one-linerperform_classificationorperform_regression, we can train a machine learning model hundreds to thousands of times in different configurations, feature engineering methodologies and various models in order to output:the best ml model (in-memory and saved as a pickle file, default isbest_model.pkl)the best ml pipeline which is a python script that describes the ml methodologyand the feature importances (both as a dataframe, and as a plot)model, feature_imps_df = perform_classification(X_train, y_train)The output should look like this:which also generates a python script of the best machine learning model pipeline similar to thisscript.