## 2 Materials and Methods
### Masketeer Algorithm
#### 2.2.4 Masking Ensemble  
The _Masketeer_ algorithm consisted of an ensemble of five individual masking methods (i.e., classes) called _Maskers_. Each _Masker_ was responsible for a specific case of de-identification. Table 3 provides a summary of all _Masker_ classes, which are described in detail in the subsequent sections.  
**Salutation:** The salutation _Masker_ removed upper-case words that followed common German salutations (e.g., _\"Hallo\"_, _\"Frau/Herr\"_, _\"Dr.\"_, _\"Mag.\"_, _\"Best Gruse\"_). Spelling variants and abbreviations of these salutations were considered (e.g., _\"Doktor\"_ and _\"Dr.\"_). Additional salutations were compiled that are specific to Austrian German (e.g., _\"Liebe Gruse\"_ and _\"LG\"_).  
**NameDictionary:** Three name dictionaries were compiled for this _Masker_. 1. A list of _patient_ names was created by using the DMP's database-internal data. 2. Similarly, a list of _HCP_ names was extracted from the same database. This list of HCPs was supplemented by web scraping a publicly available search tool for regional doctors (i.e., doctor search of the _Tyrolean Medical Chamber_). 3. Names that were in both categories and thus ambiguous were added to a general _person_ list. This person list was supplemented by a large web-scraped list of all Wikipedia page titles of page type _Person_ and curated by a whitelist, removing names that were likely to refer to terms in a medical context (e.g., _\"Rumpf\"_, representing either a name or the term _\"torso\"_ in German). A _Masketeer_ object can be initialized with any json file containing names to adapt to the internal patient and HCP name list in order to ease the application of the algorithm in different contexts.  
**FullName:** To expand the capabilities of the NameDictionary _Masker_, any upper-case word that either preceded or succeeded an instance of a proven name was also considered a name and thus removed. For example, if _\"[PERSON]\"_ was part of the text and the last name _\"[PERSON]\"_ was in one of the dictionaries but the rare first name _\"[PERSON]\"_ was not, the NameDictionary _Masker_ would only remove the last name _\"[PERSON]\"_, while the FullName _Masker_ would also remove the first name _\"[PERSON]\"_.  
**DoubleName:** Double or hyphenated names for both first as well as last names are common in the German language (e.g., _\"[PERSON]\"_, _\"[PERSON]\"_). Like the FullName _Masker_'s logic, the DoubleName _Masker_ further checked hyphenated upper-case word chains including at least one proven name.  
**MedicalSite:** Analogous to the name lists, a list of medical sites was created to remove such references to geographic information based on the database contents and supplemented by manually curated additions of commonly occurring sites.  
All _Maskers_ were applied to all tokens in the order depicted in Table 3, and each individual method voted either for or against removal. Once at least one vote was positive from any _Masker_, the currently queried token was replaced with a randomly generated pseudonym. The remaining _Maskers_ were skipped for this specific token.  
All names and spellings of medical sites in the lists were checked for spelling variants. Especially German umlauts and special characters were considered (e.g., \"a\" can be spelled \"ae\", \"8\" can be spelled \"ss\").  
\begin{table}
\begin{tabular}{c c} _Masker_ & **Removal Logic** \\ \hline \hline \multicolumn{1}{c}{Salutation} & \multicolumn{1}{c}{Upper-case words after salutations} \\ \hline \hline NameDictionary & Words that appear in any name dictionary \\ \hline FullName & Upper-case words before or after a proven name \\ \hline DoubleName & Hyphenated upper-case word chain with proven name \\ \hline MedicalSite & Words that appear in a medical site dictionary \\ \hline \end{tabular}
\end{table}
Table 3: Summary of all _Maskers_ with their names and removal logics.