Resilience Atlas

An interactive analytical tool for building understanding of the extent and severity of some of the key stressors and shocks that are affecting rural livelihoods, production systems, and ecosystems in the Sahel, Horn of Africa and South and Southeast Asia.
https://github.com/ConservationInternational/resilienceatlas

Category: Consumption
Sub Category: Agriculture and Nutrition

Keywords

bigdata climate-change conservation resilience sustainability

Keywords from Contributors

deforestation forest-monitoring redux climate wri-api biodiversity wordpress half-earth arcgisjs react-components

Last synced: about 17 hours ago
JSON representation

Repository metadata

Resilience Atlas - Evidence-based decision-making around resilience

README.md

Resilience Atlas

Backend Tests
Frontend Tests
Integration Tests

Architecture

Directory Description Documentation Tech Stack
frontend Frontend application frontend/README.md React 19.2.0, Next.js 16.1.1, Node.js 24.0.0
backend Ruby on Rails backend (API + backoffice) backend/README.md Ruby 3.4.8, Rails 7.2.x
cloud_functions AWS Lambda functions cloud_functions/README.md AWS Lambda
infrastructure Terraform for TiTiler COG tiler infrastructure/README.md Terraform, AWS
data Data processing scripts data/README.md Various tools

Environments

Quick Start

Prerequisites

Development Setup

  1. Set up environment variables

    cp .env.example .env
    cp frontend/.env.example frontend/.env
    cp backend/.env.sample backend/.env
    
  2. Start the development environment

    docker compose -f docker-compose.dev.yml up --build
    

    This starts:

    • PostgreSQL database on port 5432
    • Backend API on http://localhost:3001
    • Frontend application on http://localhost:3000
  3. Admin Panel Access

    The admin panel is available at http://localhost:3001/admin with the following default credentials:

    Field Value
    Email admin@example.com
    Password password
  4. Database Seeding

    Seeds run automatically on the first start (when the database is empty) and are skipped on subsequent starts. To re-seed:

    # Force seeds on next startup
    FORCE_SEED=true docker compose -f docker-compose.dev.yml up backend
    
    # Or run seeds manually against a running container
    docker compose -f docker-compose.dev.yml exec backend bundle exec rails db:seed
    
  5. Load Admin Boundaries

    Admin boundary data (used for the analysis panel country selector) is not included in seeds. Import from the GeoPackage files in the boundaries/ directory:

    docker compose -f docker-compose.dev.yml run --rm \
      -v ./boundaries:/data/geoboundaries:ro \
      backend rake boundaries:import
    

Hybrid Development (Database in Docker, Apps Local)

For faster development iteration, you can run only the database in Docker while running the frontend and backend locally:

  1. Start only the database and martin

    docker compose -f docker-compose.dev.yml up -d db martin
    
  2. Start the backend (requires Ruby 3.4.8)

    cd backend
    bundle install
    bin/rails db:setup    # First time only
    bin/rails server -p 3001
    
  3. Start the frontend (requires Node.js 24.0.0)

    cd frontend
    npm install
    npm run dev
    

The frontend will be available at http://localhost:3000 and the backend at http://localhost:3001.

Note: This approach requires having the correct Ruby and Node.js versions installed locally. Use the full Docker setup if you don't have these versions available.

Running Tests

Backend Tests

# Run all backend tests
docker compose -f docker-compose.test.yml run --rm backend-test ./bin/test

# Individual commands
docker compose -f docker-compose.test.yml run --rm backend-test ./bin/test rspec    # Unit tests
docker compose -f docker-compose.test.yml run --rm backend-test ./bin/test lint     # StandardRB
docker compose -f docker-compose.test.yml run --rm backend-test ./bin/test security # Brakeman
docker compose -f docker-compose.test.yml run --rm backend-test ./bin/test system   # Browser tests

Frontend Tests

# Run all frontend checks
docker compose -f docker-compose.test.yml run --rm --no-deps frontend-test ./bin/test

# Individual commands
docker compose -f docker-compose.test.yml run --rm --no-deps frontend-test ./bin/test lint
docker compose -f docker-compose.test.yml run --rm --no-deps frontend-test ./bin/test type-check
docker compose -f docker-compose.test.yml run --rm --no-deps frontend-test ./bin/test build

Integration Tests

docker compose -f docker-compose.test.yml up --abort-on-container-exit

Boundary Data (Martin Vector Tiles)

Admin boundary polygons are served as vector tiles via Martin from the admin_boundaries table. The data comes from geoBoundaries CGAZ GeoPackage files and includes three admin levels (ADM0/ADM1/ADM2).

