Practical Course 25

Global Digital Epidemiology: Integrating Search Signals with GeoAI and Earth Observation

Leverage Google Trends search signals and Earth Engine environmental predictors to model global syndromic health dynamics with Machine Learning.
Global ~2 hours Advanced
Dataset: ECMWF/ERA5_LAND/DAILY_AGGR ERA5-Land Daily Aggregated Climate Reanalysis

📖 Key Terms for Beginners

Before starting, make sure you understand these terms. They appear throughout all code blocks in this course.

TermFull NameWhat it means in simple words
RSVRelative Search VolumeA normalized query metric provided by Google Trends representing search interest for a specific term relative to total searches.
Digital EpidemiologyDigital EpidemiologyThe science that utilizes digital data sources, such as internet queries and social media, to study disease patterns and public health behaviors.
Syndromic SurveillanceSyndromic SurveillanceAn epidemiological method monitoring real-time health data, including symptom queries, to provide early warnings of disease outbreaks.
ERA5-LandECMWF ERA5-Land ReanalysisA global climate dataset offering hourly and daily atmospheric and land surface variables at high spatial resolution.
Spatial AutocorrelationSpatial AutocorrelationThe degree to which health or environmental variables in neighboring spatial units are correlated with one another.
MAUPModifiable Areal Unit ProblemA statistical bias where spatial analysis outcomes change when point data are aggregated into different boundary shapes or sizes.
Digital DivideDigital DivideThe socioeconomic gap between populations with consistent internet access and those without, impacting query representativeness.
Random Forest RegressionRandom Forest RegressionAn ensemble machine learning technique that trains multiple decision trees to predict continuous numerical targets.
Environmental DeterminantsEnvironmental Determinants of HealthExternal ecological and climate parameters, such as temperature and humidity, that influence human health outcomes.
Confounding VariableConfounding VariableAn extraneous factor that correlates with both the exposure and outcome, potentially masking true epidemiological relationships.
Feature ImportanceFeature ImportanceA metric in machine learning models that quantifies the relative contribution of each predictor variable.
Representativeness BiasRepresentativeness BiasA systemic sampling error where online digital search activity does not accurately reflect the demographics of the broader population.

Contents

  1. 1. Introduction to Digital Epidemiology and Web Search Signals
  2. 2. Methodological Framework: Merging Search Volatility with GeoAI
  3. 3. Defining Spatial Units and Global Administrative Boundaries
  4. 4. Extraction of Atmospheric and Surface Climate Determinants
  5. 5. Integrating Population Exposure via WorldPop
  6. 6. Harmonizing Tabular Search Signals with Earth Engine Features
  7. 7. Machine Learning Predictive Modeling with Random Forest
  8. 8. Model Evaluation and Feature Importance Analysis
  9. 9. Global Risk Proxy Mapping and Uncertainty Visualizations
  10. 10. Ethical Considerations, Bias Mitigation, and Export Workflows
1
Introduction
10 min

Digital epidemiology leverages global web search behavior to monitor public health trends, bridging the gap between delayed clinical surveillance and real-time early warnings. This course explores how to harmonize spatial Google Trends search volume signals with global Earth observation datasets using Google Earth Engine. By combining atmospheric covariates from ERA5-Land, surface temperature from MODIS, and population density from WorldPop, participants will build robust machine learning models to predict spatial disease proxies while explicitly accounting for spatial bias and digital infrastructure disparities.

GEE Asset ID
ECMWF/ERA5_LAND/DAILY_AGGR
Dataset Name
ERA5-Land Daily Aggregated Climate Reanalysis
Study Area
Global
AI Tool
DeepSeek (free, no API key needed)
🌍
What you will build: By the end of this course you will have a working GEE script that analyzes Global Digital Epidemiology: Integrating Search Signals with GeoAI and Earth Observation, computes statistics, visualizes results on an interactive map, and exports data to Google Drive.

2
Setup: GEE + DeepSeek
5 min

You need two browser tabs open side by side throughout this course.

1
Open chat.deepseek.com -- free account, no API key needed
2
Open code.earthengine.google.com in a second tab
3
Create a new GEE script named Course25_Global Digital Epidemiology: Integrating Search Signals with GeoAI and Earth Observation
💡
Workflow: Write a prompt in DeepSeek describing your task with exact dataset IDs and requirements. Copy the generated GEE JavaScript. Paste into GEE code editor. Click Run. Inspect results. Iterate.

3
Crafting the DeepSeek Prompt
15 min

The prompt is the core skill of this course. A good prompt includes the exact dataset ID, band names, study area coordinates, dates, preprocessing steps, and desired outputs.

