Phenoml Logo

Workflow

Create and execute clinical workflows. Define workflow logic and test execution with sample data.

GET/workflows

Retrieves all workflow definitions for the authenticated user

Input
verbosequerytrue
Result
Success
Successfully retrieved workflows

550e8400-e29b-41d4-a716-446655440001

Patient Data Mapping Workflow

Given diagnosis data, find the patient and create condition record

2024-01-15T10:30:00Z

2024-01-15T15:45:00Z

POST/workflows

Creates a new workflow definition with graph generation from workflow instructions

Create a workflow that maps external patient data into FHIR resources

Input
name: Patient Data Mapping Workflowpatient last name: Rippinpatient first name: Claydiagnosis code: I10encounter date: 2024-01-15fhir provider id: 550e8400-e29b-41d4-a716-446655440000
Result
success
Success
messageWorkflow created successfully
workflow_id7a8b9c0d-1234-5678-abcd-ef9876543210
workflow
id7a8b9c0d-1234-5678-abcd-ef9876543210
namePatient Data Mapping Workflow
workflow_instructions

Given diagnosis data, find the patient and create a condition record linked to their encounter

sample_data
patient_last_nameRippin
patient_first_nameClay
diagnosis_codeI10
encounter_date2024-01-15
created_at2024-01-15T09:30:00Z
updated_at2024-01-15T09:30:00Z
GET/workflows/{id}

Retrieves a workflow definition by its ID

Input
idpath550e8400-e29b-41d4-a716-446655440000
verbosequerytrue
Result
{
  "success": true,
  "workflow": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Patient Data Mapping Workflow",
    "workflow_instructions": "Given diagnosis data, find the patient and create condition record",
    "sample_data": {
      "diagnosis_code": "I10",
      "diagnosis_date": "2025-01-01",
      "patient_first_name": "Clay",
      "patient_last_name": "Rippin"
    },
    "config": {
      "fhir_provider_ids": [
        "550e8400-e29b-41d4-a716-446655440000"
      ],
      "dynamic_generation": false
    },
    "graph": {
      "steps": [
        {
          "id": "step_1_id",
          "name": "Find Patient",
          "description": "Search for an existing patient by first name and last name",
          "type": "search",
          "provider_id": "550e8400-e29b-41d4-a716-446655440000"
        }
      ]
    },
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T15:45:00Z"
  },
  "workflow_details": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Patient Data Mapping Workflow",
    "workflow_instructions": "Given diagnosis data, find the patient and create condition record",
    "sample_data": {
      "diagnosis_code": "I10",
      "diagnosis_date": "2025-01-01",
      "patient_first_name": "Clay",
      "patient_last_name": "Rippin"
    },
    "config": {},
    "graph": {
      "steps": [
        {
          "id": "1",
          "name": "Create Patient Resource",
          "description": "Create a FHIR Patient resource from input data",
          "type": "create",
          "operation": {
            "search_definition": {
              "original_query": "find patient {{patient_first_name}} {{patient_last_name}} by first name and last name",
              "resource_type": "Patient",
              "search_parameters": {
                "family": "{{patient_last_name}}",
                "given": "{{patient_first_name}}"
              },
              "required_fields": [
                "id",
                "name",
                "identifier"
              ],
              "runtime_placeholders": {
                "{{patient_first_name}}": "input.patient_first_name",
                "{{patient_last_name}}": "input.patient_last_name"
              }
            },
            "create_definition": {
              "original_description": "create condition with diagnosis code {{diagnosis_code}} and diagnosis date 2025-01-01",
              "resource_type": "Condition",
              "resource_template": {
                "resourceType": "Condition",
                "code": {
                  "coding": [
                    {
                      "code": "{{diagnosis_code}}",
                      "system": "http://hl7.org/fhir/sid/icd-10"
                    }
                  ]
                },
                "subject": {
                  "reference": "Patient/{{step_1_id}}"
                }
              },
              "runtime_placeholders": {
                "{{diagnosis_code}}": "input.diagnosis_code",
                "{{diagnosis_date}}": "input.diagnosis_date"
              }
            },
            "workflow_definition": {
              "workflow_id": "550e8400-e29b-41d4-a716-446655440002",
              "input": {
                "patient_id": "{{step_1_id}}",
                "additional_context": "laboratory_results"
              },
              "runtime_placeholders": {
                "{{step_1_id}}": "step_1.result.id",
                "{{patient_data}}": "input.patient_data"
              }
            },
            "decision_definition": {
              "expression": "input.patient_age >= 18",
              "paths": {
                "true": "step_adult_workflow",
                "false": "step_pediatric_workflow",
                "default": "step_error_handler"
              },
              "runtime_placeholders": {
                "{{patient_age}}": "input.patient_age",
                "{{diagnosis_type}}": "step_2.result.diagnosis_category"
              }
            }
          },
          "provider_id": "550e8400-e29b-41d4-a716-446655440000",
          "dependencies": [],
          "dynamic_generation": false
        }
      ]
    },
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T15:45:00Z"
  }
}
PUT/workflows/{id}

Updates an existing workflow definition

