informatics-isi-edu / synspy

Synaptic segmentation and visualization with fluorescence microscopy
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Synspy launcher #7

Closed karlcz closed 7 years ago

karlcz commented 7 years ago

The launcher will integrate deriva-py capabiltiies, a small GUI, and a simple task-flow for users:

  1. Obtain user-specific credentials either from known homedir-relative file or oauth-based login flow
  2. Retrieve a task list from the pre-configured ermrest catalog
    • query the Image Region table
    • filter on Classifier = current client (use mapping data to Person table)
    • filter on Source Image->URL being non-null
    • filter on ZYX Slice being non-null
    • filter on Status being "analysis pending" or "analysis in progress" (JSON column)
  3. Offer a chooser-style GUI for the user to choose a task
    • list of matched results, sorted by Subject Issue Date, Sub-Sequence (both ascending)
  4. Download required input data for the task
    • the raw OME-TIFF file in the Source Image->URL column
    • maintain a (configurable) local file cache location to avoid repeated download work and duplicate data
  5. Launch the synspy-viewer sub-process with appropriate parameters
    • a temporary working dir
    • the name of the source image file as single CLI argument
    • a set of environment-variable parameters TBD
      • Segmentation Mode controls SYNSPY_DETECT_NUCLEI
      • ZYX Slice controls ZYX_SLICE
      • add a new param to control output dir file writing to use current working dir (instead of source image dir)?
  6. On sub-process exit, check for output status and output files
    • zero status means success, show happy status in GUI?
    • non-zero means there were problems, show warning in GUI?
    • two output CSV files may be saved with names based on input name and well-known suffixes
  7. Offer a three-choice dialog (some only if output files were found)
    • Save Progress: upload data but leave task incomplete (if files were found)
    • Complete: upload data and mark task complete
    • Discard: discard sub-process output and change no state on server
  8. Perform data upload if requested
    • upload to well-known hatrac object URL based on record ID and file types
  9. Change task state
    • add new object URLs if they were not already present (due to save progress actions)
    • change task status to "analysis in progress" (for save progress) or "analysis complete" (for completion)

A possible ERMrest query to get the task-list for a user with URL-escaped webauthn identity USER1 might look like this:

/ermrest/catalog/1/attributegroup/U:=Synapse:Person/Identities=USER1/T:=(Zebrafish:Image%20Region:Classifier)/!ZYX%20Slice::null::/Status=%22analysis%20pending%22;Status=%22analysis%20in%20progress%22/I:=(Source%20Image)/!URL::null::/$T/*;source_image:=array(I:*),user:=array(U:*)

This includes all the Image Region columns as well as nested objects for the source image and classifier user info reached by foreign key. It also encodes all the filter constraints described above to exclude tasks not yet ready to act on.

karlcz commented 7 years ago

@mikedarcy we should prototype this on synapse-dev and coordinate on any schema changes or other issues...

karlcz commented 7 years ago

I added the Identities column to the Person table and also added a sample query URL in the issue description. I don't think we have any test records in the Image Region table yet which would match the sample query though...

karlcz commented 7 years ago

We actually delivered this to a production user workstation already so I am closing it as complete. Any further problems can be handled as new issues.