📋 Main Prompt -- copy and paste this into DeepSeek
Act as an expert GeoAI educator and digital epidemiologist. Write a complete, execution-ready Google Earth Engine JavaScript script that demonstrates digital epidemiological modeling at a global scale. Use USDOS/LSIB_SIMPLE/2017 for administrative boundaries, ECMWF/ERA5_LAND/DAILY_AGGR for daily air temperature ('temperature_2m'), MODIS/061/MOD11A1 for land surface temperature ('LST_Day_1km'), and WorldPop/GP/100m/pop for population density. Construct a global FeatureCollection where environmental averages (mean temperature, surface thermal exposure, population density) are computed per country. Simulate a normalized Relative Search Volume (RSV) health proxy attribute for syndromic interest based on climate dependencies. Train a Random Forest regressor (ee.Classifier.smileRandomForest) on these spatial features to model digital health risk proxies. Include detailed inline code comments explaining spatial reduction, model training, feature importance extraction, and visual mapping. Provide step-by-step instructions and explicitly highlight ethical considerations regarding internet representativeness and health data privacy.
✨
After pasting the prompt: Wait 20-30 seconds for DeepSeek to generate the full GEE script. Copy the entire code block it produces. If the output is cut short, type "Continue the code" to get the rest.

4
Spatial Feature Aggregation and Environmental Determinant Extraction
10 min

Paste the following code into your GEE code editor and click Run. Read the beginner notes below to understand what each line does.

Spatial Feature Aggregation and Environmental Determinant Extraction
// Load global administrative boundaries
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');

// Define temporal range for environmental reduction
var startDate = '2023-01-01';
var endDate = '2023-12-31';

// Load air temperature from ERA5-Land Daily (Convert Kelvin to Celsius)
var era5 = ee.ImageCollection('ECMWF/ERA5_LAND/DAILY_AGGR')
  .filterDate(startDate, endDate)
  .select('temperature_2m')
  .mean()
  .subtract(273.15)
  .rename('mean_air_temp');

// Load Land Surface Temperature from MODIS
var modisLST = ee.ImageCollection('MODIS/061/MOD11A1')
  .filterDate(startDate, endDate)
  .select('LST_Day_1km')
  .mean()
  .multiply(0.02)
  .subtract(273.15)
  .rename('mean_lst');

// Load Population Density from WorldPop
var population = ee.Image('WorldPop/GP/100m/pop')
  .rename('pop_density');

// Combine environmental layers into a single multi-band image
var predictors = era5.addBands(modisLST).addBands(population);

// Aggregate environmental mean values across each country boundary
var countryFeatures = predictors.reduceRegions({
  collection: countries,
  reducer: ee.Reducer.mean(),
  scale: 10000
});

// Attach synthetic Google Trends Relative Search Volume (RSV) health proxy
// (Simulating search interest correlated with climate exposure for demonstration)
var healthDataset = countryFeatures.map(function(f) {
  var temp = ee.Number(f.get('mean_air_temp'));
  var pop = ee.Number(f.get('pop_density'));
  // Synthetic expression representing fever/influenza search volume proxy
  var rsvProxy = temp.multiply(-0.8).add(pop.log().multiply(2.5)).add(50);
  return f.set('RSV_Proxy', rsvProxy);
}).filter(ee.Filter.notNull(['mean_air_temp', 'mean_lst', 'pop_density', 'RSV_Proxy']));

// Print feature sample to Console
print('Processed Global Health Features:', healthDataset.limit(5));

// Visualization setup
Map.setCenter(0, 20, 2);
Map.addLayer(era5, {min: -10, max: 35, palette: ['blue', 'yellow', 'red']}, 'Mean Air Temp (C)');
Map.addLayer(countries, {color: '888888'}, 'Global Boundaries', false);
🔑
Beginner note: This script loads global country vector boundaries and integrates key atmospheric and demographic datasets. It calculates annual mean values for ERA5-Land air temperature, MODIS daily land surface temperature, and WorldPop population density. The `reduceRegions` function aggregates these raster predictor variables to country level features. Finally, a synthetic Google Trends Relative Search Volume (RSV) proxy is assigned to demonstrate how external digital health query indicators integrate with geospatial variables in Earth Engine.

5
GeoAI Machine Learning Predictive Modeling and Health Proxy Mapping
10 min

Add this block after the previous code. It continues the analysis with additional processing and visualization.

GeoAI Machine Learning Predictive Modeling and Health Proxy Mapping
// Prepare Machine Learning training attributes
var predictorNames = ['mean_air_temp', 'mean_lst', 'pop_density'];
var targetProperty = 'RSV_Proxy';

// Train a Random Forest Regressor inside Earth Engine
var rfRegressor = ee.Classifier.smileRandomForest(100)
  .setOutputMode('REGRESSION')
  .train({
    features: healthDataset,
    classProperty: targetProperty,
    inputProperties: predictorNames
  });

