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

  • Automate CDI generation: Using external datasets, the platform automatically computes 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 review, validate, and discuss the CDI map before publishing it for public access.

Functional Overview

This functional overview describes how the Drought-map hub will use GeoNode to manage and publish CDI Maps, focusing on preventing automatic publishing and access control. It also covers the CDI Map publication workflow.

Automation / Jobs

  • The system utilizesfor amanaging the CDI Map dataset integrates automated processes with robust access controls to ensure accurate data generation and secure sharing. A cron job to automateautomates the CDImonthly computation processof monthly.

  • CDI
  • The(Combined jobDrought downloadsIndex) values by downloading external datasets, checkschecking for updates, and runsrunning NDMC scripts to generateproduce CDI raster files.
  • AnThese aggregationfiles scriptare then computesaggregated aggregatedto calculate CDI values for each inkhundla, producinggenerating a CDI vector map in GeoJSON format.
  • format,
  • Thewhich outputs areis uploaded to the CDIGeoNode storageplatform.

    on

    To maintain data integrity and control, automatic publishing of the GeonodeCDI platform.

  • Map
  • Theis crondisabled jobin can be manually triggeredGeoNode by setting the RESOURCE_PUBLISHING configuration to True. This ensures that the dataset undergoes a review process before being made publicly available. A dedicated user group, such as "Drought-map Hub Users," comprising reviewers and admins, is created to restrict access to the CDI Map dataset. Access permissions and the GROUP_PRIVATE_RESOURCES setting are applied to prevent visibility to unauthorized users. Additionally, metadata tags are used to identify and safeguard the dataset, ensuring it is used solely for its intended purpose.

    For flexibility, Drought-map Hub Admins.

  • Admins
can manually trigger the cron job as needed, providing oversight over the automated process while maintaining secure data handling and publication.

Home Page

The sources describe several functionalities offered by the Drought-Map Hub Public Area:

  • Visitors can browse published maps and select specific maps based on the date. The interface will display the map, associated narrative, and a link to the DroughtMaprelevant Hubbulletin will(if beavailable).
  • able
  • To compare changes over time, visitors can use the compare published maps functionality to exploreselect publishedtwo Compositepoints Droughtin Index (CDI) maps.time. The mosttwo recentchosen mapmaps 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 usewith a slider to control the degreeoverlay, facilitating comparison of overlay.CDI Publishedvalues.
  • maps
  • Map candownload beoptions downloadedare available in PNG and SVG formats. ThereThe issources also suggest a bonus feature for shapefile (.shp) download. Users can select elements like titles, legends, and annotations to customize downloaded maps for easier integration into knowledge products.
  • feedback form that allows visitors to sendshare feedback or bugreport reportsbugs, with submissions sent directly to the DroughtMapadmins.
  • Hub
  • An administrators. Finally, an About Page provides information about the drought monitormonitor, data sources, drought severity levels, contact information, and itsresources datafor sources.

    drought monitoring and planning.

Data Approval

AThe three-stepDrought-map hub will use GeoNode's API to retrieve the CDI Map dataset. This API allows the hub to interact with the GeoNode instance and retrieve the necessary data. More information on using the GeoNode API can be found in the GeoNode documentation

The sources provide details on the CDI Map publication process iswithin employedthe forDrought-map dataHub, approval:encompassing Review,three Validate,key andsteps:

Publish.
    Reviewers
  1. Review: (Reviewers, who are members of the Technical Working Group)Group, assessare notified via email when a new CDI Map is available for review. They can access the map in the Drought-map hub Admin Area, review each inkhundla (administrative region), approve the computed CDI map and either approve itvalue, or suggest modificationsnew values with justifications. Reviewers can also access the non-aggregated CDI Raster Map for additional context. Once the review is complete, reviewers finalize it, triggering an email notification to admins.
  2. Validation: Admins can start the validation step even before all reviewers have submitted their reviews. Admins access a table that summarizes reviewer suggestions for each inkhundla, making it easier for them to compare and select final CDI values.
  3. Publication: After validating the values, admins can publish the CDI Map, making it accessible to the CDI values for each inkhundla. Drought-map Hub Admins review the suggestions from reviewers and make the final decisionpublic on the CDI values for each inkhundla. Once validated, the CDI map is published on the public area of the Drought-map Hub.hub Public Area. The publishing process involves adding a narrative to provide context to visitors, with the option to share the map on social media.

 

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-mapDroughtMap Hub Admins: Full access to manage the platform, users, and data publication processes.

Data Visualization 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

https://docs.geonode.org/en/master/devel/api/usage/index.html#create-a-new-user

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: IncorporateTo predict future drought conditions, incorporate data from existing drought forecasting modelsmodels, or develop new modelsmodels. 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

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

  • Secure User Authentication: Implement robust authentication mechanisms like JWT (JSON Web Token) to protect user accounts and sensitive information.
  • Role-Based Access Control: Restrict access to features and data based on user roles (visitor, reviewer, admin).
  • Secure Data Storage: Encrypt sensitive data at rest and in transit to protect against unauthorized access.
  • Data Validation and Sanitization: Validate and sanitize user inputs to prevent security vulnerabilities like SQL injection and cross-site scripting (XSS) attacks.
  • Regular Security Audits: Conduct periodic security audits to identify and address potential vulnerabilities.
  • Error Handling and Logging: Implement comprehensive error handling and logging mechanisms to track and resolve issues, improving system stability.

Database Design

1. Users Table

poscolumnnulldtypelendefault






2. Administrations Table

poscolumnnulldtypelendefault






3. Data Table

poscolumnnulldtypelendefault






4. Data Details Table

poscolumnnulldtypelendefault






5. Data Comments Table

poscolumnnulldtypelendefault






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

  • 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