Full-resolution geometry is used at all zoom levels — ST_AsMVTGeom clips to the tile extent and quantizes coordinates to the MVT grid, keeping tiles compact without introducing shared-edge artifacts.

CDN (CloudFront)

Martin tiles are cached at the edge via CloudFront:

Browser → CloudFront (SSL + caching) → ALB (HTTP, host-header routing) → Martin
Environment URL Cache TTL
Production https://tiles.resilienceatlas.org 24 hours
Staging https://tiles.staging.resilienceatlas.org 1 hour

Deploy/update the CDN stack:

infrastructure/martin-cdn/deploy.sh --staging --profile resilienceatlas
infrastructure/martin-cdn/deploy.sh --production --profile resilienceatlas

Invalidate cache (after reimporting boundary data or changing tile sources):

scripts/invalidate-martin-cache.sh --staging --profile resilienceatlas
# Or invalidate only boundary tiles:
scripts/invalidate-martin-cache.sh --staging --paths "/boundary_tiles/*" --profile resilienceatlas

Importing Boundary Data (Deployed Environments)

  1. Upload GeoPackage files to the server (e.g. via scp):

    scp geoBoundariesCGAZ_ADM*.gpkg ubuntu@<server>:/tmp/geoboundaries/
    
  2. Find the correct Docker network and backend image:

    docker network ls | grep staging   # or grep production
    docker ps | grep backend
    
  3. Run the import via a one-off container with the data volume-mounted:

    # Staging example
    docker run --rm -it \
      --network resilienceatlas-staging_staging-network \
      --env-file /opt/resilienceatlas-staging/.env.staging \
      -v /tmp/geoboundaries:/data/geoboundaries:ro \
      <BACKEND_IMAGE> \
      bundle exec rake boundaries:import
    
  4. Restart Martin to pick up any function changes:

    docker service update --force resilienceatlas-staging_martin
    

Available Rake Tasks

Task Description
rake boundaries:import Import GeoPackage files into admin_boundaries
rake boundaries:status Show row counts by admin level
rake boundaries:clear Truncate all boundary data

Local Development

# With docker-compose.dev.yml running:
docker compose -f docker-compose.dev.yml run --rm \
  -v /path/to/gpkg/files:/data/geoboundaries:ro \
  backend rake boundaries:import

Documentation

License

See LICENSE for details.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 2,933
Total Committers: 29
Avg Commits per committer: 101.138
Development Distribution Score (DDS): 0.732

Commits in past year: 821
Committers in past year: 4
Avg Commits per committer in past year: 205.25
Development Distribution Score (DDS) in past year: 0.173

Name Email Commits
Alex Zvoleff a****f@c****g 786
Clara Linos c****a@s****s 689
David Inga d****a@v****m 221
Alvaro Leal p****e@g****m 163
copilot-swe-agent[bot] 1****t 160
martintomas m****t@g****m 111
Simao Rodrigues a****o@g****m 80
Clément Prod'homme c****e@v****m 72
paulahaertel p****l@m****g 67
Gerardo g****o@v****m 65
Miguel Mendoza m****a@v****m 63
Tiago Garcia t****g@g****m 61
dependabot[bot] 4****] 58
Alicia a****a@g****m 52
Alicia a****a@M****l 46
Sebastian Schkudlara s****a@g****m 40
Tiago Santos s****o@g****m 39
Adeel Kamal Malik a****7@h****m 35
Agnieszka Figiel a****l@g****m 29
Miguel Mendoza i****o@m****j 29
Miguel Barrenechea m****a@s****s 23
Andrés González a****s@s****s 13
Andrés González Muñoz a****z@v****m 11
Gerardo Pacheco g****o@s****s 8
Adeel Kamal Malik a****k@g****m 5
Ajay Ranipeta a****a@g****m 4
Ubuntu u****u@i****l 1
Gerardo g****t@g****m 1
bitTal a****z@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 27
Total pull requests: 282
Average time to close issues: about 8 hours
Average time to close pull requests: about 2 months
Total issue authors: 5
Total pull request authors: 15
Average comments per issue: 0.04
Average comments per pull request: 0.91
Merged pull request: 175
Bot issues: 0
Bot pull requests: 108

Past year issues: 9
Past year pull requests: 49
Past year average time to close issues: about 11 hours
Past year average time to close pull requests: 4 days
Past year issue authors: 1
Past year pull request authors: 3
Past year average comments per issue: 0.0
Past year average comments per pull request: 1.55
Past year merged pull request: 28
Past year bot issues: 0
Past year bot pull requests: 24

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/ConservationInternational/resilienceatlas

