Create and execute PhenoML workflows for healthcare data processing, including condition creation from clinical notes and patient registration with deduplication
Creates and executes PhenoML workflows for healthcare data processing, including condition creation from clinical notes and patient registration with deduplication. Use when users want to set up a new PhenoML workflow from scratch or process clinical notes into FHIR Condition resources.
/plugin marketplace add PhenoML/phenoml-skills/plugin install phenoml-workflow@phenoml-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/check_env.pyscripts/create_workflow.pyscripts/setup_fhir_provider.pyscripts/test_workflow.pyThis skill provides an end-to-end guided experience for creating and testing PhenoML workflows. The skill walks users through the complete workflow setup process using executable scripts.
Use this skill when users want to:
This skill provides a step-by-step interactive experience where the skill gathers information from the user conversationally, then executes reusable Python scripts with that information to create and test workflows.
Step 0: Ensure Dependencies are Installed
pip install python-dotenv phenoml
Step 1: Check FHIR Provider Setup
check_env.py (search for it using glob **/check_env.py) to check credentials and detect instance typecheck_env.py to verify credentialsFHIR_PROVIDER_BASE_URL=https://api.medplum.com/fhir/R4FHIR_PROVIDER_BASE_URL=https://api.preview.platform.athenahealth.com/fhir/r4FHIR_PROVIDER_BASE_URL=https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4FHIR_PROVIDER_BASE_URL=https://fhir-myrecord.cerner.com/r4/[tenant-id]setup_fhir_provider.py to create the providercheck_env.py to verify FHIR_PROVIDER_ID is setStep 2: Gather Workflow Requirements
Step 3: Refine Workflow Description
Step 4: Create the Workflow
create_workflow.py with CLI arguments:
--name "Workflow Name"--instructions "workflow instructions..."--sample-data '{"key": "value"}'--dynamic-generation trueStep 5: Test the Workflow
test_workflow.py with CLI arguments:
--input-data '{"patient_last_name": "Smith", ...}'**/phenoml-workflow/scripts/*.py, then execute them with appropriate CLI arguments--env-file /path/to/user/project/.env to ensure the scripts find the correct .env file (use the user's current working directory)Important:
**/phenoml-workflow/scripts/*.py to find the correct path.--env-file pointing to the user's project .env file (their current working directory).Purpose: Safely verifies which environment variables are set without exposing their values
How it works:
Usage:
# Check all credentials (pass user's .env path)
python3 /path/to/check_env.py --env-file /user/project/.env
# JSON output only
python3 /path/to/check_env.py --env-file /user/project/.env --json
# Verbose output (formatted + JSON)
python3 /path/to/check_env.py --env-file /user/project/.env --verbose
Security:
Outputs:
Purpose: Creates a FHIR provider using credentials from .env
How it works:
Usage:
# Create provider using .env credentials
python3 /path/to/setup_fhir_provider.py --env-file /user/project/.env
# With custom name and provider type
python3 /path/to/setup_fhir_provider.py --env-file /user/project/.env --name "My FHIR Server" --provider athena
Required .env variables:
Example FHIR_PROVIDER_BASE_URL values:
https://api.medplum.com/fhir/R4https://api.preview.platform.athenahealth.com/fhir/r4https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4https://fhir-myrecord.cerner.com/r4/[tenant-id]Optional .env variables:
Outputs:
Purpose: Creates a PhenoML workflow from .env or CLI arguments
How it works:
Usage:
# Create workflow with CLI arguments (recommended)
python3 /path/to/create_workflow.py \
--env-file /user/project/.env \
--name "Extract Conditions" \
--instructions "You are a helpful agent who..." \
--sample-data '{"patient_last_name": "Smith", "diagnosis_text": "Patient presents with generalized anxiety disorder"}' \
--dynamic-generation true
# Create workflow using .env variables
python3 /path/to/create_workflow.py --env-file /user/project/.env
Required:
Optional .env variables:
Outputs:
Purpose: Tests a workflow with test data from CLI arguments, .env, or JSON file
How it works:
Usage:
# Test with CLI arguments (recommended)
python3 /path/to/test_workflow.py \
--env-file /user/project/.env \
--input-data '{"patient_last_name": "Rippin", "patient_first_name": "Clay", "diagnosis_text": "generalized anxiety disorder"}'
# Test with JSON file
python3 /path/to/test_workflow.py \
--env-file /user/project/.env \
--input-file test_data.json
# Save results to file
python3 /path/to/test_workflow.py \
--env-file /user/project/.env \
--input-data '{"patient": "Smith"}' \
--output-file results.json
Required:
Outputs:
When a user asks to "create a workflow to process clinical notes", follow this flow:
Locate the Scripts:
**/phenoml-workflow/scripts/*.py to find all available scriptsCheck Prerequisites and Detect Instance Type:
check_env.py to verify credentials and detect instance typeHandle FHIR Provider Based on Instance Type:
If SHARED EXPERIMENT detected (experiment.app.pheno.ml):
If on a DEDICATED INSTANCE (e.g., acme.app.pheno.ml):
If NO - Set Up Provider (dedicated instance only):
check_env.py to verify FHIR credentialsFHIR_PROVIDER_BASE_URL=https://api.medplum.com/fhir/R4FHIR_PROVIDER_BASE_URL=https://api.preview.platform.athenahealth.com/fhir/r4FHIR_PROVIDER_BASE_URL=https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4FHIR_PROVIDER_BASE_URL=https://fhir-myrecord.cerner.com/r4/[tenant-id]setup_fhir_provider.pyIf YES - Verify Provider (dedicated instance only):
check_env.py to verify FHIR_PROVIDER_ID is setsetup_fhir_provider.pyGather Workflow Requirements:
Create the Workflow:
create_workflow.py with CLI arguments (always include --env-file):python3 /path/to/create_workflow.py \
--env-file /user/project/.env \
--name "Workflow Name" \
--instructions "Detailed instructions..." \
--sample-data '{"key": "value"}' \
--dynamic-generation true
Test the Workflow:
test_workflow.py with CLI arguments (always include --env-file):python3 /path/to/test_workflow.py \
--env-file /user/project/.env \
--input-data '{"patient_last_name": "Smith", ...}'
Follow-Up:
{
"patient_last_name": "Smith",
"patient_first_name": "John",
"diagnosis_text": "patient presents with generalized anxiety disorder"
}
{
"last_name": "Johnson",
"first_name": "Sarah",
"dob": "1985-05-15",
"gender": "female",
"identifier": "PAT001234"
}
Before creating workflows, ensure you have:
pip install python-dotenv phenomlFirst, create a .env file with PhenoML and FHIR provider credentials:
# PhenoML credentials
PHENOML_USERNAME=your_username
PHENOML_PASSWORD=your_password
PHENOML_BASE_URL=your_base_url
# FHIR Provider credentials
FHIR_PROVIDER_BASE_URL=https://api.medplum.com/fhir/R4
FHIR_PROVIDER_CLIENT_ID=your_client_id
FHIR_PROVIDER_CLIENT_SECRET=your_client_secret
Example FHIR_PROVIDER_BASE_URL values:
https://api.medplum.com/fhir/R4https://api.preview.platform.athenahealth.com/fhir/r4https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4https://fhir-myrecord.cerner.com/r4/[tenant-id]from phenoml import Client
from dotenv import load_dotenv
import os
# Load environment
load_dotenv()
client = Client(
username=os.getenv("PHENOML_USERNAME"),
password=os.getenv("PHENOML_PASSWORD"),
base_url=os.getenv("PHENOML_BASE_URL")
)
# Create FHIR provider
fhir_provider = client.fhir_provider.create(
name="Your FHIR Server",
provider="medplum", # or other provider type
auth_method="client_secret",
base_url="https://your-fhir-server.com/fhir/R4",
client_id="your-client-id",
client_secret="your-client-secret"
)
provider_id = fhir_provider.data.id
# For condition creation
workflow = client.workflows.create(
name="Extract Conditions from Notes",
workflow_instructions=""" You are a helpful agent who can create new condition resources from data inputs whether they are in natural language or structured data. First find the patient identifier based on the name of the patient provided. Then create a new condition resource with a full description of the condition and the patient identifier.""",
sample_data={
"patient_last_name": "Rippin",
"patient_first_name": "Clay",
"diagnosis_text": "Patient presents with generalized anxiety disorder"
},
fhir_provider_id=provider_id,
verbose=False,
dynamic_generation=True
)
workflow_id = workflow.workflow_id
# For patient registration
workflow = client.workflows.create(
name="Register New Patient",
workflow_instructions="""You are a helpful agent who can create new patients in the fhir server if they do not already exist. First find the patient identifier based on the first and last name of the patient provided. If no patient identifier is found then create a new patient resource using the first name, last name, and any other relevant information you have. If the patient identifier is found then do nothing.""",
sample_data={
"last_name": "Smith",
"first_name": "John",
"dob": "1990-01-01",
"gender": "male",
"identifier": "PAT123"
},
fhir_provider_id=provider_id,
verbose=False,
dynamic_generation=False
)
workflow_id = workflow.workflow_id
# Execute with real data
result = client.workflows.execute(
id=workflow_id,
input_data={
"patient_last_name": "Wilson",
"patient_first_name": "Emma",
"diagnosis_text": "Patient presents with generalized anxiety disorder"
}
)
Use Condition Creation when:
Use Patient Registration when:
Always include proper error handling:
try:
workflow_id = client.workflows.create(...)
print(f"✅ Workflow created: {workflow_id}")
except Exception as e:
print(f"❌ Failed to create workflow: {e}")
try:
result = client.workflows.execute(id=workflow_id, input_data=data)
print("✅ Workflow executed successfully")
except Exception as e:
print(f"❌ Workflow execution failed: {e}")
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.