pepkit / pipestat

Pipeline results reporting package
https://pep.databio.org/pipestat/
BSD 2-Clause "Simplified" License
4 stars 2 forks source link

Retrieving embedded values from object results #163

Closed nsheff closed 3 months ago

nsheff commented 5 months ago

How do you retrieve an deep value from an object result?

I thought we had solved this several months ago, but I can't find/remember how to do it.

I've started a notebook that describes it here: https://pep.databio.org/pipestat/code/reporting-objects/

donaldcampbelljr commented 3 months ago

Using an example of output_file_in_object:

Yaml Format

title: An example Pipestat output schema
description: A pipeline that uses pipestat to report sample and project level results.
type: object
properties:
  pipeline_name: "default_pipeline_name"
  samples:
    type: object
    properties:
      output_file_in_object:
        type: object
        properties:
          prop1:
            description: "This is an example file"
            $ref: "#/$defs/file"
$defs:
  file:
    type: object
    object_type: file
    properties:
      path:
        type: string
      title:
        type: string
    required:
      - path
      - title

JSON Format

{
                "output_file_in_object": {
                    "properties": {
                        "prop1": {"properties": {"path": "pathstring", "title": "titlestring"}}
                    }
                }
            }

How it appears in file backend once reported:

default_pipeline_name:
  project: {}
  sample:
    constant_record_id:
      output_file_in_object:
        properties:
          prop1:
            properties:
              path: pathstring
              title: titlestring
      pipestat_created_time: '2024-04-04 09:07:51'
      pipestat_modified_time: '2024-04-04 09:07:51'

You can use retrieve_one.

result = psm.retrieve_one(record_identifier=REC_ID). The returned result will look like:

image

donaldcampbelljr commented 3 months ago

I added a bit of clarity to the docs when doing the v0.9.0 pipestat release, so I will close this issue for now.