The study area is Ifanadiana, a rural health district located 444 km southeast of Antananarivo. The district has an area of 3,975 sq. km and is characterized by a mountainous landscape. The district’s health system is comprised of one hospital (CHRD II), 21 PHC facilities and 195 CHS where CHWs provide consultations for children under 5 years and reproductive women; these may be their homes or a designated structure. There is only one paved road crossing the district from West to East (national road RN25) and through Ranomafana National Park. Additionally, there are two non-paved axes connecting the main towns in the North and South of the District, which are partly accessible by 4WD vehicles or all-terrain motorcycles. Most villages in the District are connected to each other by small paths only accessible by foot. High rates of extreme poverty, geographical barriers, and unreliable health services were associated with very limited access to health care in the district in 2014, which was substantially lower than average estimates for Madagascar [50, 53]. Since then, the NGO PIVOT has worked in Ifanadiana in partnership with the Ministry of Health to create a "model district", so that the experience in this district can help improve national strategies and health policies throughout the country. The intervention included the removal of most point-of-service payments as well as improved facility readiness and clinical programs at all levels of care (i.e. hospital, health centers, and community health). In particular, Ifanadiana is one of the first districts to officially pilot the national policy on Universal Health Coverage, which aims to ensure access to quality healthcare for all through strengthened health systems and a reduction of point-of-care fees. Moreover, PIVOT is piloting alternative, professionalized, models of community health through enhanced supervision by certified nurses, building infrastructure for CHSs in partnership with local communities, and implementing proactive community case management. The work described in this study was in support of these two major initiatives.
Participatory mapping with OpenStreetMap
Detailed, freely available data on footpath networks and villages in rural areas of the developing world are necessary to obtain precise routes for accessing care, but this information is largely absent. To fill this gap, we carried out photo-interpretation using very high spatial resolution satellite images in OpenStreetMap (OSM), a collaborative mapping project with tools for drawing roads, houses, and land use contours among others . For this, we collaborated with the Humanitarian OpenStreetMap Team (HOTOSM) , an organization that promotes collaborative mapping projects on the OpenStreetMap platform for humanitarian purposes through a dedicated interface and network to a large online community. The district was divided into 3,508 tasks of 1 sq. km each. Mapping of each task was done in a two-stage process. First, one or several individuals mapped all paths, roads, buildings, and residential areas (defined as groups of 4 or more buildings) within a particular task. This was done on OSM using Digital Globe Standard imagery for background (30 – 60 cm spatial resolution), and Bing maps imagery (up to 30 cm spatial resolution) as backup when cloud cover in Digital Globe images prevented their use for mapping. After the task was marked as mapped, it was available for validation by a separate person. The validation stage, which uses the same tools as the mapping stage, allowed making all necessary corrections of each task in order to ensure the consistency and quality of the mapping. After the completion of this mapping in HOTOSM, we carried out an additional mapping of the hydrographic network (streams and rivers) and rice fields, following the same protocol. OSM mapping of Ifanadiana district was achieved in 8 months with the collaboration of 103 participants. To increase participation in the mapping project, we organized 5 “mapping parties” with local universities and OSM groups in both Madagascar and La Reunion. Despite it being a collaborative project and published in the HOTOSM Task Manager, we had few spontaneous contributions and 5 people from our research team mapped 73.6% of the overall project. The geographic data mapped in OSM is now freely accessible to any user and can be queried on QGIS  via the QuickOSM plugin, which we used here for retrieving the data for our analyses.
Recording travel time on the field
Most travel in Ifanadiana district is done by foot due the minimal transportation infrastructure and steep terrain. To obtain context-specific estimates of travel speed by foot according to terrain characteristics, we recorded GPS data from 168 walking routes across 10 out of the 15 communes of Ifanadiana district between September 2018 and April 2019 (Additional file 1). We collected two types of routes: 1) routes from field expeditions of PIVOT’s community team staff during CHW supervisions, and 2) routes specifically recorded for this project to obtain a larger sample size and wider representation of terrain characteristics, collected by representatives of the PIVOT research team and by the local population (Additional file 1). We recorded these tracks using Samsung Tab A10 tablets and the Android app “OsmAnd” version 3.0.2 . OsmAnd is a free map and navigation app based on the OSM database. For each trip, we recorded via OsmAnd the GPS location, time and altitude every 10 seconds.
Satellite imagery and remote sensing
We complemented the mapping work in OSM, which provides some elements of land use, with remote sensing analyses of satellite images to identify forests, water bodies and savanna land uses. For this, we used free Sentinel-2 images (level-2A) from August 18, 2018, which were orthorectified, provided Top Of Canopy (TOC) reflectance, and had a 10m spatial resolution. We used the Dzetsaka plugin for semi-automatic classification in QGIS . First, we manually outlined over fifty polygons representing regions of interest (ROI) for each of the three classes (forests, water bodies and savanna). We then ran random forest algorithms, which have good performance in the classification of remotely sensed data with good accuracy . The random forest model calculates a response variable by creating many different decision trees and then allocating each multi-layered pixel down each decision tree. The response is then determined by evaluating the responses from all trees. The class that is predicted the most is the class that is assigned to the object. Forty percent of the image’s pixels were used for validation. Second, we used the model to predict values for the whole satellite image in order to obtain a classified image. The last step of the process consisted of a post-classification, where smaller clusters of areas under 10,000 sq. m were removed and replaced by the pixel value of the largest neighbor polygon. This process was done to improve the quality of the classification product. Finally, we merged these supervised classifications with the two thematic classes obtained earlier through OSM (residential areas and rice fields). We validated the land use map by recording 62 control points on the field during four expeditions across the district and we completed these observations by identifying 254 points through Google Earth. We finally computed a confusion matrix to compare observed and classified values by class.
In addition to land cover, we obtained elevation and precipitation data from remotely sensed data. We downloaded the Shuttle Radar Topography Mission (SRTM) Digital Elevation Model (DEM) from the United States Geological Survey (USGS, ), which gives elevation with a 30 m ground resolution. We also acquired precipitation estimates from NASA Prediction of Worldwide Energy Resources (POWER) Project , with a spatial resolution of 0.5 * 0.5 degree.
Estimation of shortest path distance
Once the mapping of all buildings and footpaths was finalized, we used the OSRM software  to calculate the distance of the shortest path between each building and the closest health facility, via the R software package “osrm” (Figure 1). OSRM uses the Dijkstra’s routing Algorithm, which searches iteratively the shortest path from a single node to the destination node in a network. For each building, the shortest path distance to two health facilities were calculated: to the closest PHC and to the closest CHS. When the precise location of a CHS was unknown, we assumed that it was located in the main village of the Fokontany (“chef lieu”), as indicated in national policies for community health. In addition to the distance values, the actual shortest path was saved as a vector file (shapefile format) for use in travel time estimations (next section). Finally, we interpolated the distance values in the whole district using kriging methods available in ArcGIS to improve visualization of results.
Estimation of travel speed and time to seek treatment
To obtain precise and context-specific estimates of time to seek treatment, we studied the geographic and climatic factors associated with travel speed in the sample of 168 walking routes collected on the field. For this, travel speed between each pair of points within a GPS track was estimated for each track using the time and GPS location at which each point was taken. Then, using the raster data from the land use classification, DEM and rainfall, we intersected these data with the 168 walking routes. As a result, between each pair of points (N= 57,719) we obtained values for the following explanatory variables: degree of slope, cumulative distance since the beginning of the track, precipitation and land use.
We modelled the impact of each geographic and climatic factor on travel speed using additive models that included a random intercept for each individual track. First, exploratory and univariate analyses were carried out to understand the relationship between each variable and travel speed, including linear and non-linear relationships for slope as well as categorical and numerical variables for land use and cumulative distance (Additional file 2). Cumulative distance since the beginning of the track was categorized following exploratory analysis into 2 groups (0 to 13 km and 13 to 30 km) to reflect the reduction in speed after substantial walking. The land use was converted into a categorical variable that represented the predominant thematic class between each pair points, and a category « mixed » was added when the predominant class represented less than 50%. Slope was included as a non-linear smooth in the additive model. Each explanatory variable with a p-value under 0.1 was included in the multivariate analysis, and model fit was estimated via AIC (Akaike information criterion). The model with the lowest AIC was selected. Model validation was carried out to check for normality, homogeneity and independence of residuals.
Using travel speed estimates from the fixed effects of the final multivariate model, travel time was predicted for each of the 41,426 routes obtained through OSRM (two per isolated building or residential area, one to the closest PHC and one to the closest CHS). For this, we divided these routes into 100 m segments and intersected each segment with DEM and land use to obtain the same set of explanatory variables. Since rainfall affects travel speed and varies from day to day, for each route we provided a prediction for a scenario without rainfall (minimum time) and with the maximum amount of rainfall recorded during fieldwork (maximum time). As with travel distance, we used kriging methods to interpolate the values of travel for the entire district to improve visualization.
Development of an e-health tool with R Shiny
We developed an online app to facilitate use of the data and results from the study by local health staff. It consists of a website interface that builds on the estimation methods for distance and travel time in Ifanadiana district presented here, to make the results flexible and easily accessible by program managers and health workers (in French). We used the package Shiny  for R statistical software. This app is hosted at the PIVOT dashboard website (http://research.pivot-dashboard.org:3838/) for both private and public use.