Description
Defining a strict machine-readable schema for each code an AI or human coder produces, so first-order codes always carry evidence, location, rationale and confidence and can be audited.
First-order codes, in the Gioia tradition, stay close to participants' own language before being abstracted into second-order themes. When an LLM produces them, free-text output is hard to verify and aggregate. A structured schema forces each code record to contain fields such as segment ID, participant ID, code label in participant terms, verbatim quote span with character offsets, rationale, confidence and whether the code is new or from the codebook. The schema is validated programmatically; invalid outputs are rejected and retried. Rigour comes from schema design that encodes methodological commitments (no code without evidence), validation of quote spans against source text, and version control of the schema itself.
Attributes
- Discipline
- Qualitative Analysis & Synthesis
- Loss type
- Latent
- Goal
- Synthesise data
- Stage
- Discovery
- Data
- Analytical / expert
- Effort
- Days
Steps
- Decide the analytic commitments the schema must enforce (e.g. every code needs a verbatim quote; codes stay in participant language).
- Write a JSON Schema with required fields: segment_id, participant_id, code_label, quote, quote_start, quote_end, rationale, confidence (0-1), is_new_code.
- Pass the schema to the model's structured output or tool-use feature and validate every response.
- Reject and retry outputs that fail validation, up to a fixed limit (e.g. 3), then route to human review.
- Verify programmatically that each quote matches the source text at the given offsets.
- Version the schema and store outputs in a table ready for second-order synthesis.
Sources
- Anthropic Claude API (claude-sonnet-4-20250514)
- structured outputs (JSON schema)
- asyncio
- Gioia, D. A., Corley, K. G. & Hamilton, A. L. (2013) Seeking qualitative rigor in inductive research. Organizational Research Methods
- JSON Schema specification (json-schema.org)
- The Inquiry Series, C12 — AI Agents for Structured Qualitative Analysis at Scale
Also known as
- JSON schema coding outputs
- Constrained LLM output for coding
Categories
- User Research
- Qualitative Analysis & Synthesis