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 19 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:

  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
    

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

Vector Tiles (Martin)

Martin is a Rust-based vector tile server that can serve PostGIS MVT functions and MBTiles files. Martin is used for serving vector data layers from the database.

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://martin.resilienceatlas.org 7 days
Staging https://martin.staging.resilienceatlas.org 1 day

Deploy/update the CDN stack:

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

Invalidate cache (after changing tile sources or data):

scripts/invalidate-martin-cache.sh --staging --profile resilienceatlas
# Or invalidate specific paths:
scripts/invalidate-martin-cache.sh --staging --paths "/your_tiles/*" --profile resilienceatlas

Boundary Data (Mapbox Streets Vector Tiles)

Admin boundary lines are served via Mapbox Streets V4 Vector Tiles API, eliminating self-hosted boundary infrastructure.

Data Source:

  • Tileset: mapbox.mapbox-streets-v8 (official Mapbox Streets)
  • API: https://api.mapbox.com/v4/mapbox.mapbox-streets-v8/{z}/{x}/{y}.mvt?access_token={token}
  • Source-layer: admin (admin_level 0-2: countries, first-level divisions, second-level divisions)
  • Access token: Hardcoded in frontend/src/views/components/Map/OLMap/boundaries.ts

User Interface:

  • Three mutually exclusive options (matching labels pattern):
    • Dark boundaries: For light backgrounds
    • Light boundaries: For dark backgrounds/satellite
    • No boundaries: Boundaries disabled
  • URL persistence: ?boundaryStyle=dark|light (omitted when 'none')

Implementation:

  • Frontend: OpenLayers VectorTileLayer with custom styling
  • Filters: Admin source-layer only, excludes maritime boundaries
  • Styling: Halo + line two-layer pattern for visibility
  • Redux state: map.boundaryStyle ('dark' | 'light' | 'none')
  • Code: frontend/src/views/components/Map/OLMap/boundaries.ts

Benefits:

  • Zero infrastructure maintenance (no database, imports, or tile server)
  • Professional boundary data from Mapbox
  • Vector tiles with transparency for proper overlay rendering
  • 200,000 requests/month free tier
  • Global CDN caching

Documentation

License

See LICENSE for details.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 2,953
Total Committers: 29
Avg Commits per committer: 101.828
Development Distribution Score (DDS): 0.73

Commits in past year: 755
Committers in past year: 4
Avg Commits per committer in past year: 188.75
Development Distribution Score (DDS) in past year: 0.111

Name Email Commits
Alex Zvoleff a****f@c****g 798
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
dependabot[bot] 4****] 66
Gerardo g****o@v****m 65
Miguel Mendoza m****a@v****m 63
Tiago Garcia t****g@g****m 61
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: 2 days ago

Total issues: 27
Total pull requests: 302
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.87
Merged pull request: 175
Bot issues: 0
Bot pull requests: 128

Past year issues: 0
Past year pull requests: 51
Past year average time to close issues: N/A
Past year average time to close pull requests: 9 days
Past year issue authors: 0
Past year pull request authors: 3
Past year average comments per issue: 0
Past year average comments per pull request: 0.98
Past year merged pull request: 19
Past year bot issues: 0
Past year bot pull requests: 37

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

Top Issue Authors

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

Top Pull Request Authors

  • dependabot[bot] (128)
  • 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 (128)
  • javascript (85)
  • 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
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
.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
.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
.github/workflows/earth_engine_deployment.yaml actions
  • actions/checkout v6 composite
  • aws-actions/configure-aws-credentials v6 composite
  • aws-actions/setup-sam v3 composite
.github/workflows/earth_engine_cleanup.yaml actions
  • aws-actions/configure-aws-credentials v6 composite
.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
data/notebooks/Dockerfile docker
  • base latest build
  • mambaorg/micromamba 1.4 build
cloud_functions/ai_agent/sync_embeddings/requirements.txt pypi
  • numpy >=1.26
  • requests >=2.31
cloud_functions/earth_engine/raster_interaction/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
cloud_functions/ai_agent/action_groups/requirements.txt pypi
  • numpy >=1.26
  • requests >=2.31
  • rollbar >=1.0.0
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
data/docker-compose.yml docker
  • ghcr.io/developmentseed/titiler latest
cloud_functions/ai_agent/pipeline/requirements.txt pypi
cloud_functions/titiler_cogs/titiler_cogs/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
frontend/docker-compose.yml docker
  • cypress/included 12.7.0
data/streamlit-app/Dockerfile docker
  • python 3.10-slim-buster build
docker-compose.dev.yml docker
  • node 24-bookworm
  • postgis/postgis 15-3.3
  • redis 7-alpine
cloud_functions/ai_agent/pipeline/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
cloud_functions/ai_agent/sync_embeddings/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
docker-compose.swarm.yml docker
  • ${BACKEND_IMAGE} latest
  • ${FRONTEND_IMAGE} latest
  • redis 7-alpine
  • resilienceatlas-martin latest
