sfm-ui icon indicating copy to clipboard operation
sfm-ui copied to clipboard

Added command for extracting users and collections

Open dolsysmith opened this issue 3 years ago • 4 comments

Django command creates a CSV of users and collections, useful to contacting users, etc.

To test, run the following in the sfm-docker directory (where output.csv is the name of the desired output file):

docker-compose run ui /opt/sfm-ui/sfm/manage.py getusercollections /sfm-data-shared/output.csv

dolsysmith avatar Aug 09 '22 16:08 dolsysmith

@dolsysmith I think it would be helpful to add the numeric collection identifier as well (and perhaps also the parent collection_set identifier)

kerchner avatar Aug 22 '22 20:08 kerchner

@dolsysmith The additional fields show up successfully and will be helpful. Is docker-compose run ui /opt/sfm-ui/sfm/manage.py getusercollections /sfm-data-shared/output.csv supposed to place the csv file locally (i.e. on the host from where I'm running docker-compose? I had to shell into the container to get the file. Just making sure that's what you intended.

This new getusercollections management command deserves an entry in the readthedocs. Maybe here https://sfm.readthedocs.io/en/stable/administration.html or here https://sfm.readthedocs.io/en/stable/processing.html#sfm-commandline-tools ?

kerchner avatar Sep 06 '22 13:09 kerchner

@kerchner If you have DATA_SHARED_DIR mapped to sfm-data-shared in docker-compose.yml, then the CSV should be available in whatever directory (outside the container) is represented by DATA_SHARED_DIR. That's how it's configured on prod.

dolsysmith avatar Sep 06 '22 13:09 dolsysmith

@dolsysmith Got it, I see it there now in the directory mapped to DATA_SHARED_DIR.

kerchner avatar Sep 06 '22 13:09 kerchner