Effective way to anonymise interviewee identities for academic research

I'm looking for an efficient way to anonymise interviewee identities using a pseudonym list.

Academic and teaching case studies often use direct quotation from interviews and observational data. In these cases it is usual to identify the speakers using a pseudonym and/or role label. Anonymisation attempts to preserve the privacy of research subjects, following the 'do no harm' principle of social and human sciences research ethics. Using a pseudonym preserves source attribution (i.e. justifies that the quote is an example of actual empirical evidence).

I imagine writing the quotes with correct attribution in my latex document, and they will be replaced when typesetting. Something like \person{jenny} and \personrole{ceo} and a catalogue command like \dramatispersonae that produces a register of the pseudonyms and their roles in a section, somewhat like a glossary, or characters of a play, the dramatis personae.

Perhaps I could do this with bibtex, but I need to the dramatis personae to be separate from the bibliography.

Notes: I think this is somewhat like creating a glossary, a register of names or list keywords used in a document (i.e. create-a-register-of-persons-with-biblatex or create-a-register-of-persons-with-references) But I'm not referring to approaches for censoring, redacting or 'blinding' text (i.e. efficient-ways-to-anonymize-a-document)

One way to do this (if I understand correctly what you want) is to create quasi-arrays of control-sequence (command) names with numbers in them so you can loop through the array using a counter.

Here the command \newperson takes three arguments: a pseudonymn, real name, and role for each person. It stores each of these in an array according to the current person number (so for example, \person0pseudonym). It also creates a control sequence from the pseudonym, which expands to the array number of that person. Then there are command to access each person's data individually or to get a list of all people. You could customize the format of \listperson and \listpeople to be a table or some other format.

The \ID command is an example of how you might refer to the names in the text so that you can control whether the real name shows or not. You just say whether you want the result of this command to output the real name or the pseudonym from the array.

\documentclass{article}

% Add a person to the list of people
% (implemented as an "array" of control-sequence names (person0, person1, etc.)
\newcounter{person}
% #1 Pseudonym, #2 Real Name, #3 Role
\newcommand{\newperson}[3]{%
\expandafter\gdef\csname person\theperson pseudonym\endcsname{#1}%
\expandafter\gdef\csname person\theperson name\endcsname{#2}%
\expandafter\gdef\csname person\theperson role\endcsname{#3}%
\expandafter\edef\csname #1\endcsname{\theperson}%
\stepcounter{person}%
}

% Fetch specific data from member of list of people
% For the next four commands, #1 csname based on pseudonym, or personID number
\newcommand{\pseudonym}[1]{%
\csname person#1pseudonym\endcsname%
}
\newcommand{\realname}[1]{%
\csname person#1name\endcsname%
}
\newcommand{\personrole}[1]{%
\csname person#1role\endcsname%
}
% List all the data for one person
% (formatting could be customized)
\newcommand{\listperson}[1]{%
\pseudonym{#1}: \realname{#1} (\personrole{#1})%
}

% List all the data for all the people
\newcounter{currentperson}
\newcommand{\listpeople}{%
\setcounter{currentperson}{0}%
\begin{itemize}
\loop
\item \listperson{\thecurrentperson}
\stepcounter{currentperson}%
\ifnum\value{currentperson} < \value{person}
\repeat%
\end{itemize}%
}

% Use the \ID command to refer to person in text using their name as a control sequence (e.g., \ID{\Jenny})
\newcommand{\userealnames}{\let\ID\realname}
\newcommand{\usepseudonyms}{\let\ID\pseudonym}
\usepseudonyms % default is not to show real names in the transcript

\begin{document}

% You could input a list like this from a separate file
\newperson{Jenny}{Jane Doe}{Line cook}
\newperson{Frances}{John Doe}{Cashier}
\newperson{Ralph}{Jim Doe}{Manager}

Here is the information on the first person: \listperson{\Jenny}.

\subsection*{List of People}

\listpeople

\subsection*{Pseudonyms}

\ID{\Jenny} accused \ID{\Frances} of stealing money.
\ID{\Ralph} mediated their dispute and determined that no money was stolen.

\subsection*{Now with Real Names}

\userealnames
\ID{\Jenny} accused \ID{\Frances} of stealing money.
\ID{\Ralph} mediated their dispute and determined that no money was stolen.

\end{document}


• Is John's sex change intentional? – cfr Sep 15 '15 at 22:20
• @cfr :) no, should be Francis, I guess – musarithmia Sep 15 '15 at 22:50
• Thank you Andrew. Your solution looks very very close to what I was thinking. Plus you've given a nice example of control-sequences in a quasi-array so I'm learning something new. I'll play around with it to apply it to my data. – Aldoaldo Sep 17 '15 at 8:58