Top Issue Authors

  • azvoleff (18)
  • funkycoda (3)
  • MLNoon (3)
  • aagm (2)
  • vermeulendivan (1)

Top Pull Request Authors

  • dependabot[bot] (108)
  • Bluesmile82 (34)
  • martintomas (31)
  • Copilot (27)
  • davidsingal (15)
  • agnessa (15)
  • tiagojsag (9)
  • clementprdhomme (9)
  • santostiago (9)
  • AdeelKamalMalik (7)
  • azvoleff (6)
  • andresgnlez (4)
  • aagm (3)
  • SARodrigues (3)
  • funkycoda (2)

Top Issue Labels

  • bug (1)
  • frontend (1)
  • Kartoza (1)

Top Pull Request Labels

  • dependencies (108)
  • javascript (65)
  • backend (65)
  • frontend (48)
  • ruby (10)
  • infrastructure (4)
  • python (3)
  • WIP (2)
  • on hold (1)
  • blocked (1)

Package metadata

proxy.golang.org: github.com/conservationinternational/resilienceatlas


Dependencies

.github/workflows/titiler_cogs_cleanup.yaml actions
  • actions/checkout v3 composite
  • aws-actions/configure-aws-credentials v2 composite
  • aws-actions/setup-sam v2 composite
.github/workflows/titiler_cogs_deployment.yaml actions
  • actions/checkout v3 composite
  • aws-actions/configure-aws-credentials v2 composite
  • aws-actions/setup-sam v2 composite
cloud_functions/titiler_cogs/titiler_cogs/Dockerfile docker
  • public.ecr.aws/lambda/python 3.9 build
data/docker-compose.yml docker
  • ghcr.io/developmentseed/titiler latest
data/notebooks/Dockerfile docker
  • base latest build
  • mambaorg/micromamba 1.4 build
data/streamlit-app/Dockerfile docker
  • python 3.10-slim-buster build
frontend/Dockerfile docker
  • node 18.15.0-bullseye build
frontend/docker-compose.yml docker
  • cypress/included 12.7.0
frontend/package.json npm
  • @transifex/cli ^5.2.0 development
  • @types/google.maps ^3.52.5 development
  • @types/leaflet ^1.4.4 development
  • @types/leaflet-draw ^0.4.14 development
  • @types/node 18.14.6 development
  • @types/react ^18.0.28 development
  • @types/react-dom ^18.0.11 development
  • @types/react-foundation ^0.9.8 development
  • @types/react-slick ^0.23.10 development
  • @typescript-eslint/eslint-plugin 5.13.0 development
  • @typescript-eslint/parser 5.13.0 development
  • cypress ^12.7.0 development
  • eslint 8.23.1 development
  • eslint-config-next 12.2.3 development
  • eslint-config-prettier 8.6.0 development
  • eslint-import-resolver-typescript 3.5.1 development
  • eslint-plugin-import 2.26.0 development
  • eslint-plugin-prettier 4.2.1 development
  • husky ^1.3.1 development
  • lint-staged ^13.1.2 development
  • prettier 2.8.3 development
  • start-server-and-test ^2.0.0 development
  • typescript 4.5.2 development
  • @carto/carto.js 4.2.2
  • @googlemaps/js-api-loader ^1.15.1
  • @headlessui/react ^1.7.14
  • @reactour/tour ^3.3.0
  • @tanstack/react-query ^4.28.0
  • @transifex/native ^5.2.0
  • @transifex/react ^5.2.0
  • @turf/bbox-polygon ^6.5.0
  • axios ^0.21.2
  • classnames ^2.3.2
  • date-fns ^2.30.0
  • dotenv ^16.0.3
  • dotenv-cli ^7.1.0
  • foundation-sites 6.7.5
  • html-react-parser ^3.0.16
  • leaflet 1.4.0
  • leaflet-active-area 1.1.0
  • leaflet-utfgrid 0.3.0
  • leaflet.pm 2.0.3
  • lodash ^4.17.11
  • moment ^2.24.0
  • next 12.3.4
  • next-redux-wrapper ^8.1.0
  • normalize.css ^8.0.1
  • normalizr ^3.3.0
  • numeral ^2.0.6
  • qs ^6.9.7
  • react 17.0.2
  • react-beautiful-dnd ^11.0.0-beta.3
  • react-cookie ^4.1.1
  • react-dangerous-html ^1.0.0
  • react-datepicker ^4.11.0
  • react-dom 17.0.2
  • react-dropzone ^10.1.4
  • react-foundation 0.9.7
  • react-iframe ^1.8.0
  • react-modal ^3.16.1
  • react-redux 6.0.1
  • react-router ^4.3.1
  • react-slick 0.29.0
  • recharts ^1.5.0
  • redux ^4.0.1
  • redux-devtools-extension ^2.13.8
  • redux-form ^8.2.3
  • redux-thunk ^2.3.0
  • reselect ^4.0.0
  • resilience-layer-manager https://github.com/ConservationInternational/resilienceatlas-layermanager.git#1.0.4
  • sass ^1.58.3
  • slick-carousel ^1.8.1
  • use-debounce ^9.0.4
  • vega 5.23.0
  • vega-lib 4.4.0
  • vizzuality-components ^1.1.1
  • yup ^0.32.11
