Skip to content

Write the config

Finally, define a config.json file. There must be exactly one config file per delivery, located in the root directory. It tells the pipeline which files to read and what entity type they define, names the data’s sources and provenance, and specifies the column mapping. The mapping is only needed when the column names were customized.

Here’s an example configuration:

{
"includeInputSubdirs": true,
"inputFiles": {
"atividade_fisica_adultos.csv": {
"provenance": "MINISTERIO_SAUDE_BR",
"format": "variablePerRow",
"columnMappings": {
"variable": "sv",
"entity": "municipio",
"date": "ano",
"value": "valor"
}
}
},
"groupStatVarsByProperty": true,
"sources": {
"dados.saude.gov.br": {
"url": "https://dados.saude.gov.br",
"provenances": {
"MINISTERIO_SAUDE_BR": "https://dados.saude.gov.br/dataset/atividade-fisica-adultos"
}
}
}
}

The config has four main fields: includeInputSubdirs, inputFiles, groupStatVarsByProperty, and sources.

Whether the pipeline should consider files in subdirectories of the input folder. When true, files can be referenced using relative paths within those subdirectories. If omitted, the default is false.

Defines the input files the pipeline will process. Each CSV is one entry, keyed by its filename — so if files live in subdirectories of the input folder, specify their paths relative to it. You can also use the * wildcard to select multiple files matching a name pattern.

The parameters for each CSV:

ParameterWhenMeaning
formatrequiredAlways variablePerRow.
provenanceoptionalIdentifies the specific dataset the data came from. Each provenance is a dataset published by a given source and must match a provenance defined under sources.
importTyperequired for entitiesThe type of data in the file. When the data defines new entities, use entity; otherwise the default is variables.
entityTyperequired for variablesThe type of the entities the observations belong to. All entities in one file must be the same type. For files that define custom entities, use rowEntityType.
rowEntityTyperequired for entitiesThe DCID of the entity type — new or existing — associated with the custom entities defined in the file.
columnMappingsrequired for custom columnsFill this in when the CSV column headers don’t follow the standard names.

Using the CSV from the formatting step, the mapping looks like:

"columnMappings": {
"variable": "sv",
"entity": "municipio",
"date": "ano",
"value": "valor"
}

When true, groups variables in the Statistical Variable Explorer by the values of custom properties. For example, if a gender property is defined with the values male and female, the variables are grouped accordingly.

Defines the sources and provenances associated with the input data. Each named source contains a mapping between provenances and their URLs.

ParameterMeaning
urlThe URL of the source.
provenancesA set of NAME: URL pairs identifying the specific datasets obtained from that source. The provenance name must match the value used in the provenance field under inputFiles.

After the steps above, you should end up with a structure similar to this:

meus_dados/
├── config.json
├── vars1.mcf
├── dados1.csv
├── dados2.csv
└── outros_dados/
├── vars2.mcf
├── dados3.csv
└── dados4.csv

The number, names, and organization of the CSV and MCF files inside the folder are up to you. The config.json, however, must live in the root directory.

With the files in place, validate and deliver the dataset.