Dataset discovery and analysis
Use When
- Use when a research project needs public datasets, official statistics, replication
data, ML datasets, or dataset profiling.
Do Not Use When
- Do not use when the task only needs literature or narrative sources.
Dataset Intake Guidance
- Research question, geography, period, discipline, preferred source types, and required
output.
Dataset Method Detail
- Discover, retrieve, profile, cite, and hand off datasets using the three-step process
below.
Quality Standards
- Prefer official or primary datasets, record version/licence/SHA-256, and profile before
analysis.
Dataset Failure Notes
- Do not cite a chart without tracing the underlying dataset.
Dataset Deliverable Detail
- Dataset shortlist, retrieved dataset, profile, quality notes, or citation-ready source
record.
References
- Use the tools and companion skills listed below for retrieval, profiling, and evidence
discipline.
The engine should treat public datasets as a first-class source type alongside academic papers and journalism. Most research projects can be sharpened with a directly-cited dataset.
Three steps
1. Discovery — tools/datasets/search.py
Federated search across the registered hosts:
from tools.datasets import search_datasets, DATASET_REGISTRY
for r in search_datasets("rental housing Kenya", per_host=10, coverage_filter="kenya"):
print(r.host, r.title, r.url, r.formats)
Decision rules:
- Always search both government open-data portals (data.gov, KNBS, UBOS, NBS, NISR, Eurostat) and IGO bodies (World Bank, IMF, OECD, WHO, UNICEF, FAOSTAT) for any cross-border quantitative question.
- Use Zenodo / Dataverse / Figshare for academic / replication datasets.
- Use HuggingFace Datasets / Kaggle for ML / pre-cleaned datasets.
- Combine with
discipline-router — different research disciplines have different canonical hosts.
2. Retrieval — tools/datasets/retrieve.py
from tools.datasets import retrieve_dataset
result = retrieve_dataset(
"https://data.knbs.or.ke/dataset/.../household-survey.csv",
dest_dir="projects/<project-id>/data",
sha256_expected="abc123...", # optional integrity check
)
- Goes through the engine's
tools/scraping/http_client for retries + ethics.
- Computes SHA-256 for integrity / re-use detection.
- Detects format from extension + content-type (CSV / Parquet / Excel / NetCDF / etc.).
- Caches on disk; re-runs are free.
3. Analysis — tools/datasets/analyse.py
from tools.datasets import profile_dataset
prof = profile_dataset("projects/<project-id>/data/household-survey.csv")
print(prof.n_rows, prof.n_columns, prof.duplicate_rows)
for col in prof.columns:
print(col.name, col.null_rate, col.dtype)
print(prof.quality_flags) # warnings per Segnini's checklist
The profile applies Segnini's five-step verification (Verification Handbook):
- Completeness — null-rate per column with warning threshold
- Duplicates — duplicate-row count
- Accuracy — min/max/mean/std for numeric columns; extreme-value spot-check
- Integrity — sample values surfaced for human review
- Codes / acronyms — build a glossary if columns use codes
Legacy Dataset Decision Notes
- Always profile before analysing. Treat the profile as the dataset's
five-term-source-doubt equivalent.
- Document SHA-256 in the source citation. Datasets change; lock the exact version you used.
- Prefer official portals over secondary aggregators. KNBS direct beats data.gov mirror of KNBS.
- License is part of the source citation. Note CC-BY-4.0 / OGL / etc. in
<cohort>/research/sources.md.
- When the dataset is large and you only need a slice, pull the slice via API rather than downloading the full dataset.
- Cite the dataset, not the visualisation. A chart in a news article cites the underlying dataset; trace it.
- Classify the analytics question before analysis. Name whether the dataset is being
used for descriptive, diagnostic, predictive, or prescriptive claims, then pair with
data-quality-pipeline/references/analytics-quality-method-gate.md before modelling or
publishing figures.
Integration with other skills
| Pair with |
Why |
evidence-discipline |
Dataset claims must be traceable to source dataset version |
source-verification |
Datasets are typically Tier 1 (official) or Tier 2 (regulator) |
discipline-router |
Discipline determines which dataset hosts to prioritise |
regulatory-landscape-mapping |
Government datasets often back regulatory analysis |
crosswalk-matrix |
Datasets occupy a column in the matrix |
research-report-builder |
Methodology section names the dataset + version + license |
Dataset Source Pitfalls
- Citing a chart without finding the underlying dataset
- Downloading without recording SHA-256 — dataset versions drift silently
- Skipping the profile step — null rates and duplicates are real findings
- Assuming the dataset's column meaning matches your assumption (always read the codebook)
- Using a stale cached version when the source has updated
- Ignoring the license on republication
East African dataset anchors
- KNBS (Kenya National Bureau of Statistics) — Census, KIHBS, KCHS
- UBOS (Uganda Bureau of Statistics) — UDHS, UNHS
- NBS Tanzania — HBS, DHS
- NISR Rwanda — EICV, DHS
- Africa Open Data — pan-African aggregator
- World Bank Open Data — best for cross-country comparison
- Humanitarian Data Exchange (HDX) — crisis / refugee data, including East African flows
See also
Inputs
| Input |
Source/provider |
If absent |
| Research question, variables, geography, period |
Research brief |
Stop search and clarify the need |
| Source, version, licence, checksum or retrieval metadata |
Dataset publisher |
Quarantine retrieval and report the gap |
Capability Contract
Discovery and profiling default to read-only. Downloading restricted data, accepting licences, modifying source data, publishing, or certifying fitness requires explicit authority.
Degraded Mode
Without network or analysis tools, return a verified candidate register or manual profile and mark retrieval, integrity, and analysis checks not assessed.
Dataset Scenario
A promising dataset without version or licence metadata remains a candidate and is not passed to analysis.
See also
tools/datasets/registry.py — full host list with API URLs
tools/datasets/search.py — federated search
tools/datasets/retrieve.py — download with integrity
tools/datasets/analyse.py — profiling
evidence-discipline — every dataset citation must include version + URL + license + access date
Workflow
- Translate the question into variables, geography, period, granularity, and licence constraints.
- Search authoritative catalogues and record publisher, version, date, and licence.
- Stop when provenance, licence, version, or integrity evidence is missing.
- Recover by seeking an authoritative copy or retaining an unassessed candidate.
- Retrieve, profile quality, and hand accepted data to the quality pipeline.
Outputs
| Artefact |
Consumer |
Acceptance condition |
| Candidate register, dataset, and quality profile |
Researcher and data-quality workflow |
Selected data includes provenance, version, licence, integrity, and limitations |
Evidence Produced
| Evidence |
Consumer |
Acceptance condition |
| Search log, manifest, checksum, and profile |
Reviewer and downstream analyst |
The dataset can be located, identified, and checked independently |
Decision Rules
| Choice |
Action |
Failure/risk avoided |
| Candidate lacks version or licence |
Quarantine it |
Unlawful or irreproducible use |
| Integrity check fails |
Stop retrieval |
Corrupted analysis input |
| Coverage misses the question |
Reject or qualify it |
Invalid inference |
Anti-Patterns
- Choosing the first result. Fix: compare coverage and authority.
- Ignoring licence terms. Fix: record and comply before use.
- Analysing an unidentified version. Fix: capture release metadata.
- Treating missing values as absence. Fix: inspect codebooks.
- Claiming fitness from a filename. Fix: run the profile.
Worked Example
A promising dataset without version and licence metadata remains a candidate until an authoritative release supplies both and passes integrity checks.
1---2name: dataset-discovery-and-analysis3description: Use whenever a research project would benefit from public datasets — finds them across government / IGO / academic / ML hubs, retrieves with integrity checks, and produces a Segnini-style five-step quality profile (completeness, duplicates, accuracy, integrity, codes). Backed by tools/datasets/.4---56# Dataset discovery and analysis78<!-- dual-compat-start -->9## Use When1011- Use when a research project needs public datasets, official statistics, replication12 data, ML datasets, or dataset profiling.1314## Do Not Use When1516- Do not use when the task only needs literature or narrative sources.1718## Dataset Intake Guidance1920- Research question, geography, period, discipline, preferred source types, and required21 output.2223## Dataset Method Detail2425- Discover, retrieve, profile, cite, and hand off datasets using the three-step process26 below.2728## Quality Standards2930- Prefer official or primary datasets, record version/licence/SHA-256, and profile before31 analysis.3233## Dataset Failure Notes3435- Do not cite a chart without tracing the underlying dataset.3637## Dataset Deliverable Detail3839- Dataset shortlist, retrieved dataset, profile, quality notes, or citation-ready source40 record.4142## References4344- Use the tools and companion skills listed below for retrieval, profiling, and evidence45 discipline.4647The engine should treat **public datasets as a first-class source type** alongside academic papers and journalism. Most research projects can be sharpened with a directly-cited dataset.4849## Three steps5051### 1. Discovery — `tools/datasets/search.py`5253Federated search across the registered hosts:5455```python56from tools.datasets import search_datasets, DATASET_REGISTRY5758for r in search_datasets("rental housing Kenya", per_host=10, coverage_filter="kenya"):59 print(r.host, r.title, r.url, r.formats)60```6162**Decision rules:**63- Always search both **government open-data portals** (data.gov, KNBS, UBOS, NBS, NISR, Eurostat) and **IGO bodies** (World Bank, IMF, OECD, WHO, UNICEF, FAOSTAT) for any cross-border quantitative question.64- Use **Zenodo / Dataverse / Figshare** for academic / replication datasets.65- Use **HuggingFace Datasets / Kaggle** for ML / pre-cleaned datasets.66- Combine with `discipline-router` — different research disciplines have different canonical hosts.6768### 2. Retrieval — `tools/datasets/retrieve.py`6970```python71from tools.datasets import retrieve_dataset7273result = retrieve_dataset(74 "https://data.knbs.or.ke/dataset/.../household-survey.csv",75 dest_dir="projects/<project-id>/data",76 sha256_expected="abc123...", # optional integrity check77)78```7980- Goes through the engine's `tools/scraping/http_client` for retries + ethics.81- Computes SHA-256 for integrity / re-use detection.82- Detects format from extension + content-type (CSV / Parquet / Excel / NetCDF / etc.).83- Caches on disk; re-runs are free.8485### 3. Analysis — `tools/datasets/analyse.py`8687```python88from tools.datasets import profile_dataset8990prof = profile_dataset("projects/<project-id>/data/household-survey.csv")91print(prof.n_rows, prof.n_columns, prof.duplicate_rows)92for col in prof.columns:93 print(col.name, col.null_rate, col.dtype)94print(prof.quality_flags) # warnings per Segnini's checklist95```9697The profile applies Segnini's **five-step verification** (Verification Handbook):981. **Completeness** — null-rate per column with warning threshold992. **Duplicates** — duplicate-row count1003. **Accuracy** — min/max/mean/std for numeric columns; extreme-value spot-check1014. **Integrity** — sample values surfaced for human review1025. **Codes / acronyms** — build a glossary if columns use codes103104## Legacy Dataset Decision Notes105106- **Always profile before analysing.** Treat the profile as the dataset's `five-term-source-doubt` equivalent.107- **Document SHA-256 in the source citation.** Datasets change; lock the exact version you used.108- **Prefer official portals over secondary aggregators.** KNBS direct beats data.gov mirror of KNBS.109- **License is part of the source citation.** Note CC-BY-4.0 / OGL / etc. in `<cohort>/research/sources.md`.110- **When the dataset is large and you only need a slice**, pull the slice via API rather than downloading the full dataset.111- **Cite the dataset, not the visualisation.** A chart in a news article cites the underlying dataset; trace it.112- **Classify the analytics question before analysis.** Name whether the dataset is being113 used for descriptive, diagnostic, predictive, or prescriptive claims, then pair with114 `data-quality-pipeline/references/analytics-quality-method-gate.md` before modelling or115 publishing figures.116117## Integration with other skills118119| Pair with | Why |120|---|---|121| `evidence-discipline` | Dataset claims must be traceable to source dataset version |122| `source-verification` | Datasets are typically Tier 1 (official) or Tier 2 (regulator) |123| `discipline-router` | Discipline determines which dataset hosts to prioritise |124| `regulatory-landscape-mapping` | Government datasets often back regulatory analysis |125| `crosswalk-matrix` | Datasets occupy a column in the matrix |126| `research-report-builder` | Methodology section names the dataset + version + license |127128## Dataset Source Pitfalls129130- Citing a chart without finding the underlying dataset131- Downloading without recording SHA-256 — dataset versions drift silently132- Skipping the profile step — null rates and duplicates are real findings133- Assuming the dataset's column meaning matches your assumption (always read the codebook)134- Using a stale cached version when the source has updated135- Ignoring the license on republication136137## East African dataset anchors138139- **KNBS** (Kenya National Bureau of Statistics) — Census, KIHBS, KCHS140- **UBOS** (Uganda Bureau of Statistics) — UDHS, UNHS141- **NBS Tanzania** — HBS, DHS142- **NISR Rwanda** — EICV, DHS143- **Africa Open Data** — pan-African aggregator144- **World Bank Open Data** — best for cross-country comparison145- **Humanitarian Data Exchange (HDX)** — crisis / refugee data, including East African flows146147## See also148149## Inputs150151| Input | Source/provider | If absent |152|---|---|---|153| Research question, variables, geography, period | Research brief | Stop search and clarify the need |154| Source, version, licence, checksum or retrieval metadata | Dataset publisher | Quarantine retrieval and report the gap |155156## Capability Contract157158Discovery and profiling default to read-only. Downloading restricted data, accepting licences, modifying source data, publishing, or certifying fitness requires explicit authority.159160## Degraded Mode161162Without network or analysis tools, return a verified candidate register or manual profile and mark retrieval, integrity, and analysis checks `not assessed`.163164## Dataset Scenario165166A promising dataset without version or licence metadata remains a candidate and is not passed to analysis.167168## See also169170- `tools/datasets/registry.py` — full host list with API URLs171- `tools/datasets/search.py` — federated search172- `tools/datasets/retrieve.py` — download with integrity173- `tools/datasets/analyse.py` — profiling174- `evidence-discipline` — every dataset citation must include version + URL + license + access date175176<!-- dual-compat-end -->177178## Workflow1791801. Translate the question into variables, geography, period, granularity, and licence constraints.1812. Search authoritative catalogues and record publisher, version, date, and licence.1823. Stop when provenance, licence, version, or integrity evidence is missing.1834. Recover by seeking an authoritative copy or retaining an unassessed candidate.1845. Retrieve, profile quality, and hand accepted data to the quality pipeline.185186## Outputs187188| Artefact | Consumer | Acceptance condition |189|---|---|---|190| Candidate register, dataset, and quality profile | Researcher and data-quality workflow | Selected data includes provenance, version, licence, integrity, and limitations |191192## Evidence Produced193194| Evidence | Consumer | Acceptance condition |195|---|---|---|196| Search log, manifest, checksum, and profile | Reviewer and downstream analyst | The dataset can be located, identified, and checked independently |197198## Decision Rules199200| Choice | Action | Failure/risk avoided |201|---|---|---|202| Candidate lacks version or licence | Quarantine it | Unlawful or irreproducible use |203| Integrity check fails | Stop retrieval | Corrupted analysis input |204| Coverage misses the question | Reject or qualify it | Invalid inference |205206## Anti-Patterns207208- Choosing the first result. **Fix:** compare coverage and authority.209- Ignoring licence terms. **Fix:** record and comply before use.210- Analysing an unidentified version. **Fix:** capture release metadata.211- Treating missing values as absence. **Fix:** inspect codebooks.212- Claiming fitness from a filename. **Fix:** run the profile.213214## Worked Example215216A promising dataset without version and licence metadata remains a candidate until an authoritative release supplies both and passes integrity checks.