Input
name: Updated Patient Data Mapping Workflowpatient last name: Smithpatient first name: Johndiagnosis code: E11fhir provider id: 550e8400-e29b-41d4-a716-446655440000dynamic generation: false
Result
{
  "success": true,
  "message": "Successfully updated workflow",
  "workflow": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Patient Data Mapping Workflow",
    "workflow_instructions": "Given diagnosis data, find the patient and create condition record",
    "sample_data": {
      "diagnosis_code": "I10",
      "diagnosis_date": "2025-01-01",
      "patient_first_name": "Clay",
      "patient_last_name": "Rippin"
    },
    "config": {
      "fhir_provider_ids": [
        "550e8400-e29b-41d4-a716-446655440000"
      ],
      "dynamic_generation": false
    },
    "graph": {
      "steps": [
        {
          "id": "step_1_id",
          "name": "Find Patient",
          "description": "Search for an existing patient by first name and last name",
          "type": "search",
          "provider_id": "550e8400-e29b-41d4-a716-446655440000"
        }
      ]
    },
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T15:45:00Z"
  },
  "workflow_details": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Patient Data Mapping Workflow",
    "workflow_instructions": "Given diagnosis data, find the patient and create condition record",
    "sample_data": {
      "diagnosis_code": "I10",
      "diagnosis_date": "2025-01-01",
      "patient_first_name": "Clay",
      "patient_last_name": "Rippin"
    },
    "config": {},
    "graph": {
      "steps": [
        {
          "id": "1",
          "name": "Create Patient Resource",
          "description": "Create a FHIR Patient resource from input data",
          "type": "create",
          "operation": {
            "search_definition": {
              "original_query": "find patient {{patient_first_name}} {{patient_last_name}} by first name and last name",
              "resource_type": "Patient",
              "search_parameters": {
                "family": "{{patient_last_name}}",
                "given": "{{patient_first_name}}"
              },
              "required_fields": [
                "id",
                "name",
                "identifier"
              ],
              "runtime_placeholders": {
                "{{patient_first_name}}": "input.patient_first_name",
                "{{patient_last_name}}": "input.patient_last_name"
              }
            },
            "create_definition": {
              "original_description": "create condition with diagnosis code {{diagnosis_code}} and diagnosis date 2025-01-01",
              "resource_type": "Condition",
              "resource_template": {
                "resourceType": "Condition",
                "code": {
                  "coding": [
                    {
                      "code": "{{diagnosis_code}}",
                      "system": "http://hl7.org/fhir/sid/icd-10"
                    }
                  ]
                },
                "subject": {
                  "reference": "Patient/{{step_1_id}}"
                }
              },
              "runtime_placeholders": {
                "{{diagnosis_code}}": "input.diagnosis_code",
                "{{diagnosis_date}}": "input.diagnosis_date"
              }
            },
            "workflow_definition": {
              "workflow_id": "550e8400-e29b-41d4-a716-446655440002",
              "input": {
                "patient_id": "{{step_1_id}}",
                "additional_context": "laboratory_results"
              },
              "runtime_placeholders": {
                "{{step_1_id}}": "step_1.result.id",
                "{{patient_data}}": "input.patient_data"
              }
            },
            "decision_definition": {
              "expression": "input.patient_age >= 18",
              "paths": {
                "true": "step_adult_workflow",
                "false": "step_pediatric_workflow",
                "default": "step_error_handler"
              },
              "runtime_placeholders": {
                "{{patient_age}}": "input.patient_age",
                "{{diagnosis_type}}": "step_2.result.diagnosis_category"
              }
            }
          },
          "provider_id": "550e8400-e29b-41d4-a716-446655440000",
          "dependencies": [],
          "dynamic_generation": false
        }
      ]
    },
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T15:45:00Z"
  }
}
DELETE/workflows/{id}

Deletes a workflow definition by its ID

Input
idpath550e8400-e29b-41d4-a716-446655440000
Result
success
Success
messageSuccessfully deleted workflow
POST/workflows/{id}/execute

Executes a workflow with provided input data and returns results

Run a workflow against the FHIR server

Input
idpath7a8b9c0d-1234-5678-abcd-ef9876543210
Result
{
  "success": true,
  "message": "Workflow executed successfully",
  "results": {
    "steps": {
      "step_1_id": {
        "type": "search_result",
        "original_query": "find patient by first name Mary and last name Johnson",
        "resource_type": "Patient",
        "search_params": {
          "family": "Johnson",
          "given": "Mary"
        },
        "results": [
          {
            "resourceType": "Patient",
            "id": "patient-123",
            "name": [
              {
                "family": "Johnson",
                "given": [
                  "Mary"
                ],
                "use": "usual"
              }
            ],
            "gender": "female",
            "birthDate": "1961-01-01"
          }
        ]
      },
      "step_2_id": {
        "type": "create_result",
        "id": "condition-456",
        "resource_type": "Condition",
        "original_desc": "create condition with diagnosis code M79.3 for the patient from step_1_id",
        "preview": false,
        "created_resource": {
          "resourceType": "Condition",
          "id": "condition-456",
          "clinicalStatus": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                "code": "active"
              }
            ]
          },
          "code": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/sid/icd-10",
                "code": "M79.3",
                "display": "Panniculitis, unspecified"
              }
            ]
          },
          "subject": {
            "reference": "Patient/patient-123"
          }
        }
      }
    }
  },
  "preview": false
}
Terms of Service|Privacy Policy