Tutorials¶
Step-by-step instructions on how to perform particular tasks with anonapi.
Note
These instructions use windows paths and screenshots, but all commands work the same way for linux. In addition, input files are referred to as excel files, but csv format is also accepted
Anonymize from PACS¶
How to anonymize data when you have a list of accession numbers
Requirements¶
For this tutorial you need the following:
C:\project_folder
- A folder that will hold records of the jobs created. Anonymized data does not have to go into this folder.C:\project_folder\accession_numbers.xlsx
- An excel or csv input file containing a list of accession numbers that you want to anonymize. This file could be anywhere, but for convenience it is inside the project folder in this tutorial.
The path and file above are just examples. They can be anything you like.
Step 1: prepare input file¶
To start, open accession_numbers.xlsx
and check the following:
The file must contain a column with header
accession_number
The file may contain a column with header
pseudonym
. These pseudonyms will be used if found.The file may contain any other columns and text. These will all be ignored for example, The following is a valid input file:
Some text here does not matter
The column 'project' below will also just be ignored
accession_number pseudonym project
1234567.12345678 studyA some_projectA
2234567.12345678 studyB some_projectB
3234567.12345678 studyC some_projectB
Step 2: add input to mapping¶
Find your project folder
C:\project_folder
in windows explorer,shift + right-click
->Open command prompt
(see opening a command prompt)In the command line, run the following:
$ anon map init
$ anon map add-accession-numbers --input-file accession_numbers.xlsx
Now open the mapping for editing:
anon map edit
Tip
If values are not sorted into columns properly in excel, do the following:
select column A
-> click menuData
-> clickText to Columns
In the menu choose
delimited
-> clickNext
Under ‘delimiters’ check either
Comma
orSemicolon
-> clickNext
make the following edits (as shown in the image below):
project
should have the correct anonymization project (usually ‘Wetenschap-Algemeen’)destination_path
should be an be a UNC path (like \\server\share) where you want your anonymized data to be written.
Step 3: create jobs¶
Make sure you have a command prompt in your
project folder C:\project_folder
. Then run the following:
$ anon create from-mapping
This will create all jobs defined in your mapping file and save a reference to them as a batch.
Step 4: monitor job batch¶
To see how your jobs are doing use
$ anon batch status
To print error messages for all failed jobs use
$ anon batch show-error
Other batch commands can be found here.