cloud_functions/sparc_plots/requirements.txt pypi
  • earthengine-api ==0.1.232
  • rollbar ==0.14.7
cloud_functions/titiler_cogs/titiler_cogs/requirements.txt pypi
  • mangum ==0.17.0
  • requests ==2.29.0
  • titiler.application ==0.11.6
data/streamlit-app/requirements.txt pypi
  • leafmap ==0.19.0
  • localtileserver ==0.6.4
  • palettable ==3.3.0
  • scikit-learn ==1.2.2
  • streamlit ==1.21.0
  • streamlit_folium ==0.11.1
backend/Gemfile rubygems
  • annotate >= 0 development
  • awesome_print >= 0 development
  • better_errors >= 0 development
  • binding_of_caller >= 0 development
  • brakeman >= 0 development
  • bundler-audit >= 0 development
  • byebug >= 0 development
  • capistrano ~> 3.9 development
  • capistrano-bundler >= 0 development
  • capistrano-passenger >= 0 development
  • capistrano-rails >= 0 development
  • capistrano-rbenv ~> 2.2 development
  • capybara >= 3.26 development
  • cuprite >= 0 development
  • faker >= 0 development
  • foreman >= 0 development
  • letter_opener_web >= 0 development
  • rspec-collection_matchers >= 0 development
  • rspec-request_snapshot >= 0 development
  • rspec-retry >= 0 development
  • rswag-specs >= 0 development
  • super_diff >= 0 development
  • web-console >= 0 development
  • webmock >= 0 development
  • active_admin-sortable_tree >= 0
  • active_admin_theme >= 0
  • active_model_serializers >= 0
  • active_storage_validations >= 0
  • activeadmin >= 0
  • activeadmin-globalize >= 0
  • activeadmin_addons >= 0
  • acts_as_list >= 0
  • addressable >= 0
  • ancestry >= 0
  • bcrypt_pbkdf >= 0
  • cancancan >= 0
  • devise >= 0
  • dotenv-rails >= 0
  • ed25519 >= 0
  • factory_bot_rails >= 0
  • ffi >= 0
  • globalize >= 0
  • image_processing >= 0
  • importmap-rails >= 0
  • jbuilder >= 0
  • json-schema >= 0
  • jwt >= 0
  • matrix >= 0
  • pg >= 0
  • prawn >= 0
  • prawn-table >= 0
  • puma >= 0
  • rack-cors >= 0
  • rails >= 0
  • ransack >= 0
  • rspec-rails >= 0
  • rswag >= 0
  • rubyzip >= 0
  • seed_dump >= 0
  • shrine >= 0
  • simple_command >= 0
  • slim-rails >= 0
  • sparkpost_rails >= 0
  • standard >= 0
  • terser >= 0
  • will_paginate >= 0
backend/Gemfile.lock rubygems
  • 194 dependencies
integration-tests/package.json npm
  • axios ^1.7.7
.github/workflows/backend_tests.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • docker/setup-buildx-action v3 composite
  • dorny/test-reporter v1 composite
.github/workflows/frontend_tests.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • docker/setup-buildx-action v3 composite
.github/workflows/integration_tests.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • docker/setup-buildx-action v3 composite
  • dorny/test-reporter v1 composite
backend/Dockerfile docker
  • base latest build
  • ruby 3.4.4-bullseye build
docker-compose.dev.yml docker
  • node 18.15.0-bullseye
  • postgis/postgis 15-3.3
docker-compose.test.yml docker
  • cypress/included 13.6.2
  • postgis/postgis 15-3.3
  • redis 7-alpine
