# Downloading data

How to start a download in the Data Extractor (mapping, time range, organisation unit level), follow it in Downloads, and open the result in the RMNCAH or Vaccination app, in Excel or as JSON.

A download fetches the values of a mapping's indicators from DHIS2 for the periods and the organisation unit level you
choose. It is the last step in the extractor, after [mapping the indicators](https://datasuite.damurka.com/en/apps/data-extractor/mapping.md); the
result is the workbook you open in the [RMNCAH or Vaxx app](https://datasuite.damurka.com/en/apps/countdown/getting-started.md), or in Excel. Large
downloads are split into many small requests, so they can run for a while, be paused and be picked up later.

**Before you start:** have a saved mapping with at least one indicator mapped ([Mapping indicators](https://datasuite.damurka.com/en/apps/data-extractor/mapping.md)).

![New download: the mapping, the time range, the organisation unit level, and what the download will take](https://datasuite.damurka.com/images/extractor-new-download.png)

## Starting a download

### 1. Click **New download**

On **Downloads** or **Overview**, or **Download** next to a mapping on **Mappings**.

### 2. Choose the mapping

Choose it under **Mapping**. A Countdown download is always monthly: reporting completeness and services by month,
population by year, and the health system figures once for each unit.

### 3. Choose the time range

Click **Last 12 months**, **This year**, **Last year** or **Custom range**. With **Custom range**, pick the first and
the last month under **From month** and **To month**; with a Custom mapping you can **Pick by** **Monthly** or
**Yearly**. On a server that uses the Ethiopian calendar, **Calendar** switches between **Gregorian** and **Ethiopian**
months. The line under the buttons shows how many months the range holds.

### 4. Choose the organisation unit level

Under **Organisation unit level**, choose the level the values are fetched for, for example the district level: every
unit at that level is downloaded. **Within** (optional) limits the download to the units inside one area: search for
the area and select it.

### 5. Check the estimate, then start

The box at the bottom counts the **Data items**, **Periods**, **Org units** and **Requests**, and lists any indicators
left out because they are not mapped yet. A very large number of requests means a long download. Click **Start
download**: the extractor opens **Downloads**.

> **Countdown download**
>
> For the Countdown analysis, download the last five complete years (**Custom range**, from January of the first year to
> December of the last) at the district level (often Level 3).

## Following a download

![Downloads: the downloads in progress, running, paused and waiting, and the history](https://datasuite.damurka.com/images/extractor-downloads.png)

**In progress** lists the downloads that are running, paused or waiting their turn, each with its progress, the
requests done and the time left. A few run at the same time (2 by default; **Change** opens Settings), the others wait
in line.

| Button | What it does |
| --- | --- |
| Pause / Resume | Pauses a running download, or resumes a paused one where it stopped |
| Move up | Moves a waiting download up the line |
| Cancel | Stops the download and moves it to the history as failed; what it fetched so far is kept for a retry |
| **Pause all** / **Resume all** | Pauses or resumes every download |

Downloads keep running while you work on other pages or in other tabs.

## Opening the result

When a download finishes it moves to the history, under **In progress**: **All**, **Finished** or **Failed**, with a
search by mapping or period. Each finished download shows its periods, level, number of values and size.

![The ways to open a finished download: in an app, as a file, or in its folder](https://datasuite.damurka.com/images/extractor-download-open.png)

- **Open in RMNCAH**: a download made with a Countdown mapping opens straight in the RMNCAH app (the arrow beside it
  offers the **Vaccination app**, the Vaxx app). The workbook is written to `Documents\Countdown data\<server>`, and the
  app saves its dataset next to it. This needs the Countdown Analytics extension; **Get the analysis apps** shows it if
  it is missing.
- **Open in Excel** or **JSON (.json)**: writes the file to the folder of the settings and opens it.
- **Show in folder** opens that folder; **Delete…** deletes the downloaded data from this computer.

A failed download shows why under its name; click **Retry** to run it again.

The Countdown workbook has the sheets `Service_data`, `Population_data`, `Reporting_completeness` and `Admin_data`, with
every column the apps expect, in the template's order, empty where the mapping has no indicator for it. A Custom
mapping's workbook has one sheet per sheet of the mapping. What the apps need in it:
[Analysis setup](https://datasuite.damurka.com/en/methodology/analysis-setup/facility-data.md#what).

## Where files are saved

A finished download is written as a file only when you open it, into the folder of **Settings** > **Files** > **Save
to** (by default `Documents\DataSuite\Downloads`).

![Settings > Files: the folder, the default format, the analysis apps and the file name](https://datasuite.damurka.com/images/extractor-settings-files.png)

- **Open by default as**: **Excel** or **JSON**, the format the Open button uses.
- **File name**: a pattern built from `{mapping}`, `{periods}`, `{level}` and `{date}`; the example under it shows the
  result.
- **Add parent organisation units** and **Add organisation unit IDs**: extra columns in a Custom mapping's workbook (the
  Countdown workbook keeps the columns the apps read).
- On a server that uses the Ethiopian calendar, **Settings** > **Calendar & periods** chooses whether periods are
  picked and written in the Ethiopian or the Gregorian calendar.

## If the server is slow

**Settings** > **Downloads** sets how hard the extractor works the server. Lower these if the server is shared or slow.

![Settings > Downloads: downloads at the same time, requests at once, values per request, wait and retries](https://datasuite.damurka.com/images/extractor-settings-downloads.png)

| Setting | Default | What it means |
| --- | --- | --- |
| **Downloads at the same time** | 2 | The others wait their turn in **In progress** |
| **Most requests at once** | 4 | The extractor starts at 2, sends more while the server answers quickly, and never goes above this |
| **Values per request** | 50,000 | Bigger requests mean fewer of them, but each takes longer; one the server finds too big is split |
| **Wait for an answer** | 2 minutes | After this, the request is split in two and tried again |
| **Retries before giving up** | 3 | Per request; a paused download never counts against this |

Click **Save changes** at the top of Settings.

## Common pitfalls

- **A download that fails with "Not authorised".** Your account cannot read one of the mapping's data sets or data
  elements. Ask your DHIS2 administrator, or remove that source from the mapping, then **Retry**.
- **Indicators left out.** The estimate lists indicators that are not mapped yet: they are not in the download. Map
  them, or mark them as not available, first.
- **A very low level over many years.** Facility level over five years can mean thousands of requests. Download the
  district level, or fewer years at a time.
- **Opening a Custom download in the apps.** Only a Countdown mapping's download opens in the RMNCAH and Vaccination
  apps. More in the [FAQs](https://datasuite.damurka.com/en/troubleshooting.md#data-extractor).

Next: load the workbook in the app: [Load Data](https://datasuite.damurka.com/en/apps/countdown/getting-started.md).
