Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored accordeons: Dictionary keys disappear from interface #528

Closed
jluethi opened this issue Jul 16, 2024 · 2 comments · Fixed by #529
Closed

Refactored accordeons: Dictionary keys disappear from interface #528

jluethi opened this issue Jul 16, 2024 · 2 comments · Fixed by #529
Labels
JSON Schemas Editing of WorkflowTask arguments based on JSON Schemas

Comments

@jluethi
Copy link
Collaborator

jluethi commented Jul 16, 2024

We have a new interface issue for tasks like Convert Cellvoyager Multiplexing to OME-Zarr:

We have a dictionary of inputs. Each dictionary item is added as a new property. In the sandbox, that all works well and the dictionary key remains displayed in the inner accordeon.

Screenshot 2024-07-16 at 13 50 36

But in a Fractal web deployment of version 1.3.0, when I save the workflow task, the dictionary key is not shown anymore. Instead, the name of that "class" is shown, e.g. "MultiplexingAcquisition". We should go back to showing the dictionary keys here.

Screenshot 2024-07-16 at 13 53 20

Here is the json schema for that task:

{
  "title": "CellvoyagerToOmeZarrInitMultiplex",
  "type": "object",
  "properties": {
    "zarr_urls": {
      "title": "Zarr Urls",
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of paths or urls to the individual OME-Zarr image to be processed. Not used by the converter task. (standard argument for Fractal tasks, managed by Fractal server)."
    },
    "zarr_dir": {
      "title": "Zarr Dir",
      "type": "string",
      "description": "path of the directory where the new OME-Zarrs will be created. (standard argument for Fractal tasks, managed by Fractal server)."
    },
    "acquisitions": {
      "title": "Acquisitions",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/MultiplexingAcquisition"
      },
      "description": "dictionary of acquisitions. Each key is the acquisition identifier (normally 0, 1, 2, 3 etc.). Each item defines the acquisition by providing the image_dir and the allowed_channels."
    },
    "image_glob_patterns": {
      "title": "Image Glob Patterns",
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "If specified, only parse images with filenames that match with all these patterns. Patterns must be defined as in https://docs.python.org/3/library/fnmatch.html, Example: `image_glob_pattern=[\"*_B03_*\"]` => only process well B03 `image_glob_pattern=[\"*_C09_*\", \"*F016*\", \"*Z[0-5][0-9]C*\"]` => only process well C09, field of view 16 and Z planes 0-59."
    },
    "num_levels": {
      "title": "Num Levels",
      "default": 5,
      "type": "integer",
      "description": "Number of resolution-pyramid levels. If set to `5`, there will be the full-resolution level and 4 levels of downsampled images."
    },
    "coarsening_xy": {
      "title": "Coarsening Xy",
      "default": 2,
      "type": "integer",
      "description": "Linear coarsening factor between subsequent levels. If set to `2`, level 1 is 2x downsampled, level 2 is 4x downsampled etc."
    },
    "image_extension": {
      "title": "Image Extension",
      "default": "tif",
      "type": "string",
      "description": "Filename extension of images (e.g. `\"tif\"` or `\"png\"`)."
    },
    "metadata_table_files": {
      "title": "Metadata Table Files",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "If `None`, parse Yokogawa metadata from mrf/mlf files in the input_path folder; else, a dictionary of key-value pairs like `(acquisition, path)` with `acquisition` a string like the key of the `acquisitions` dict and `path` pointing to a csv file containing the parsed metadata table."
    },
    "overwrite": {
      "title": "Overwrite",
      "default": false,
      "type": "boolean",
      "description": "If `True`, overwrite the task output."
    }
  },
  "required": [
    "zarr_urls",
    "zarr_dir",
    "acquisitions"
  ],
  "additionalProperties": false,
  "definitions": {
    "Window": {
      "title": "Window",
      "description": "Custom class for Omero-channel window, based on OME-NGFF v0.4.",
      "type": "object",
      "properties": {
        "min": {
          "title": "Min",
          "type": "integer",
          "description": "Do not change. It will be set to `0` by default."
        },
        "max": {
          "title": "Max",
          "type": "integer",
          "description": "Do not change. It will be set according to bit-depth of the images by default (e.g. 65535 for 16 bit images)."
        },
        "start": {
          "title": "Start",
          "type": "integer",
          "description": "Lower-bound rescaling value for visualization."
        },
        "end": {
          "title": "End",
          "type": "integer",
          "description": "Upper-bound rescaling value for visualization."
        }
      },
      "required": [
        "start",
        "end"
      ]
    },
    "OmeroChannel": {
      "title": "OmeroChannel",
      "description": "Custom class for Omero channels, based on OME-NGFF v0.4.",
      "type": "object",
      "properties": {
        "wavelength_id": {
          "title": "Wavelength Id",
          "type": "string",
          "description": "Unique ID for the channel wavelength, e.g. `A01_C01`."
        },
        "index": {
          "title": "Index",
          "type": "integer",
          "description": "Do not change. For internal use only."
        },
        "label": {
          "title": "Label",
          "type": "string",
          "description": "Name of the channel."
        },
        "window": {
          "$ref": "#/definitions/Window",
          "title": "Window",
          "description": "Optional `Window` object to set default display settings for napari."
        },
        "color": {
          "title": "Color",
          "type": "string",
          "description": "Optional hex colormap to display the channel in napari (it must be of length 6, e.g. `00FFFF`)."
        },
        "active": {
          "title": "Active",
          "default": true,
          "type": "boolean",
          "description": "Should this channel be shown in the viewer?"
        },
        "coefficient": {
          "title": "Coefficient",
          "default": 1,
          "type": "integer",
          "description": "Do not change. Omero-channel attribute."
        },
        "inverted": {
          "title": "Inverted",
          "default": false,
          "type": "boolean",
          "description": "Do not change. Omero-channel attribute."
        }
      },
      "required": [
        "wavelength_id"
      ]
    },
    "MultiplexingAcquisition": {
      "title": "MultiplexingAcquisition",
      "description": "Input class for Multiplexing Cellvoyager converter",
      "type": "object",
      "properties": {
        "image_dir": {
          "title": "Image Dir",
          "type": "string",
          "description": "Path to the folder that contains the Cellvoyager image files for that acquisition and the MeasurementData & MeasurementDetail metadata files."
        },
        "allowed_channels": {
          "title": "Allowed Channels",
          "type": "array",
          "items": {
            "$ref": "#/definitions/OmeroChannel"
          },
          "description": "A list of `OmeroChannel` objects, where each channel must include the `wavelength_id` attribute and where the `wavelength_id` values must be unique across the list."
        }
      },
      "required": [
        "image_dir",
        "allowed_channels"
      ]
    }
  }
}
@tcompa tcompa added the JSON Schemas Editing of WorkflowTask arguments based on JSON Schemas label Jul 16, 2024
@tcompa
Copy link
Collaborator

tcompa commented Jul 16, 2024

I can reproduce on an existing instance (with fractal-web 1.3.0).

Starting from an empty page, before clicking "Save changes"
image

After saving:
image

Note that the PATCH request has the correct body (sorry, I changed the custom name of the key):
image

And if I export the arguments they are correct:

{
  "args_parallel": null,
  "args_non_parallel": {
    "num_levels": 5,
    "coarsening_xy": 2,
    "image_extension": "tif",
    "overwrite": false,
    "acquisitions": {
      "MYKEY": {
        "image_dir": "/tmp",
        "allowed_channels": [
          {
            "wavelength_id": "a",
            "active": true,
            "coefficient": 1,
            "inverted": false
          }
        ]
      }
    }
  }
}

@jluethi
Copy link
Collaborator Author

jluethi commented Jul 16, 2024

Agreed, it doesn't save any wrong values or break workflows. This is purely a display issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON Schemas Editing of WorkflowTask arguments based on JSON Schemas
Projects
Development

Successfully merging a pull request may close this issue.

2 participants