integration-tests/package-lock.json npm
  • asynckit 0.4.0
  • axios 1.11.0
  • call-bind-apply-helpers 1.0.2
  • combined-stream 1.0.8
  • delayed-stream 1.0.0
  • dunder-proto 1.0.1
  • es-define-property 1.0.1
  • es-errors 1.3.0
  • es-object-atoms 1.1.1
  • es-set-tostringtag 2.1.0
  • follow-redirects 1.15.11
  • form-data 4.0.4
  • function-bind 1.1.2
  • get-intrinsic 1.3.0
  • get-proto 1.0.1
  • gopd 1.2.0
  • has-symbols 1.1.0
  • has-tostringtag 1.0.2
  • hasown 2.0.2
  • math-intrinsics 1.1.0
  • mime-db 1.52.0
  • mime-types 2.1.35
  • proxy-from-env 1.1.0
docker-compose.swarm.staging.yml docker
  • ${BACKEND_IMAGE} latest
  • ${FRONTEND_IMAGE} latest
  • ghcr.io/baosystems/postgis 16-3.4
  • redis 7-alpine
  • resilienceatlas-martin latest
.github/workflows/codedeploy_production.yml actions
  • actions/checkout v6 composite
  • aws-actions/amazon-ecr-login v2 composite
  • aws-actions/configure-aws-credentials v6 composite
  • docker/setup-buildx-action v4 composite
.github/workflows/deploy_ai_agent.yml actions
  • actions/checkout v6 composite
  • aws-actions/amazon-ecr-login v2 composite
  • aws-actions/configure-aws-credentials v6 composite
  • docker/build-push-action v7 composite
  • docker/setup-buildx-action v4 composite
cloud_functions/ai_agent/sync_embeddings/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
cloud_functions/earth_engine/download_image/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
.github/workflows/earth_engine_deployment.yaml actions
  • actions/checkout v6 composite
  • aws-actions/configure-aws-credentials v6 composite
  • aws-actions/setup-sam v3 composite
cloud_functions/ai_agent/action_groups/requirements.txt pypi
  • numpy >=1.26
  • requests >=2.31
  • rollbar >=1.0.0
cloud_functions/ai_agent/action_groups/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
cloud_functions/ai_agent/sync_embeddings/requirements.txt pypi
  • numpy >=1.26
  • requests >=2.31
.github/workflows/earth_engine_cleanup.yaml actions
  • aws-actions/configure-aws-credentials v6 composite
frontend/package-lock.json npm
  • 840 dependencies
cloud_functions/ai_agent/pipeline/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
.github/workflows/codedeploy_staging.yml actions
  • actions/checkout v6 composite
  • aws-actions/amazon-ecr-login v2 composite
  • aws-actions/configure-aws-credentials v6 composite
  • docker/setup-buildx-action v4 composite
docker-compose.swarm.yml docker
  • ${BACKEND_IMAGE} latest
  • ${FRONTEND_IMAGE} latest
  • redis 7-alpine
  • resilienceatlas-martin latest
cloud_functions/ai_agent/pipeline/requirements.txt pypi
scripts/cartodb_cog_conversion/batch_container/Dockerfile docker
  • ghcr.io/osgeo/gdal ubuntu-small-3.9.3 build
cloud_functions/earth_engine/histogram/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
cloud_functions/earth_engine/raster_interaction/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
cloud_functions/earth_engine/histogram/requirements.txt pypi
  • boto3 >=1.34.0
  • earthengine-api >=1.1.0
  • google-auth >=2.27.0
  • requests >=2.31.0
  • rollbar >=1.0.0
scripts/requirements.txt pypi
  • boto3 >=1.26.0
  • botocore >=1.29.0
  • click >=8.0.0
  • cryptography >=3.4.8
  • python-dotenv >=0.19.0
  • requests >=2.28.0
cloud_functions/earth_engine/download_image/requirements.txt pypi
  • boto3 >=1.34.0
  • earthengine-api >=1.1.0
  • google-auth >=2.27.0
  • requests >=2.31.0
  • rollbar >=1.0.0
scripts/cartodb_cog_conversion/batch_container/requirements.txt pypi
  • boto3 >=1.28.0
cloud_functions/earth_engine/raster_interaction/requirements.txt pypi
  • boto3 >=1.34.0
  • earthengine-api >=1.1.0
  • google-auth >=2.27.0
  • requests >=2.31.0
  • rollbar >=1.0.0

Score: -Infinity