How pnx-si/geonature works
Project Type and Purpose
• The application (GeoNature V2) is a full‑stack solution built with Python/Flask on the backend and Angular/Leaflet on the frontend.
• It works as a data entry and synthesis system – collecting observations according to various protocols (“faune” and “flore”), integrating external modules (such as UsersHub for user management, TaxHub for taxonomy, Nomenclature API, etc.), and providing an interface for synthesis and external dissemination.
• Its modular design allows extending the system with additional protocols via modules.
Main Components
• Backend Application: The core lies in the “backend” directory and the “geonature” package. It contains many sub-components:
• Core domain modules (gn_commons, gn_meta, gn_monitoring, gn_permissions, gn_profiles, gn_synthese, etc.), each responsible for a different domain (administration, permissions, synthesis, import logic, metadata, notifications, and more).
• A “dependencies” folder that shows integration of external modules (e.g., Habref-api-module, Nomenclature-api-module, TaxHub, UsersHub/authentification-module, etc.) which indicate further modularity and integration points with external systems.
• Command Line tools and Celery tasks for asynchronous operation.
• Frontend Application: Found under “frontend”. It is built with Angular and integrated with advanced UI components (using Bootstrap, Leaflet for maps, and custom modules for imports, syntheses, and user interactions). It has testing infrastructure with Cypress for end-to-end tests.
• Database Layer: While not explicitly named as “DB” folders, the backend contains extensive migration folders (alembic migrations in “backend/geonature/migrations”), SQL scripts (in the “data” directory), and configurations. This portion represents the relational DB structure and its evolution.
• External Modules and Services: The project is integrated with external systems such as:
• UsersHub for centralized user management.
• TaxHub, Nomenclature API, and others as separate submodules (found in “contrib” and through Git submodules).
• Additional modules (like validation, monitoring, export/import modules) separated as components integrated via the modular system.
• DevOps/Deployment: Dockerfiles, Makefile, and continuous integration files under “.github/workflows” show CI/CD integration plus Dockerized deployment.
Relationships and Interactions
• The Frontend communicates with the Backend over APIs. The architecture reflects a clear separation between presentation (Angular) and business logic (Flask).
• The Backend acts as the central orchestrator managing data from different protocols, invoking Celery tasks for asynchronous processing, and handling complex business logic (for instance, imports and notifications).
• The external modules (UsersHub, TaxHub, etc.) interact with the backend either as dependencies or with their own API endpoints as part of a microservices-like architecture.
• The database component is handled through migration scripts and interacts with the backend ORM models (SQLAlchemy likely through the Utils-Flask-SQLAlchemy modules).
Architectural Patterns and Design Principles
• Layered Pattern: Separation between controllers (Flask routes, Angular components), services (backend tasks, import actions), and data-access (models, migrations, repositories).
• Microservices inspiration (for external modules): Some functionality is separated into modules that can be developed and maintained independently.
• Use of asynchronous processing: Celery tasks indicate a separation of long-running or background jobs.