Case Study: Creating an Interactive Geospatial Dashboard for Routine Immunization
A brief walkthrough of a dashboard created using shiny package in R
Introduction
Hello! In this post, I will be sharing with you a simple 3 part Shiny application that follows a standard modularized application structure. The project aimed to develop an interactive geospatial dashboard using Shiny, providing insights into Routine Immunization (RI) and Cold Chain Equipment (CCE) functionality across different states in Nigeria.
Objectives
Visualize the distribution of Cold Chain Equipment.
Provide a breakdown of Routine Immunization services in each state.
Create an interactive map allowing users to explore functionality details by clicking on specific states.
Technology Stack
Shiny Modules
In this project, we employed modularization to enhance code organization and maintainability. Two key modules were created:
riMapModule: Manages the interactive map and state functionality details.
riOverviewModule: Presents an overview of CCE and RI services.
Key Packages
sf: Used for handling geospatial data.
leaflet: Employed for creating interactive maps within the Shiny application.
bslib: Provided Bootstrap-themed layouts for the UI.
thematic: Utilized for customizing the CSS theme.
Project Structure
Modularization
The project was structured to promote code modularity, with separate R scripts for each Shiny module (riMapModule and riOverviewModule), promoting code reusability and ease of maintenance.
Directory Layout
The project directory layout is itemized as follows:
- app.R
- R/
- riMapModule.R
- riOverviewModule.R
- data/
- health_care_facilities_geo.rds
Development Process
Data Processing
Geospatial data on healthcare facilities was saved as an RDS file, loaded, and processed using the sf package. The CCE and RI service statistics were calculated for each state. The functionality status for each healthcare facility in each state was also summarized.
Interactive Maps
The leaflet package was employed to create interactive maps. Each state was represented as a circle marker with clusters which enabled a drill-down feature to the healthcare facility with their pop-up details.
Shiny Modules
Shiny modules were utilized to encapsulate logic and UI elements for both the overview and map components of the dashboard, fostering code modularity and maintainability.
User Interface (UI)
The bslib package was instrumental in customizing the UI appearance. Thematic styling provided a visually appealing and user-friendly interface for the dashboard.
Results and Impact
Overview
The dashboard offers a high-level overview of CCE distribution and RI services across Nigeria.
Users can quickly assess the functionality status of each state's CCE.
Interactive Maps
The interactive map enables users to click on states to view detailed information about RI and CCE functionality.
Custom markers and pop-ups enhance the visual experience.
Project GitHub Repository
Check out the project repo on GitHub for the code for this project. I will also be sharing a detailed walkthrough of the project code soon.
Future Enhancements
Data Updates: Implement mechanisms to update data dynamically, ensuring real-time insights.
User Authentication: Integrate user authentication for personalized access to sensitive information.
Additional tabs: Explore adding additional functionalities for Vaccine distribution and budgeting.
Conclusion
The Shiny application has successfully transformed complex geospatial data into an intuitive and interactive dashboard. The modular structure, use of Shiny modules, and thoughtful design choices have contributed to the project's success. As we continue to evolve the application, we anticipate providing even more valuable insights into Routine Immunization and Cold Chain Equipment functionality in Nigeria.