# Using the app

Step-by-step guide to building a pooled file in the Pooled App from saved country datasets, exploring the pooled tables and reading the output.

You use the Pooled app in two parts: **Build pooled file** reads the countries' saved datasets and combines them into
one file, and **Explore pooled data** shows that file's tables and charts, country by country or side by side. You
build once, after [preparing the caches](https://datasuite.damurka.com/en/apps/pooled/preparing-caches.md); you explore and
[export](https://datasuite.damurka.com/en/apps/pooled/exporting-results.md) as often as you need.

**Before you start:** have one `.rds` file per country, saved by the RMNCAH or Vaxx app, in one folder
([Preparing caches](https://datasuite.damurka.com/en/apps/pooled/preparing-caches.md)).

```mermaid
flowchart TD
  A["1. Choose datasets: domain, what to include, files"] --> B["2. Loading files"]
  B --> C["3. Review results: Needs your attention"]
  C -- "Failed" --> X["Leave it out, or fix it in the country app"]:::stop
  C --> D["Combine N files"]
  D --> E["4. File created"]
  E --> F["Download .rds"]:::done
  E --> G["Explore this file"]:::done
```

## Build a pooled file

### 1. Launch Pooled

Start **Pooled** from the DataSuite apps. When DataSuite starts it with a folder selected, every `.rds` file in that folder is already added to the file list and a banner shows how many files were pre-loaded. The app opens on **Build pooled file**. Most Pooled pages and buttons are currently shown in English whatever the language selected.

### 2. Choose the datasets (step 1 of 4)

![Choose the countries' saved datasets](https://datasuite.damurka.com/images/pooled-build-select.png)

- **Data domain**: RMNCAH or Immunization (VAXX). This decides which tables the pooled file contains. With Immunization, the tables that only exist for RMNCAH (mortality and service utilization) are not built.
- **What to include**: **Everything in each dataset** adds WUENIC, surveys, denominators, data quality and more. **Standard tables only** keeps just the tables that Explore has pages for.
- **Select files** to pick several `.rds` files at once, or **Select a folder** to add every `.rds` file in it. A file with the same name replaces the earlier one in the list.

Each listed file has a tick to include it and a button to remove it. The counter shows the total size against the 2 GB limit. **Clear all** empties the list. Click **Load N files**.

### 3. Load the files (step 2 of 4)

![Loading the selected files](https://datasuite.damurka.com/images/pooled-load-progress.png)

Files are read one at a time and each shows its result as it finishes, with an overall progress bar and four counters: Loaded, Loaded with a warning, Failed, Still to load. You can leave the page open while it runs. **Cancel loading** returns to step 1; a failed file has a retry option. Then click **Review results**.

### 4. Review and confirm (step 3 of 4)

![Review results before combining](https://datasuite.damurka.com/images/pooled-review-results.png)

The **Needs your attention** list explains every warning and failure. Typical messages:

| Message | Meaning and fix |
| --- | --- |
| Not adjusted yet, so its tables use unadjusted data | Finish the adjustment in the country app, save, and reload |
| N of M standard tables could not be built | The cache lacks some analysis; open it in the country app |
| Has N of the M tables the loaded files have | Other countries have extra tables this one lacks; usually fine |
| Another file for the country is newer | Duplicate country; the newer file is used |
| Not a Countdown dataset | The file has no country or adjusted data; it is not a country cache |
| Could not read the file | Damaged, or saved by a newer R; re-save it |

You can leave a file out. Click **Combine N files**. If some files are left out, a dialog confirms and notes that they are recorded in the file's log with the reason.

### 5. File created (step 4 of 4)

![File created, ready to explore or download](https://datasuite.damurka.com/images/pooled-file-created.png)

The app reports the number of countries and datasets and lists each table with its row count. The file is named `pooled_rmncah_` (or `pooled_vaccine_`) followed by the date, ending in `.rds`. Use **Download .rds** to keep it, or **Explore this file**. **Build another file** starts again.

> **Warning**
>
> The pooled file is built in temporary storage for the session. Download the `.rds` if you want to open it again later.

## Explore pooled data

Open a file on **Open a file**: use the one just built, or upload a pooled `.rds` made earlier. Only files made by **Build pooled file** are accepted; any other `.rds` is rejected with "This is not a pooled file". After opening, the app jumps to the first page that has data.

Every dataset page has the same layout: a file bar (name, countries, datasets, **Change file**, **Download**), Countries and Years filters, tabs for National, Admin 1 and District where the table has them, a summary strip (Rows, Countries, Years, Columns), graphs, and a searchable **Data** table. The Countries and Years filters are shared by all pages, and choosing none means all.

Pages with numbers also have a **Measure** filter. Graphs use one line or bar per country, with a fixed colour per country. For Admin 1 and District tables the graphs show the median across areas.

- **Parameters**: settings and survey values per country, with survey coverage dots, neonatal mortality and survey year.

![Parameters page](https://datasuite.damurka.com/images/pooled-parameters.png)
- **Overall score**: ranking, and a heatmap of the parts of the score.

![Overall score page](https://datasuite.damurka.com/images/pooled-overall-score.png)
- **Indicator coverage** and **Coverage**: trend over time, ranking of the latest year, and either spread across districts or a change-since-first-year table.

![Coverage page](https://datasuite.damurka.com/images/pooled-coverage.png)
- **Mortality** and **Service utilization**: trend, ranking and change.
- **Compare countries**: four tabs. *Continuum of care* is a heatmap of the latest facility coverage from the first antenatal visit to the vaccines. *Source triangulation* shows facility, survey and WUENIC values for DTP3 and MCV1 with the 90% target line. *Level and change* plots coverage now against change over the period. *Trends over time* shows the median and the middle half of countries. It needs the `Coverage - National` table.

![Compare countries page](https://datasuite.damurka.com/images/pooled-compare-countries.png)
- **All datasets**: pick any table from the grouped list and see its data.

## Reading the output

Key columns you will see:

| Column | Meaning |
| --- | --- |
| `country`, `iso3` | Country name and ISO3 code, always first |
| `adminlevel_1`, `district` | Area, when the table is subnational |
| `year` | Reporting year |
| `cov_penta3`, `cov_measles1`, ... | Facility coverage; the same name in every country, whichever denominator the country chose |

Coverage indicators are ANC 1st trimester, ANC4+, institutional delivery, C-section, HIV test, institutional live births, PNC within 48h, Penta1, Penta3, Measles 1 and 2, BCG, OPV1-3, syphilis test and IPT2-3 (Admin 1 excludes OPV). The `Parameters` table holds each country's performance threshold, k-factors, national estimates such as `nmr` and `sbr`, survey estimates, `survey_year` and the chosen denominators. For the meaning of scores, adjustments and denominators, see the **[framework](https://datasuite.damurka.com/en/methodology.md)**.

## Common pitfalls

- **Choosing the wrong domain.** With **Immunization (VAXX)**, RMNCAH datasets lose their mortality and service
  utilization tables; choose the domain of the files before loading.
- **Closing the app before downloading.** The pooled file lives in temporary storage: use **Download .rds** first.
- **Opening a country's `.rds` in Explore.** **Open a file** accepts only files made by **Build pooled file**.
- **Reading a median as a country value.** For Admin 1 and District tables, the graphs show the median across areas.

Continue with **[Exporting results](https://datasuite.damurka.com/en/apps/pooled/exporting-results.md)**.