// Evaluate model resubstitution error
var trainedModel = healthDataset.classify(rfRegressor, 'Predicted_RSV');
print('Model Training Diagnostics:', rfRegressor.explain());

// Predict spatial health query risk raster continuously across global land masses
var spatialRiskMap = predictors.select(predictorNames).classify(rfRegressor);

// Apply population mask to exclude uninhabited zones
var maskedRiskMap = spatialRiskMap.updateMask(population.gt(1));

// Display predicted digital epidemiological risk map
var riskVis = {
  min: 20,
  max: 80,
  palette: ['#2b83ba', '#abdda4', '#ffffbf', '#fdae61', '#d7191c']
};

Map.addLayer(maskedRiskMap, riskVis, 'Predicted Health Search Risk Index');

// Export predicted spatial risk map as geotiff
Export.image.toDrive({
  image: maskedRiskMap,
  description: 'Global_Digital_Epidemiology_Risk_Map',
  scale: 10000,
  region: ee.Geometry.BBox(-180, -60, 180, 85),
  maxPixels: 1e13
});
🔑
Beginner note: This second code block configures and executes a Random Forest regression model (`ee.Classifier.smileRandomForest`). The regressor learns spatial patterns between environmental predictors (air temperature, land surface temperature, population density) and the digital search interest target variable. The trained model is then applied directly to global raster grids, outputting a continuous spatial risk map that highlights areas of high syndromic search potential based on climate and population exposures.

6
Export Results to Google Drive
5 min

Add this block at the end of your script to export the final map as a GeoTIFF to your Google Drive. After clicking Run, go to the Tasks tab in GEE and click Run next to each export task.

Export to Google Drive
// Export summarized country-level table including actual and predicted search proxies
Export.table.toDrive({
  collection: trainedModel,
  description: 'Global_Digital_Epidemiology_Country_Metrics',
  fileFormat: 'CSV',
  selectors: ['COUNTRY_NA', 'mean_air_temp', 'mean_lst', 'pop_density', 'RSV_Proxy', 'Predicted_RSV']
});
🔑
Beginner note -- Export.image.toDrive(): This function does not export immediately. It creates a task in the GEE Tasks tab that you must manually start by clicking Run. The file will appear in your Google Drive folder (GEE_Courses) as a GeoTIFF that you can open in QGIS or ArcGIS.

7
Exercises Using DeepSeek Prompts
Homework

Use DeepSeek to extend the script for each exercise below. Write a follow-up prompt describing what you want to add, then copy the generated code and paste it into your GEE script.

A. Temporal Alignment of Search Queries with Climate Extremes

  1. Modify the date filter to compare summer and winter seasons separately for both hemispheres.
  2. Recalculate country-level mean temperatures for both temporal windows.
  3. Analyze how seasonal shifts affect predicted digital search indices across continental zones.

B. Integrating Atmospheric Pollution as a Respiratory Health Predictor

  1. Import the Sentinel-5P TROPOMI Nitrogen Dioxide dataset ('COPERNICUS/S5P/OFFL/L3_NO2').
  2. Select the 'NO2_column_number_density' band and calculate annual global averages.
  3. Add NO2 as an additional predictor band in the multi-band raster image and retrain the Random Forest model.

C. Evaluating Digital Divide Bias via Connectivity Masks

  1. Load nightlights data from VIIRS ('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG') to serve as a proxy for infrastructure development.
  2. Filter out regions with low nightlight radiance where internet search availability is minimal.
  3. Compare model accuracy before and after masking unrepresented low-connectivity regions.

D. Sensitivity Analysis of Spatial Aggregation Units

  1. Replace country boundaries ('USDOS/LSIB_SIMPLE/2017') with a global grid mesh or administrative Level 1 boundaries.
  2. Re-aggregate climate and population variables at this finer spatial scale.
  3. Document how changing spatial scale impacts model feature importance scores and variance.

8
Prompt Engineering Tips
Reference

To get the best results from DeepSeek for GEE tasks, always include these elements in your prompts:

ElementExample
Exact dataset IDECMWF/ERA5_LAND/DAILY_AGGR
Band names"select band 'B4' for red, 'B8' for NIR"
Study area"rectangle [-6.5, 33.0, -1.5, 36.0] North Morocco"
Date range"filter from 2020-01-01 to 2023-12-31"
Output format"print area in hectares, add a legend, export to Drive"
Error fixing"The code gives error X. Please fix it."
Iteration"Add a time series chart for each year 2018-2023"
🧠
Best practice: Start with the main prompt, run the code, then send follow-up prompts to add features one at a time. This gives you cleaner, more reliable code than asking for everything at once.
Course 25 - Global Digital Epidemiology: Integrating Search Signals with GeoAI and Earth Observation | GeoAI for Climate Change | Dr. Ayoub Lahlouh | UM6P/CUS | 2025/2026