frontend/package-lock.json npm
  • 840 dependencies
cloud_functions/ai_agent/action_groups/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
cloud_functions/sparc_plots/requirements.txt pypi
  • earthengine-api ==0.1.232
  • rollbar ==0.14.7
cloud_functions/earth_engine/download_image/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
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
data/streamlit-app/requirements.txt pypi
  • leafmap ==0.19.0
  • localtileserver ==0.6.4
  • palettable ==3.3.0
  • scikit-learn ==1.5.0
  • streamlit ==1.54.0
  • streamlit_folium ==0.11.1
frontend/package.json npm
  • @eslint/js ^9.17.0 development
  • @transifex/cli ^7.1.5 development
  • @types/google.maps ^3.58.1 development
  • @types/node ^24.0.0 development
  • @types/react ^19.0.2 development
  • @types/react-dom ^19.0.2 development
  • @types/react-foundation ^0.9.8 development
  • @types/react-slick ^0.23.13 development
  • @typescript-eslint/eslint-plugin ^8.18.2 development
  • @typescript-eslint/parser ^8.18.2 development
  • cypress ^15.20.0 development
  • eslint ^9.17.0 development
  • eslint-import-resolver-typescript ^3.7.0 development
  • eslint-plugin-import ^2.31.0 development
  • eslint-plugin-prettier ^5.2.1 development
  • eslint-plugin-react ^7.37.3 development
  • eslint-plugin-react-hooks ^5.1.0 development
  • husky ^9.1.7 development
  • lint-staged ^15.2.11 development
  • prettier ^3.4.2 development
  • start-server-and-test ^2.0.9 development
  • typescript ^5.7.2 development
  • @googlemaps/js-api-loader ^1.16.8
  • @headlessui/react ^2.2.0
  • @hello-pangea/dnd ^18.0.1
  • @hookform/resolvers ^5.2.2
  • @reactour/tour ^3.7.0
  • @rollbar/react ^1.0.0
  • @tanstack/react-query ^5.62.0
  • @transifex/native ^7.1.5
  • @transifex/react ^7.1.5
  • @turf/bbox-polygon ^7.1.0
  • @types/dompurify ^3.0.5
  • axios ^1.18.1
  • classnames ^2.5.1
  • date-fns ^4.1.0
  • dompurify ^3.4.13
  • dotenv ^16.4.7
  • dotenv-cli ^8.0.0
  • html-react-parser ^5.2.0
  • lodash ^4.18.1
  • next ^16.3.0
  • next-redux-wrapper ^8.1.0
  • normalize.css ^8.0.1
  • normalizr ^3.6.2
  • numeral ^2.0.6
  • ol ^10.9.0
  • ol-mapbox-style ^12.6.1
  • qs ^6.15.3
  • react 19.2.0
  • react-cookie ^7.2.2
  • react-dangerous-html ^1.0.0
  • react-datepicker ^7.5.0
  • react-dom 19.2.0
  • react-dropzone ^14.3.5
  • react-hook-form ^7.70.0
  • react-iframe ^1.8.5
  • react-modal ^3.16.3
  • react-redux ^9.2.0
  • react-slick 0.30.3
  • react-window ^2.2.7
  • recharts ^2.15.0
  • redux ^5.0.1
  • redux-thunk ^3.1.0
  • reselect ^5.1.1
  • rollbar ^3.1.0
  • sass ^1.83.0
  • slick-carousel ^1.8.1
  • use-debounce ^10.0.4
  • yup ^1.5.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
cloud_functions/earth_engine/histogram/Dockerfile docker
  • public.ecr.aws/lambda/python 3.14 build
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
docker-compose.test.yml docker
  • cypress/included 13.15.0
  • node 22.11.0-alpine
  • postgis/postgis 15-3.3
  • redis 7-alpine
frontend/Dockerfile docker
  • base latest build
  • node 24-bookworm build
cloud_functions/titiler_cogs/titiler_cogs/requirements.txt pypi
  • mangum >=0.19.0
  • requests >=2.32.0
  • rollbar >=1.0.0
  • titiler.application ==1.1.0
integration-tests/package.json npm
  • axios ^1.18.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
scripts/cartodb_cog_conversion/batch_container/Dockerfile docker
  • ghcr.io/osgeo/gdal ubuntu-small-3.9.3 build
integration-tests/package-lock.json npm
  • agent-base 6.0.2
  • asynckit 0.4.0
  • axios 1.18.0
  • call-bind-apply-helpers 1.0.2
  • combined-stream 1.0.8
  • debug 4.4.3
  • 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.16.0
  • form-data 4.0.6
  • 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.4
  • https-proxy-agent 5.0.1
  • math-intrinsics 1.1.0
  • mime-db 1.52.0
  • mime-types 2.1.35
  • ms 2.1.3
  • proxy-from-env 2.1.0
scripts/cartodb_cog_conversion/batch_container/requirements.txt pypi
  • boto3 >=1.28.0

Score: -Infinity