How ramdhadage/biodiversitydashboard works
Main Components
• User Interface (UI): Represented by the Shiny UI components. The core UI is defined in app.R, and additional UI modules (e.g., mod01_loadInputs_ui.Rd, mod02_viewMap_ui.Rd) break the interface into distinct parts.
• Server Logic: The Shiny server is also largely defined in app.R with global.R, and is divided into modular components (for loadInputs, viewMap, timelineVisualization). This level handles the business logic and interactivity.
• Data Management: The project uses an internal data store contained in sysdata.rda and potentially dynamic data loading methods via mod01_loadInputs and utils functions (like utils00_loadData.R).
• Visualization Components: Mapping (via leaflet and JavaScript popups/labels) and timeline plotting (using Echarts4r and JavaScript enhancements).
• Helper and Utility Functions: These are organized as helper.R, utils-pipe.R, and other utilities which support data processing and pipeline orchestration.
• Documentation and Testing: The man folder contains Rd documentation for each module and function, while the tests folder includes unit tests ensuring module and function correctness.
• Package Infrastructure: Standard R package files (DESCRIPTION, NAMESPACE), project metadata (BiodiversityDashboard.Rproj), and dependency management (renv and renv.lock).
Relationships and Interactions
• Application Startup: When BiodiversityDashboard::run_bd_app() is executed, app.R (which pulls in global.R and helper functions) initializes the Shiny application.
• Data Flow: Indicate that user inputs (such as species search or selection changes, provided through radio buttons and dynamic UI elements) are passed from the UI through reactive server modules, which process and filter data, then update visual outputs (maps and plots) accordingly.
• External Libraries and Performance Components: Note the role of packages like data.table for fast data reads, memoise for caching, and the JavaScript libraries which enhance user experience on both the map and the timeline visualization.
Architectural Patterns
• Separation of Concerns: Differentiate between the UI part, the server logic, and the data processing utilities.
• Documentation and Testing: Although not part of the runtime application, document how robust testing (found in tests/testthat) and comprehensive documentation (in the man folder) contribute to the overall quality assurance and maintainability of the system.