{"id":38654540,"url":"https://github.com/openwashdata/basisghana","last_synced_at":"2026-01-17T09:25:38.313Z","repository":{"id":187208052,"uuid":"676448371","full_name":"openwashdata/basisghana","owner":"openwashdata","description":"This package compiles sanitation data from established Open Defecation Free (ODF) communities across different regions in Ghana.","archived":false,"fork":false,"pushed_at":"2024-01-15T12:55:52.000Z","size":2122,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-05T04:26:20.304Z","etag":null,"topics":["defecation","ghana","open-data","openwashdata","r","sanitation","wash"],"latest_commit_sha":null,"homepage":"https://openwashdata.github.io/basisghana/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openwashdata.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-09T08:14:53.000Z","updated_at":"2024-03-05T13:48:01.000Z","dependencies_parsed_at":"2024-01-15T14:46:33.220Z","dependency_job_id":"f5c46385-e574-44d5-afe8-5e21ff6de213","html_url":"https://github.com/openwashdata/basisghana","commit_stats":null,"previous_names":["openwashdata/basisghana"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/openwashdata/basisghana","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwashdata%2Fbasisghana","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwashdata%2Fbasisghana/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwashdata%2Fbasisghana/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwashdata%2Fbasisghana/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openwashdata","download_url":"https://codeload.github.com/openwashdata/basisghana/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwashdata%2Fbasisghana/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28505550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["defecation","ghana","open-data","openwashdata","r","sanitation","wash"],"created_at":"2026-01-17T09:25:38.184Z","updated_at":"2026-01-17T09:25:38.281Z","avatar_url":"https://github.com/openwashdata.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\neditor_options: \n  chunk_output_type: console\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\",\n  message = FALSE,\n  warning = FALSE,\n  fig.retina = 2,\n  fig.align = 'center'\n)\n\nlibrary(tidyverse)\nlibrary(epoxy)\nlibrary(universityrankingafrica)\n```\n\n# basisghana\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/openwashdata/basisghana/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/openwashdata/basisghana/actions/workflows/R-CMD-check.yaml)\n[![DOI](https://zenodo.org/badge/676448371.svg)](https://zenodo.org/doi/10.5281/zenodo.10255444) \n\u003c!-- badges: end --\u003e\n\nThis package compiles sanitation data from established Open Defecation Free (ODF) communities across different regions in Ghana.\n\n```{r, echo=FALSE}\nlibrary(sf)\nlibrary(rnaturalearth)\nlibrary(ggplot2)\nlibrary(tidyverse)\nlibrary(basisghana)\nlibrary(dplyr)\n\nbasisghananew \u003c- basisghana |\u003e \n  rename(district_en = \"district\") |\u003e\n  mutate(district_en = case_when(\n    district_en == \"Abura Asebu Kwamankes\" ~ \"Abura-Asebu-Kwamankese\",\n    district_en == \"Ajumako Enyan Essiam\" ~ \"Ajumako-Enyan-Essiam\",\n    district_en == \"Asikuma Odoben Brakwa\" ~ \"Asikuma-Odoben-Brakwa\",\n    district_en == \"Bawku\" ~ \"Bawku Municipal\",\n    district_en == \"Bunkpurugu\" ~ \"Bunkpurugu Nakpanduri\",\n    district_en == \"Daffiama Bussie Iss\" ~ \"Daffiama Bussie Issa\",\n    district_en == \"East Gonja\" ~ \"East Gonja Municipal\",\n    district_en == \"Garu Tempane\" ~ \"Garu\",\n    district_en == \"Ho\" ~ \"Ho Municipal\",\n    district_en == \"Hohoe\" ~ \"Hohoe Municipal\",\n    district_en == \"Keta\" ~ \"Keta Municipal\",\n    district_en == \"Kpando Municipa\" ~ \"Kpando Municipal\",\n    district_en == \"Lambussie Karni\" ~ \"Lambussie-Karni\",\n    district_en == \"Nadowli Kaleo\" ~ \"Nadowli-Kaleo\",\n    district_en == \"Sagnarigu\" ~ \"Sagnerigu\",\n    district_en == \"Tatale\" ~ \"Tatale Sanguli\",\n    district_en == \"West Mamprusi\" ~ \"West Mamprusi Municipal\",\n    district_en == \"Yendi\" ~ \"Yendi Municipal\",\n    district_en == \"Damongo\" ~ \"West Gonja\",\n    TRUE ~ district_en\n  ))\n\nodf_by_district \u003c- basisghananew |\u003e \n  group_by(district_en) |\u003e \n  summarize(odf_population = sum(population, na.rm = TRUE)) \n\nodf_by_district \u003c- merge(odf_by_district, ghanapop, by = 'district_en', all = TRUE) |\u003e \n  mutate(percentage = round(odf_population / total_pop * 100, 2)) |\u003e \n  arrange(desc(percentage)) \n  \ntop_10_odf \u003c- odf_by_district |\u003e \n  top_n(10, percentage) |\u003e \n  select(district_en, region_en, percentage) |\u003e\n  mutate(percentage = paste0(percentage, \"%\")) |\u003e \n  rename(\n    district = \"district_en\",\n    region = \"region_en\",\n    `proportion ODF population in district` = \"percentage\"\n  )\n\n#group the regions according to how they were back in 2017 (10 regions instead of 16)\nodf_by_region \u003c- odf_by_district |\u003e \n  mutate(region_en = case_when(\n    region_en %in% c(\"Bono\", \"Bono East\", \"Ahafo\") ~ \"Brong Ahafo\",\n    region_en %in% c(\"Northern\", \"Savannah\", \"Northern East\") ~ \"Northern\",\n    region_en %in% c(\"Volta\", \"Oti\") ~ \"Volta\",\n    region_en %in% c(\"Western\", \"Western North\") ~ \"Western\",\n    TRUE ~ as.character(region_en)\n  )) |\u003e \n  group_by(region_en) |\u003e \n     summarize(\n    odf_population = sum(odf_population, na.rm = TRUE),\n    female = sum(female_pop, na.rm = TRUE),  \n    male = sum(male_pop, na.rm = TRUE), \n    total_pop = sum(total_pop, na.rm = TRUE)\n  ) |\u003e \n  mutate(percentage = round(odf_population / total_pop * 100, 2)) |\u003e \n  arrange(desc(percentage)) |\u003e \n  filter(!is.na(region_en)) |\u003e \n  select(region_en, percentage)\n\nghana \u003c- ne_states(country = \"Ghana\", returnclass = \"sf\") |\u003e \n  rename(\n    region_en = \"name\"\n  )\n\nggplot() +\n  theme_void() +\n  geom_sf(data = full_join(ghana, odf_by_region, by = \"region_en\"), aes(fill = percentage), color = \"white\", lwd = 0) +\n  scale_fill_gradientn(name = paste(\"Percentage of ODF population\", \"\\n by region (logarithmic scale)\"),\n                       trans = \"log\",\n                       labels = scales::label_number(accuracy = 1),\n                       colors = c(\"#2E8B57\",\"#9DBF9E\", \"#FCB97D\", \"#A84268\"),\n                       na.value = \"grey80\") +\n  labs(title = paste(\"Regions with highest percentage of ODF communities\", \"\\n                              in Ghana (2017)\")) +\n  theme_minimal() +\n   theme(\n    plot.title = element_text(size = 14),  \n    plot.margin = margin(1, 1, 1, 1, \"cm\")  \n  ) \n```\n\n## Installation\n\nYou can install the development version of basisghana from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"openwashdata/basisghana\")\n```\nAlternatively, you can download the individual dataset as a CSV or XLSX\nfile from the table below.\n\n```{r, echo=FALSE}\n\nextdata_path \u003c- \"https://github.com/openwashdata/basisghana/raw/main/inst/extdata/\"\n\nread_csv(\"data-raw/dictionary.csv\") |\u003e \n  distinct(file_name) |\u003e \n  mutate(file_name = str_remove(file_name, \".rda\")) |\u003e \n  rename(dataset = file_name) |\u003e \n  mutate(\n    CSV = paste0(\"[Download CSV](\", extdata_path, dataset, \".csv)\"),\n    XLSX = paste0(\"[Download XLSX](\", extdata_path, dataset, \".xlsx)\")\n  ) |\u003e \n  knitr::kable()\n\n```\n## Project goal\nThe primary goal of BaSIS (Basic Sanitation Information System) within the context of implementing Community-Led Total Sanitation (CLTS) in Ghana is to combat open defecation. By collecting data on communities practicing open defecation, the project aims to shift away from previous subsidy-based approaches and focus on community engagement. BaSIS seeks to empower communities, particularly in regions like Upper West, Eastern, Northern, Volta, and Central, to abandon open defecation practices through CLTS. The objective is to break the cycle of fecal-oral contamination, reduce the spread of diseases linked to poor sanitation, and promote sustainable, community-driven solutions to improve overall hygiene and sanitation practices.\n\n\n## Data\n\nThe data set includes the locations of the existing open defecation free (ODF) communities in \nvarious districts of Ghana. It was last updated in September 2017. \n\nThe package provides access to two data sets.\n\n```{r, echo = TRUE}\nlibrary(basisghana)\n```\n\nThe `basisghana` data set has `r ncol(basisghana)`\nvariables and `r nrow(basisghana)` observations. For an overview\nof the variable names, see the following table.\n\n```{r, eval=FALSE}\nbasisghana\n```\n\n```{r, echo=FALSE}\nreadr::read_csv(\"data-raw/dictionary.csv\") |\u003e \n  dplyr::filter(file_name == \"basisghana.rda\") |\u003e \n  dplyr::select(variable_name:description) |\u003e \n  knitr::kable()\n```\n\nThe `ghanapop` data set has `r ncol(ghanapop)`\nvariables and `r nrow(ghanapop)` observations. For an overview\nof the variable names, see the following table.\n\n```{r, eval=FALSE}\nghanapop\n```\n\n```{r, echo=FALSE}\nreadr::read_csv(\"data-raw/dictionary.csv\") |\u003e \n  dplyr::filter(file_name == \"ghanapop.rda\") |\u003e \n  dplyr::select(variable_name:description) |\u003e \n  knitr::kable()\n```\n\n## Example\n\n```{r, echo=FALSE}\nlibrary(basisghana)\nlibrary(dplyr)\nlibrary(tidyverse)\n\nbasisghana \u003c- basisghana |\u003e \n  rename(district_en = \"district\") |\u003e\n  mutate(district_en = case_when(\n    district_en == \"Abura Asebu Kwamankes\" ~ \"Abura-Asebu-Kwamankese\",\n    district_en == \"Ajumako Enyan Essiam\" ~ \"Ajumako-Enyan-Essiam\",\n    district_en == \"Asikuma Odoben Brakwa\" ~ \"Asikuma-Odoben-Brakwa\",\n    district_en == \"Bawku\" ~ \"Bawku Municipal\",\n    district_en == \"Bunkpurugu\" ~ \"Bunkpurugu Nakpanduri\",\n    district_en == \"Daffiama Bussie Iss\" ~ \"Daffiama Bussie Issa\",\n    district_en == \"East Gonja\" ~ \"East Gonja Municipal\",\n    district_en == \"Garu Tempane\" ~ \"Garu\",\n    district_en == \"Ho\" ~ \"Ho Municipal\",\n    district_en == \"Hohoe\" ~ \"Hohoe Municipal\",\n    district_en == \"Keta\" ~ \"Keta Municipal\",\n    district_en == \"Kpando Municipa\" ~ \"Kpando Municipal\",\n    district_en == \"Lambussie Karni\" ~ \"Lambussie-Karni\",\n    district_en == \"Nadowli Kaleo\" ~ \"Nadowli-Kaleo\",\n    district_en == \"Sagnarigu\" ~ \"Sagnerigu\",\n    district_en == \"Tatale\" ~ \"Tatale Sanguli\",\n    district_en == \"West Mamprusi\" ~ \"West Mamprusi Municipal\",\n    district_en == \"Yendi\" ~ \"Yendi Municipal\",\n    district_en == \"Damongo\" ~ \"West Gonja\",\n    TRUE ~ district_en\n  ))\n```\n\n### 1) Extracting the Top 10 Districts with the Highest Percentage of ODF Communities in Ghana\n\nThe following code demonstrates how to calculate the percentage of ODF communities per region in Ghana. This computation involves using ODF population data sourced from the basisghana dataset, in conjunction with total population statistics categorized by region, sourced from the ghanapop dataset.\n\n```{r example}\nlibrary(tidyverse)\nlibrary(basisghana)\nlibrary(dplyr)\n\n\nodf_by_district \u003c- basisghana |\u003e \n  group_by(district_en) |\u003e \n  summarize(odf_population = sum(population, na.rm = TRUE)) \n\nodf_by_district \u003c- merge(odf_by_district, ghanapop, by = 'district_en', all = TRUE) |\u003e \n  mutate(percentage = round(odf_population / total_pop * 100, 2)) |\u003e \n  arrange(desc(percentage)) \n  \ntop_10_odf \u003c- odf_by_district |\u003e \n  top_n(10, percentage) |\u003e \n  select(district_en, region_en, percentage) |\u003e\n  mutate(percentage = paste0(percentage, \"%\")) |\u003e \n  rename(\n    district = \"district_en\",\n    region = \"region_en\",\n    `proportion ODF population in district` = \"percentage\"\n  )\n\ntop_10_odf\n```\n\n### 2) Mapping the Regions with highest percentage of ODF communities in Ghana\n\nThe code uses the dataset of ODF communities categorized by districts (see above), which are then aggregated based on regions in Ghana. It's important to note that the reference to Ghana's regions pertains to the former 10 regions preceding the 2018 referendum, which subsequently led to the establishment of new regions, resulting in a total of 16 regions from 2020 (Refer to [Regions of Ghana](https://en.wikipedia.org/wiki/Regions_of_Ghana)). From the collected data across 5 of these former regions, a color-coded map of Ghana depicts the varying proportions of Open Defecation Free (ODF) communities in each region. \n\n\n```{r}\nlibrary(sf)\nlibrary(rnaturalearth)\nlibrary(ggplot2)\n\n#group the regions according to how they were back in 2017 (10 regions instead of 16)\nodf_by_region \u003c- odf_by_district |\u003e \n  mutate(region_en = case_when(\n    region_en %in% c(\"Bono\", \"Bono East\", \"Ahafo\") ~ \"Brong Ahafo\",\n    region_en %in% c(\"Northern\", \"Savannah\", \"Northern East\") ~ \"Northern\",\n    region_en %in% c(\"Volta\", \"Oti\") ~ \"Volta\",\n    region_en %in% c(\"Western\", \"Western North\") ~ \"Western\",\n    TRUE ~ as.character(region_en)\n  )) |\u003e \n  group_by(region_en) |\u003e \n     summarize(\n    odf_population = sum(odf_population, na.rm = TRUE),\n    female = sum(female_pop, na.rm = TRUE),  \n    male = sum(male_pop, na.rm = TRUE), \n    total_pop = sum(total_pop, na.rm = TRUE)\n  ) |\u003e \n  mutate(percentage = round(odf_population / total_pop * 100, 2)) |\u003e \n  arrange(desc(percentage)) |\u003e \n  filter(!is.na(region_en)) |\u003e \n  select(region_en, percentage)\n\nghana \u003c- ne_states(country = \"Ghana\", returnclass = \"sf\") |\u003e \n  rename(\n    region_en = \"name\"\n  )\n\nggplot() +\n  theme_void() +\n  geom_sf(data = full_join(ghana, odf_by_region, by = \"region_en\"), aes(fill = percentage), color = \"white\", lwd = 0) +\n  scale_fill_gradientn(name = paste(\"Percentage of ODF population\", \"\\n by region (logarithmic scale)\"),\n                       trans = \"log\",\n                       labels = scales::label_number(accuracy = 1),\n                       colors = c(\"#2E8B57\",\"#9DBF9E\", \"#FCB97D\", \"#A84268\"),\n                       na.value = \"grey80\") +\n  labs(title = paste(\"Regions with highest percentage of ODF communities\", \"\\n                              in Ghana (2017)\")) +\n  theme_minimal() +\n   theme(\n    plot.title = element_text(size = 14),  \n    plot.margin = margin(1, 1, 1, 1, \"cm\")  \n  ) \n```\n\n*Note: A logarithmic scale has been employed to accentuate distinctions among lower percentage values.*\n\n## License\n\nData are available as \n[CC-BY](https://github.com/openwashdata/basisghana/LICENSE.md).\n\n## Citation\n\nTo cite this package, please use:\n\n```{r}\ncitation(\"basisghana\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenwashdata%2Fbasisghana","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenwashdata%2Fbasisghana","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenwashdata%2Fbasisghana/lists"}