> For the complete documentation index, see [llms.txt](https://spice.docs.medtroniclabs.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spice.docs.medtroniclabs.org/reporting-and-data/exports-and-national-reporting.md).

# Exports & National Reporting

This page describes how data leaves SPICE: Excel downloads from the reporting web application, scheduled report files prepared per site, standard-format summaries submitted to an aggregate reporting system, and data dumps for analysts.

## Report downloads (Excel)

The reporting web application downloads reports as Excel (`.xlsx`) files.

| Kind of download                                    | How it is produced                                                               | Contents                                                         |
| --------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| Patient-list exports (screened, enrolled, assessed) | Generated on demand for the site, using the filters currently applied on screen. | All rows matching the filters, not only the visible page.        |
| User performance export                             | Generated on demand.                                                             | Activity counts per staff member for the chosen dates and roles. |
| Community programme reports                         | Generated on demand for the chosen date range and area.                          | Service counts per supervisor or community health worker.        |
| Monthly and daily reports                           | Prepared in advance by scheduled jobs and fetched when you select **Download**.  | One file per site and period.                                    |

See [Reporting Web Application](https://spice.docs.medtroniclabs.org/reporting-and-data/reporting-web-application.md#viewing-and-downloading-reports) for the steps.

## Scheduled report jobs

Standard registers and summaries are produced by scheduled batch jobs rather than on demand. Each job:

1. reads from the reporting database;
2. builds an Excel file for every site for the period;
3. uploads the files to object storage, in one folder per report type and site;
4. sends a success or failure notification email to a configured list.

The reporting web application then lists the available periods and retrieves the file from object storage when a user views or downloads it.

Report categories prepared this way:

| Category                  | Period  | Purpose                                                                 |
| ------------------------- | ------- | ----------------------------------------------------------------------- |
| Daily activity register   | Daily   | Everyone seen at a site on a given day.                                 |
| Permanent register        | Monthly | Cumulative register of people under care at a site.                     |
| Monthly aggregate summary | Monthly | Counts per site in a standard format, suitable for aggregate reporting. |
| Patient status report     | Monthly | Status of patients in care at a site.                                   |
| Prescription report       | Monthly | Medication prescribed at a site.                                        |

A programme chooses which of these are switched on. Jobs run on a schedule set by the deployment team (for example nightly or monthly) and can be re-run for a past period.

## Standard-format and aggregate reporting

Many health ministries collect monthly aggregate figures from each facility in a fixed format. SPICE supports this in two steps:

1. **Generate.** A scheduled job produces the standard monthly summary per site as an Excel file, as described above. Facility staff can view and download it from the reporting web application.
2. **Submit.** Where the programme has configured a connection to an aggregate reporting system (a DHIS2-style platform), a facility report administrator can submit the last completed month's summary from the reporting web application.

To submit a monthly summary:

1. Open the site and select the monthly summary card.
2. Find the row for the previous month. Only the previous month can be sent, and only before the submission deadline set for the programme.
3. Select the send icon (**Send**) on the row.
4. Sign in to the aggregate reporting system with your own credentials when prompted, and confirm.
5. A message confirms whether the submission succeeded. If the previous month is still unsent, a reminder appears when a facility report administrator opens the site.

Only facility report administrators see the send option. The connection details and the mapping from SPICE counts to the aggregate system's data elements are set up by the deployment team during programme configuration.

## Data dumps for analysts

For analysis outside SPICE, the platform offers:

* **Patient data dump jobs.** Scheduled jobs that export patient-level records per site (for example demographics, screening details, diagnosis, treatment and number of visits) to Excel files in object storage. Files can be password-protected and the success or failure of each run is emailed to a configured list.
* **Reporting database access.** The report-ready tables prepared by the data pipeline can be queried directly by authorised analysts. See [Data Pipeline & Analytics](https://spice.docs.medtroniclabs.org/reporting-and-data/data-pipeline-and-analytics.md).
* **Data warehouse and BI.** In deployments with the optional analytics stack, analysts can query the warehouse and build their own dashboards.

Patient-level exports contain personal health information. Restrict access to the destination storage and follow your programme's data-protection policy.

## Duplicate patient jobs

Separate batch jobs exist to find and merge duplicate patient profiles: one produces a list of suspected duplicates, another merges profiles. They are run by the deployment team; there is no screen for this in the reporting web application.

## Related pages

* [Reporting Overview](https://spice.docs.medtroniclabs.org/reporting-and-data/reporting-and-data.md)
* [Reporting Web Application](https://spice.docs.medtroniclabs.org/reporting-and-data/reporting-web-application.md)
* [Data Pipeline & Analytics](https://spice.docs.medtroniclabs.org/reporting-and-data/data-pipeline-and-analytics.md)
* [Standard Indicators](https://spice.docs.medtroniclabs.org/reporting-and-data/standard-indicators.md)
