sartography / cr-connect

0 stars 0 forks source link

get_spec() Script #613

Closed calexh-sar closed 2 years ago

calexh-sar commented 2 years ago

Similar to get_spec_from_workflow_id(), get_spec() would use the Workflow Spec ID, e.g., get_spec('personnel') could return details about the personnel spec, in a way that would not break.

In a Slack chat about this, @danfunk said: We could even get details about the current workflow on the study created from the spec, in such a call, so if it changed from 4001 to 11020, it wouldn't matter.

calexh-sar commented 2 years ago

@cullerton what is the name of this script? I tried get_spec_from_spec_id() and get_spec(), each got the same error that the script did not exist.

calexh-sar commented 2 years ago

Hey @cullerton get_spec_from_workflow_id() returned a numeric value for category_id:

{
    'category_id': 55,
    'standalone': False,
    'library': False,
    'is_master_spec': False,
    'category': {'id': 55, 'display_order': 4, 'display_name': 'Admin Sandbox', 'admin': True},
    'id': 'mike_test',
    'description': 'Test',
    'parents': [],
    'display_name': 'Mike Test',
    'display_order': 2,
    'libraries': [{'id': 'multiply', 'display_name': 'Multiply'}]}

and get_spec_from_id returns an alpha value:

  "get_spec_from_id": {
    "is_master_spec": false,
    "description": "Edit Personnel entered in Protocol Builder information.",
    "library": false,
    "is_review": false,
    "primary_process_id": "Process_Personnel",
    "id": "personnel",
    "display_order": 0,
    "display_name": "Personnel",
    "primary_file_name": "irb_api_personnel.bpmn",
    "category_id": "core_information",
    "libraries": [
      "metrics",
      "core"
    ],
    "standalone": false
  }

I had keyed everything off the previous numeric value. I can change this, but just wanted to make sure that the current alpha value is correct and won't change before I do.

cullerton commented 2 years ago

The category_id is a string now. You can see this if you add a new category. We build the category_id from the display name. (We do the lower case, no spaces dance) Also, get_spec_from_workflow_id should return a string now too.