Add an analysis
An analysis answers one question a charity asks of its own data. It joins the charity's table to UK open data and returns figures with their sources, a map, the working and the checks a person must make. It suits analysts with a real charity question. It is a bigger piece of work than a data source, so agree the question with us before you start.
What an analysis is
One question, the columns a charity brings, the open data it joins, the method, a map, and the checks a person must make before using the figures. These six are in the package today. Start from the one closest to yours.
| Analysis | The question | What a charity can bring |
|---|---|---|
reach-deprivation |
Are we reaching people in the most deprived neighbourhoods? | Postcodes, or counts by neighbourhood |
reach-connectivity |
Are we reaching people in the least-connected neighbourhoods? | Postcodes, or counts by neighbourhood |
need-reach |
Where is need high and our presence low? | Postcodes, or counts by local authority |
who-we-miss |
Who do we reach less than their share of the people who live here? | A group for each person, or counts by group |
provision-gap |
Where is provision thin against need across a region? | Sites, or amounts by local authority |
access-distance |
How far are people from our nearest site, and where would a new site help most? | Site postcodes, or site positions |
Analyses shows how each one is run and what it returns.
The rules every analysis keeps
The full list is in Writing an analysis. The ones that matter most:
- Totals, never rows. A result never describes one person, and never repeats a value from the charity's table, not even in an error message.
- Small counts are hidden, and so is anything that would give them away. A person can raise the smallest count shown, but never set it below 3.
- Every figure has a source: publisher, edition, licence and link.
- Every choice is stated, with the option that changes it.
- A person is left the checks to make before the figures are used.
- A map shades areas. It never draws a dot for each person.
Before you start: the template
Open an issue and paste this in, filled in. We will agree the question and the method with you there.
**The question:** in the words a charity would use
**Who asks it:** the kind of charity, and what they would do with the answer
**What the charity brings:** the columns, such as a home postcode for each
person, or a total for each area. No column that names a person.
**The open data it joins:** the dataset, its publisher and its licence
**The method:** the steps, in plain words
**The answer:** the sentence it gives, and the figures to show first
**The map:** which areas, and what colours them
**Checks:** what a person must confirm before using the figures
**What the figures cannot say:**
**Where the idea comes from:** for example, a DataKind UK case study, or a
funder's question
If the open data is not in the package yet, add it as a data source first.
Steps
- Agree the question and the method in the issue.
- Set up the project with the steps in DEVELOPERS.md.
- Copy the closest analysis in
src/uk_open_data/analyses/into a new file. An analysis is anAnalysisInfoand a function that takes anAnalysisInputand returns anAnalysisResult. Add yours to the list insrc/uk_open_data/analyses/__init__.py. - Write tests with small invented tables, as the tests of the other analyses
do. Stand in for every web request. Call
check_workingfromtests/working_checks.pyon a result. - Add a section for it to
docs/api/analyses.md, in the same shape as the six there. - Add its id to
used_byof each dataset it cites, inDATASETSinsrc/uk_open_data/analyses/datasets.py, and update the table on the Datasets page. A test fails until each is done, and prints what to change. - Run the checks, then open a pull request.
Checklist
Copy this into your pull request and tick each line.
- [ ] The question and method were agreed in an issue
- [ ] The result holds totals only, and a test shows no value from the
input table comes back in it
- [ ] Small counts are hidden, and the smallest count shown cannot go below 3
- [ ] Every figure has a source with its publisher, edition, licence and link
- [ ] Every choice is stated, with the option that changes it
- [ ] Checks and caveats are written for the person using the figures
- [ ] Anything sent off the person's machine is listed in the privacy summary
- [ ] The map shades areas, never people
- [ ] Tests use invented data and no network, and `check_working` passes
- [ ] `docs/api/analyses.md` has a section for it
- [ ] Each dataset it cites names it in `used_by`, and the Datasets page matches
- [ ] Lint, format, types, tests and the docs build all pass
- [ ] Commits are signed off (`git commit -s`)
- [ ] The pull request says which tools helped, or "None"
Ideas to start from
These are analyses charities have asked for.
- Demand over time, from attendance records.
- Change before and after, on outcome measures.
- A benchmark against national averages.
- Test data for Wales, Scotland and Northern Ireland for
reach-deprivation, which covers England today.
Issues for this way in carry the
lane: lens
label. A lens is what we called an analysis at first.