Importing labs and people

Labs, people, memberships, and folder ownership from CSV files, with a dry run first.

pinax import sets up or updates, in bulk, who is who in Pinax: labs and departments, people, who belongs to which lab, and which lab owns each top-level folder. It reads up to four CSV files, shows every change it would make, and makes them only when asked:

uv run pinax import examples/import
uv run pinax import examples/import --apply

For one person or lab at a time, use People and access in the app: it follows the same rules for usernames, emails, and slugs, and audits each change the same way (with "source": "app" instead of "import").

The folder holds any of labs.csv, people.csv, memberships.csv, and folders.csv; or name the files with --labs, --people, --memberships, and --folders. The examples in examples/import/ fit the demo: they add two departments and a lab, three people, and owners for the demo's three unmapped folders.

This is a stop-gap until the authoritative source of folder ownership is chosen (wave 15 in pinax-spec/roadmap.md). That source, or a script reading it, can write these files.

How an import works

Files are UTF-8 (a byte-order mark from Excel is fine), with a header row; column names are not case-sensitive, and spaces around values are ignored. Empty lines are skipped.

The files

labs.csv: labs and departments

ColumnRequiredValues
slugyes, the keyLowercase letters, digits, - and _, starting with a letter or digit; at most 64 characters; not none
nameyesThe name people see
kindno (default lab)lab or department
divisionnoFree text
research_areanoFree text
activeno (default true)true or false (also yes/no, 1/0). An inactive lab gives its members no access

people.csv: people

ColumnRequiredValues
usernameyes, the keyThe sign-on name the SSO proxy sends (X-Remote-User); no spaces
display_nameyes
emailyes
titlenoFree text
is_adminno (default false)true gives the person the storage administrator role: every filesystem and folder
activeno (default true)false stops the person signing in

Site roles (auditor, finance, and division head) are not imported: give them on the person's page in People and access (Site roles).

memberships.csv: who belongs to which lab

ColumnRequiredValues
labyes, the key with usernameA lab's slug, from the catalog or labs.csv
usernameyesA person's username, from the catalog or people.csv
roleyespi (the PI of a lab, or a department's owner), delegate (a member who sees the lab's folders), or none to remove the membership

folders.csv: which lab owns each top-level folder

ColumnRequiredValues
filesystemyes, the key with folderA registered filesystem's slug (pinax filesystem list)
folderyesOne folder name directly under the filesystem's root, such as alvarez_m
labyesThe owning lab's slug, from the catalog or labs.csv, or none to unmap the folder

A folder can be mapped before it exists on the filesystem (it appears with the next scan). Each folder has one owner, so mapping it to another lab moves it.

Refused rows

Any of these refuses the import: