NewGraphEnvironment / dff-2022

Building digital field forms and processing data collected using R, postgresql, QGIS and other tools
Creative Commons Zero v1.0 Universal
0 stars 3 forks source link

build script to sort photos into directories and append photo name to end of photo file name #65

Closed NewGraphEnvironment closed 8 months ago

NewGraphEnvironment commented 1 year ago

upstream downstream inlet outlet barrel road

Mateo9569 commented 1 year ago

I'll do a trial and error on this when I get the chance. Might not even need a script. I would think you would be able to do this in the attribute forms in our Q mergin project by adding a default of sorts?

NewGraphEnvironment commented 1 year ago

Good idea to do in Q but currently not an option I don't think because of this https://github.com/MerginMaps/input/issues/1595

potential workflow can be tweaked from the 0120-photos.R scripts

  1. use case_when to mutate site_id from pscis_id and modelled_crossing_id
  2. select just site_id and contains "photo_"
  3. run a bunch of mutates ex. mutate(photo_downstream_renamed = paste0(photo_downstream, "_downstream")
  4. dplyr::pivot_longer to make a 3 column dataframe with headers site_id, name_before, name_after
  5. pull site_id and create.dir for that list
  6. mutate name_before and name_after to be full path filenames with the site_id installed in name_after of course
  7. pull the name columns and run them through an mapply version of fpr::fpr_photo_change_names

abstract workflow later to pull out the appended word after photo_{word} using tidyeval.

NewGraphEnvironment commented 8 months ago

https://github.com/NewGraphEnvironment/fish_passage_peace_2023_reporting/issues/6

working function built in https://github.com/NewGraphEnvironment/fish_passage_peace_2023_reporting/blob/main/scripts/01_prep_inputs/0120-photos.R