Whisp
Geospatial Analysis Tool for Zero-Deforestation Claims.
https://github.com/forestdatapartnership/whisp-app
Category: Biosphere
Sub Category: Deforestation and Reforestation
Last synced: about 18 hours ago
JSON representation
Repository metadata
- Host: GitHub
- URL: https://github.com/forestdatapartnership/whisp-app
- Owner: forestdatapartnership
- License: mit
- Created: 2024-03-07T14:34:32.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-19T16:32:10.000Z (6 days ago)
- Last Synced: 2025-12-22T00:57:06.439Z (4 days ago)
- Language: TypeScript
- Size: 1.77 MB
- Stars: 7
- Watchers: 2
- Forks: 5
- Open Issues: 4
- Releases: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Whisp: Geospatial Analysis Tool for Zero-Deforestation Claims
Table of Contents
- Overview
- System Architecture
- Access Methods
- Technology Stack
- Setup and Installation
- API Reference
- Python Integration
- License
Overview
WHISP is a comprehensive geospatial analysis tool that provides detailed risk assessment for zero-deforestation claims. The system ingests geometries in various formats (WKT, GeoJSON, or Asset Registry GeoIDs) and performs analysis using Google Earth Engine data through the openforis-whisp Python library.
Live Application: https://whisp.openforis.org/
System Architecture
High-Level Architecture
graph TB
subgraph "User Interfaces"
A[Web Application]
B[API Access]
C[Python Package]
D[Whisp in Earthmap]
N[QGIS Whisp Plugin]
end
subgraph "Application Layer"
E[Next.js Frontend]
F[API Routes]
G[Authentication Middleware]
end
subgraph "Processing Layer"
H[Python Analysis Engine]
I[openforis-whisp Library]
J[Google Earth Engine]
end
subgraph "Data Layer"
K[PostgreSQL Database]
L[Temporary Storage]
M[GEE Credentials]
end
A --> E
B --> F
E --> F
F --> G
G --> H
H --> I
I --> J
F --> K
H --> L
J --> M
Component Interaction Flow
sequenceDiagram
participant U as User
participant FE as Frontend
participant API as API Routes
participant AUTH as Auth Middleware
participant PY as Python Engine
participant GEE as Google Earth Engine
participant DB as Database
U->>FE: Upload Geometry
FE->>API: POST /api/submit/*
API->>AUTH: Validate API Key
AUTH->>DB: Check API Key
DB-->>AUTH: Key Valid
AUTH-->>API: Authorized
API->>PY: Execute Analysis
PY->>GEE: Process Geometry
GEE-->>PY: Analysis Results
PY-->>API: Results Data
API->>DB: Store Results
API-->>FE: Return Token
FE->>U: Display Results
Access Methods
WHISP offers multiple access methods to accommodate different user needs:
| Access Method | Description | Geometry Limit | Best For |
|---|---|---|---|
| Web App | User-friendly interface with interactive map | Currently 500 | Non-technical users, quick assessments |
| API | Programmatic access with authentication | Currently 500 | Integration with other systems |
| Python Package | Direct access via openforis-whisp |
No limit (depends on GEE quotas) | Data scientists, large datasets |
| Whisp in Earthmap | Visualization-focused interface | Limited (visualization tool) | Visual exploration of specific plots |
| QGIS Whisp Plugin | Analyze geometries within QGIS through the Whisp API | Currently 500 | GIS analysts, desktop workflows |
Technology Stack
Frontend Technologies
- Framework: Next.js 14.2.26 with React 18
- Language: TypeScript 5.8.2
- Styling: Tailwind CSS with custom components
- UI Components: Radix UI component library
- Mapping: Leaflet 1.9.4 with react-leaflet 4.2.1
- State Management: Zustand 4.4.7
- Data Tables: TanStack Table 8.20.1
- File Handling: react-dropzone 14.2.3
Backend Technologies
- Runtime: Node.js with Next.js API routes
- Database: PostgreSQL with pg driver 8.14.1
- Authentication: JWT tokens via jose 6.0.10
- Email: Nodemailer 6.10.0 for verification/reset
- Python Integration: Subprocess execution
- API Documentation: Swagger UI React 5.21.0
- Logging: Winston 3.15.0
Python Environment
- Core Library:
openforis-whispfor risk assessment - Data Processing:
pandas,numpyfor data manipulation - Geospatial: Google Earth Engine API
- Output Formats: JSON, CSV, GeoJSON
Setup and Installation
Prerequisites
- Node.js (v18 or higher)
- PostgreSQL (v12 or higher)
- Python 3.11+
- Google Earth Engine service account
Installation Steps
-
Clone the Repository
git clone https://github.com/openforis/whisp-app.git cd whisp-app -
Install Dependencies
-
Install the whisp Python package and other requirements
pip install -r requirements.txt -
Install project dependencies
npm install
-
-
Set Up PostgreSQL Database
- Create a new PostgreSQL database for the application
- Run the database schema scripts located in
src/db/* - Create a database user with appropriate permissions
-
Environment Configuration
- Create
.env.localfile:
# Python Configuration PYTHON_PATH=/path/to/your/python # Database Configuration DB_USER=postgres DB_HOST=localhost DB_NAME=whisp DB_PASSWORD=your_password DB_PORT=5432 # Authentication JWT_SECRET=your_jwt_secret # Asset Registry ASSET_REGISTRY_BASE=https://api-ar.agstack.org AR_API_KEY=your_ar_api_key AR_CLIENT_SECRET=your_ar_client_secret # Email Configuration EMAIL_SERVICE=smtp.example.com EMAIL_USER=user@example.com EMAIL_PASS=your_email_password # Google Maps API Key (for satellite view - with referrer restrictions) NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here - Create
-
Google Earth Engine Setup
- Place your service Google Earth engine account credentials in
credentials.jsonat the root directory.
- Place your service Google Earth engine account credentials in
-
Create Temp Directory
mkdir temp -
Run the Application
npm run dev -
Create an API Key (optional for direct API calls)
- After setting up, register a user account on the application
- Generate an API key from your user profile
- Use this API key for authenticated requests to the API endpoints
API Reference
The Whisp API provides endpoints for user management, data submission, and analysis. The API is protected by authentication middleware. A full, interactive API documentation is available via Swagger UI at the /documentation/api-guide endpoint.
The main API endpoints are located in src/app/api/.
/api/auth: Handles user authentication, including login, registration, password reset, and email verification./api/user: Manages user profiles and API keys./api/submit: Accepts geospatial data in various formats (WKT, GeoJSON) for analysis. This endpoint initiates the Python processing script./api/temp-key: Manages temporary keys for unauthenticated analysis./api/generate-geojson: Generates GeoJSON output from analysis results./api/report: Creates and serves analysis reports./api/download-csv: Allows downloading analysis results as a CSV file.
Python Integration
Analysis Engine
The Python analysis is handled by src/python/analysis.py:
import openforis_whisp as whisp
import pandas as pd
# Initialize Google Earth Engine
whisp.initialize_ee(CREDENTIAL_PATH)
def main(file_path, legacy_mode=False):
# Process geometry data
whisp_df = whisp.whisp_formatted_stats_geojson_to_df(
file_path,
national_codes=['co', 'ci', 'br']
)
# Perform risk assessment
whisp_df_risk = whisp.whisp_risk(
whisp_df,
national_codes=['co', 'ci', 'br']
)
# Export results
whisp_df_risk.to_csv(csv_file_path, index=False)
whisp.convert_df_to_geojson(whisp_df_risk, json_file_path)
Integration Flow
- User submits geometry via web interface
- Next.js API validates input and authentication
- Geometry is saved to temporary file
- Python script is executed via subprocess
- Results are processed and stored
- User receives analysis results
License
Built with ❤️ for forests and biodiversity.
Owner metadata
- Name: Forest Data Partnership
- Login: forestdatapartnership
- Email: forestdatapartnership@wri.org
- Kind: organization
- Description: Forest Data Partnership
- Website: www.forestdatapartnership.org
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/155651852?v=4
- Repositories: 3
- Last ynced at: 2024-04-18T02:16:21.315Z
- Profile URL: https://github.com/forestdatapartnership
GitHub Events
Total
- Create event: 20
- Commit comment event: 1
- Release event: 7
- Issues event: 76
- Watch event: 4
- Delete event: 21
- Member event: 1
- Issue comment event: 6
- Push event: 160
- Pull request review event: 2
- Pull request event: 14
- Fork event: 1
Last Year
- Create event: 16
- Release event: 7
- Issues event: 73
- Watch event: 4
- Delete event: 20
- Member event: 1
- Issue comment event: 3
- Push event: 146
- Pull request review event: 2
- Pull request event: 8
Issue and Pull Request metadata
Last synced: 7 days ago
Total issues: 40
Total pull requests: 28
Average time to close issues: 2 months
Average time to close pull requests: 14 days
Total issue authors: 8
Total pull request authors: 6
Average comments per issue: 0.13
Average comments per pull request: 0.04
Merged pull request: 17
Bot issues: 0
Bot pull requests: 0
Past year issues: 29
Past year pull requests: 3
Past year average time to close issues: 17 days
Past year average time to close pull requests: 1 day
Past year issue authors: 4
Past year pull request authors: 2
Past year average comments per issue: 0.07
Past year average comments per pull request: 0.0
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- rurdea (26)
- 12rambau (8)
- p3ace-0 (1)
- RSO9192 (1)
- jonnvega (1)
- mohnda (1)
- jo-spek (1)
- charlottesmith0308 (1)
Top Pull Request Authors
- jonnvega (10)
- rurdea (8)
- andyarnell (3)
- jo-spek (3)
- RSO9192 (2)
- 12rambau (2)
Top Issue Labels
- enhancement (7)
- documentation (3)
- question (1)
- bug (1)
Top Pull Request Labels
Dependencies
- base latest build
- python 3.11-slim build
- 634 dependencies
- @terraformer/wkt ^2.2.0 development
- @types/geojson ^7946.0.14 development
- @types/node ^20 development
- @types/react ^18 development
- @types/react-dom ^18 development
- @types/swagger-ui-react ^4.18.3 development
- @types/terraformer__wkt ^2.0.2 development
- autoprefixer ^10.0.1 development
- eslint ^8 development
- eslint-config-next 14.0.3 development
- postcss ^8 development
- tailwindcss ^3.3.0 development
- typescript ^5 development
- @google/earthengine ^0.1.390
- @mapbox/geojsonhint ^3.3.0
- geojson-validation ^1.0.2
- next 14.0.3
- react ^18
- react-dom ^18
- swagger-ui-react ^5.11.7
- terraformer-wkt-parser ^1.2.1
- uuidv4 ^6.2.13
- xml2js ^0.6.2
- zip-a-folder ^3.1.6
- zustand ^4.4.7
- geemap ==0.29.6
- geopandas ==0.14.1
- numpy ==1.26.3
- pandas ==2.1.4
Score: -Infinity