---
title: "Importing external targets with evidence"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Importing external targets with evidence}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
```

WFC 2.0 imports targets from a finalized CSV or Excel table and a companion DCF
evidence record. It does not construct a production target from an unexplained
runtime table.

```{r template, eval=FALSE}
dims <- wf_dims(
  age_group = c("18-34", "35-54", "55+"),
  region = c("north", "south")
)

wf_target_template("population-margins.csv", dims)
```

Complete the companion `population-margins.csv.source.dcf` with publisher,
dataset title, citation, reference period, population scope, retrieval date,
license, transformation, selection timing, demo status, and the final SHA-256.

```{r import, eval=FALSE}
target <- wf_import_target(
  "population-margins.csv",
  "population-margins.csv.source.dcf",
  dims,
  key_map = c(age_group = "age_group", region = "region"),
  count = "population_count",
  production = TRUE
)
```

For joint-cell post-stratification, the imported population table must contain
the required joint combinations. For an independent reference sample, use
`wf_import_reference()` with its own evidence file.

The checksum proves that the imported data match the evidence record. It does
not prove that the publisher, transformation, or scientific choice is valid;
those remain review questions.
