Sub topic 8
Building and Maintaining a Codebook
This chapter assumes you can run a usability test or interview, that you have turned your notes into atomic observations, and that you have done a first pass of open coding. Here you will turn the codes from that pass into a codebook, a shared reference that keeps coding consistent. You will also learn how to keep it accurate as the analysis changes.
What a codebook is and why you need one
A codebook is a document that lists every code you use, defines it, and shows how to apply it. Open coding produces codes quickly, and many of them overlap or drift in meaning. Without a codebook you will code the same behavior two ways on Monday and Friday. A second researcher will code it a third way.
A codebook does three jobs:
- Consistency over time. You apply the code on day five the way you applied it on day one.
- Consistency between people. Two researchers can code the same note and reach the same result.
- Transparency. A stakeholder can see what "navigation_confusion" means and judge whether the evidence supports it.
Keep it small and practical. A codebook for a study with 10 participants often has 20 to 60 codes. If you have 200, you are probably coding topics too narrowly, or you have not merged near-duplicates.
What each entry contains
A useful entry has five parts:
| Field | Purpose |
|---|---|
| Code name | A short, stable label, such as `navigation_confusion` |
| Definition | One sentence on what the code captures |
| Include when | Observable cues that mean the code applies |
| Exclude when | Close cases that look similar but belong elsewhere |
| Example notes | Note ids that show clear use of the code |
The exclusion rule is the part people skip, and it matters most. It marks the boundary between neighboring codes. Here is one entry, stored as JSON so it can live next to your data:
{
"code": "navigation_confusion",
"definition": "The participant cannot find a feature or setting they are looking for.",
"include_when": "The participant searches, backtracks, or asks where something is.",
"exclude_when": "The participant finds the feature but dislikes how it works.",
"example_note_ids": ["n2", "n4"]
}The exclusion rule says that disliking a feature is a different problem from not finding it. A note such as "Found the export button but the dialog was confusing" would get a different code, perhaps export_dialog_complexity.
Building the first version
Build the codebook from your open coding, not before it. Follow these steps.
- List all codes. Export every code you created and how many notes use each one. A spreadsheet or a short script is enough.
- Merge duplicates.
cant_find_importandimport_hard_to_locateare the same idea. Choose one name and re-code the notes that used the other. - Split overloaded codes. If one code covers two different problems, divide it. A code called
onboarding_problemsthat mixes "tour too long" with "can't find import" hides two separate issues. - Write definitions and rules. Do this for each code, starting with the most frequent.
- Attach examples. Choose notes that are clear, not ones that are borderline. Include one borderline note in the exclude rule if it helps.
- Test on fresh notes. Code five to ten notes you have not coded yet, using only the codebook. Every time you hesitate, the entry needs work.
The script below counts how often each code is used and flags codes that appear on only one note. These are candidates for merging or removal.
from collections import defaultdict
notes = [
{"id": "n1", "participant": "P1", "codes": ["setup_friction"]},
{"id": "n2", "participant": "P2", "codes": ["setup_friction", "navigation_confusion"]},
{"id": "n3", "participant": "P2", "codes": ["sharing_unclear"]},
{"id": "n4", "participant": "P3", "codes": ["navigation_confusion"]},
]
usage = defaultdict(list)
for note in notes:
for code in note["codes"]:
usage[code].append(note["id"])
for code, ids in sorted(usage.items(), key=lambda item: -len(item[1])):
flag = " <- review: single use" if len(ids) == 1 else ""
print(f"{code}: {len(ids)} notes {ids}{flag}")A single-use code is not always wrong. It might be a rare but important event. But you should decide that deliberately.
Naming conventions
Pick a convention and keep it. Good names share these traits:
- They describe the observation, not your conclusion.
abandoned_searchis better thanbad_design. - They use one style, such as lowercase with underscores.
- They are specific enough to tell codes apart.
confusionis too broad.navigation_confusionis clear. - They avoid evaluating the participant. Write
skipped_tour, notlazy_user.
Some teams group codes with a prefix, such as nav_ or share_. Prefixes help when the list grows, but do not treat them as themes. A prefix is only a filing aid.
Maintaining the codebook during analysis
A codebook is not finished after the first draft. It changes as you read more notes. This is normal, but changes must be controlled, or earlier coding becomes inconsistent with later coding.
Use these rules:
- Version it. Add a version number and a date. Record what changed and why, in a short change log.
- Re-code after a change. If you split a code, go back through every note that had it. Otherwise half your notes use the old meaning.
- Never delete silently. Mark retired codes as merged into another code, so older exports still make sense.
- Add codes sparingly late in the study. A new code that appears after note 80 may mean a real new finding. It also may mean you are drifting. Check by re-reading some early notes to see if the code applies there too.
Edge cases
A note fits two codes. Apply both. Note n2 in the example carries setup_friction and navigation_confusion, and that is fine. Over-applying is a problem only when a code is attached without matching its include rule.
A note fits no code. Do not force it. Mark it as uncoded and review these notes in a batch. They often reveal a missing code.
A code is mostly one participant. Check the participant count. A code with 12 notes from one person is that person's story, not a pattern. This matters later when you build themes, so count participants per code now.
Deductive codes. If you started with codes from a framework or from earlier research, mark them as such in the codebook. Then you can see which codes came from the data and which came from your expectations. This helps you notice bias.
Codes that describe sentiment. Sentiment alone, such as frustrated, is rarely useful. Pair it with what caused it, or record it as a separate attribute, not as a code.
Common errors
- Writing definitions after the fact to justify how you already coded.
- Using vague include rules like "when the user struggles".
- Keeping codes that nobody applies.
- Changing a code without re-coding earlier notes.
- Treating the codebook as a theme list. Codes label observations. Themes explain patterns across them. You will build themes in later chapters.
Exercise
Two researchers code the note "Opened Settings, then Profile, then Help, and finally asked the moderator where the export option was." One applies navigation_confusion. The other applies nothing and writes "participant struggled." Using the codebook entry above, which coding is correct, and what change to the codebook would prevent the disagreement?
Show answer
navigation_confusion is correct. The participant searched in several places and asked where something was, which matches the include rule ("searches, backtracks, or asks where something is"), and the participant never found the feature, so the exclude rule does not apply. The second researcher's "struggled" is too vague to count as a code. To prevent the disagreement, make sure the codebook is shared and used for coding, and add this note as an example of the code. If "struggled" is a habit, add a rule to the process that every code must come from the codebook or trigger a proposed new entry.
Exercise
Your codebook has the code onboarding_problems applied to 18 notes. Notes include "Skipped the tour because it felt long," "Could not find where to import old data," and "Did not understand the pricing page." What should you do?
Show answer
Split it. The code covers at least three different problems: tour length (setup_friction), finding the import feature (navigation_confusion), and pricing comprehension. Write a definition with include and exclude rules for each new code, re-code all 18 notes, mark onboarding_problems as retired in the change log, and record the new version.