Skip to main content

Low Level Design

Introduction

About Drought-map Hub

The Eswatini DroughtMap Hub is a collaborative effort between the National Drought Management Center of Eswatini, the Ministry of Agriculture, and the Eswatini Meteorological Service. This platform is designed to provide a streamlined and user-friendly interface for validating, publishing, and exploring Combined Drought Indicator (CDI) products, enhancing the country's drought monitoring capabilities by enabling efficient data management and promoting public access to critical information.

The platform is structured into two key areas, catering to both administrative and public needs. The Admin Area is dedicated to authorized users who play a vital role in ensuring the accuracy and reliability of the CDI products. In this section, users can review and validate the outputs generated by CDI scripts, engage in collaborative discussions to assess data quality and address any inconsistencies, and approve and prepare validated datasets for public release. By maintaining robust data validation protocols, the Admin Area ensures that only high-quality, reliable information is made available to the public.

The Public Area serves as the platform’s primary interface for open access to CDI data. It is designed to be intuitive and engaging, allowing users of all backgrounds to explore comprehensive drought-related datasets, gain insights into drought trends and patterns, and utilize the data for research, planning, and decision-making purposes.

By bridging the gap between data generation and public accessibility, the Eswatini DroughtMap Hub empowers stakeholders, policymakers, and communities to make informed decisions for mitigating the impacts of droughts. This platform embodies a commitment to transparency, collaboration, and resilience in the face of environmental challenges.

The Purpose of Drought-map Hub

The

    purpose
  • Automate ofCDI generation: Using external datasets, the DroughtMapplatform Hubautomatically iscomputes the CDI on a monthly basis, leveraging scripts from the National Drought Mitigation Center (NDMC).
  • Structure CDI processing and storage: It processes CDI data and stores the output, including GeoTIFF raster files and aggregated GeoJSON vector files, in a structured manner on a Geonode platform.
  • Create a web application for collaboration and publication: It offers a web application for authorized users to provide a user-friendly interface toreview, validate, publish, and browsediscuss the CDI products.

    map before publishing it for public access.

Functional Overview

 

Automation / Jobs

  • The system utilizes a cron job to automate the CDI computation process monthly.
  • The job downloads external datasets, checks for updates, and runs NDMC scripts to generate CDI raster files.
  • An aggregation script then computes aggregated CDI values for each inkhundla, producing a CDI vector map in GeoJSON format.
  • The outputs are uploaded to the CDI storage on the Geonode platform.
  • The cron job can be manually triggered by Drought-map Hub Admins.

Home Page

Visitors to the DroughtMap Hub will be able to explore published Composite Drought Index (CDI) maps. The most recent map will be displayed by default, but visitors can select a specific point in time to view maps from other dates. Visitors can also compare two published maps by selecting two points in time; the two maps will be overlaid and visitors can use a slider to control the degree of overlay. Published maps can be downloaded in PNG and SVG formats. There is also a feedback form that allows visitors to send feedback or bug reports to the DroughtMap Hub administrators. Finally, an About Page provides information about the drought monitor and its data sources.

Data Approval

A three-step process is employed for data approval: Review, Validate, and Publish. Reviewers (members of the Technical Working Group) assess the computed CDI map and either approve it or suggest modifications to the CDI values for each inkhundla. Drought-map Hub Admins review the suggestions from reviewers and make the final decision on the CDI values for each inkhundla. Once validated, the CDI map is published on the public area of the Drought-map Hub.

User Access Control

The platform has three user types:

  1. Visitors: Read-only access to published CDI maps and public area features.
  2. Reviewers: Access to review and provide feedback on computed CDI maps before publication.
  3. Drought-map Hub Admins: Full access to manage the platform, users, and data publication processes.

Data VisualisationVisualization and Maps

The Drought-map Hub offers various visualization and map-related features:

  • Interactive CDI Maps: Users can interact with published CDI maps, zoom in/out, and view CDI values for different inkhundlas.
  • Historical Map Comparison: Visitors can compare two published maps to observe changes in CDI values over time.
  • CDI Raster Map: Reviewers have access to the non-aggregated CDI Raster Map for additional context during the review process.
  • Map Download: Visitors can download published maps in PNG and SVG formats, with options for customization.

User Workflow

Account Creation

 

Data Monitoring

  • Log Management: The cron job generates log files for each execution, recording details of the CDI computation process.
  • Error Management: The system handles errors during the automation process, preventing further execution for the affected month and sending notifications to relevant contacts.
  • Message Notifications: The system sends email notifications to Drought-map Hub Admins and Technical Support Contacts in case of missing data, successful automation, or errors during the process.

Data Forecasting

While the provided sources don't directly address data forecasting functionalities, the platform could potentially be expanded to include drought forecasting capabilities. This might involve:

Integrating with forecasting models: Incorporate data from existing drought forecasting models or develop new models to predict future drought conditions.
Visualizing forecasted data: Display forecasted drought maps alongside historical maps, allowing users to understand potential future drought trends.

Architecture

Class Functions

User Roles

Class Overview

Database Overview

Main Tables

  1. Users Table: Stores information about users, including their role (visitor, reviewer, admin), username, password, email address, and other relevant details.
  2. Administrations Table: Stores information about administrative regions in Eswatini, such as inkhundlas, districts, and regions, including their names, boundaries, and hierarchical relationships.
  3. Data Table: Stores the CDI data for each inkhundla and time period, including the computed CDI value, data source, and timestamp.
  4. Data Details Table: Stores additional details about the CDI data, such as the values of the input parameters used for the computation and any relevant metadata.
  5. Data Comments Table: Stores comments and feedback provided by reviewers and admins during the data approval process, linked to specific inkhundlas and time periods.

Relationship Diagrams

Sequence Diagrams

Data Flow Diagrams

High-Level Architecture Overview

1. Front-end (NextJS)

2. Back-end (Django)

3. Database (PostgreSQL)

4. Container Orchestration

5. CD/CI Pipeline

6. Jobs

Security and Stability Considerations

Database Design

1. Users Table

2. Administrations Table

3. Data Table

4. Data Details Table

5. Data Comments Table

API Design

1. User API

2. Data API

3. Comments API

4. Data Approval API

Data Storage

1. Static Maps

2. CDI Output

Error Handling

1. Application

2. CDI Jobs

Data Flow Diagrams

Testing

Deployment Strategy

Considerations

Design Considerations

  • Data Model: Carefully design the database schema to ensure efficient data storage and retrieval.
  • API Design: Create well-defined and documented API endpoints to enable seamless integration with other systems.
  • User Interface: Design a user-friendly and responsive interface that provides clear visualizations and intuitive interactions.

Performance Considerations

Documentation
    References

  • Optimize Data Processing: Use efficient algorithms and data structures to minimize processing time for CDI computation and data retrieval.
  • Caching: Implement caching mechanisms to reduce the load on the database and improve response times for frequently accessed data.
  • Load Balancing: Distribute traffic across multiple instances of the application to ensure high availability and responsiveness.
  • Swagger

    Read the Docs

    DBDocs