Authoring workflows¶
These hands-on tutorials show how to build DDI documents step by step using
the ddi-l CRUD API. Each lesson starts from a clean workspace and builds
up a study with questions, variables, concepts, and validation.
Tutorial 1: Create a basic study¶
Objectives
- Create a study with
ddi.new_study(). - Add questions and variables.
- Save to XML and verify the output.
-
Create the study:
-
Add questions:
-
Add variables linked to questions:
-
Save and inspect:
Open the XML file to see the DDI structure with proper namespace prefixes.
Tutorial 2: Add concepts and universes¶
Objectives
- Add conceptual content to a study.
- Link variables to concepts.
-
Build on the previous study:
-
Create variables with concept links:
-
Check the counts:
Tutorial 3: Use any item type¶
Objectives
- Use
add_item()for types beyond the basic five. - Query items with
items(). - Find and remove items.
-
Add categories and instruments:
-
Query by type:
-
Find and remove:
Tutorial 4: Open, validate, and modify¶
Objectives
- Open an existing DDI file.
- Validate the document.
- Add new content and save.
-
Open and validate:
-
Add new content:
-
Validate and save:
Next steps¶
- See the validation guide for advanced validation options.
- See the models reference for the full list of DDI types.
- Try the training labs for self-paced exercises.