Installation

Install the screen template by running the following command:

npx shadcn add https://registry.samplehc.com/r/document-splitting.json

The screen file will be added at screens/document-splitting-screen.tsx.

Usage

Required Props

NameTypeDescription
resultIdstringThe async result ID returned from a split document API call

Example

workflow.py
from workflows_py.workflow import ScreenStep, Step, Workflow
from client_manager import SampleHealthcareClient

workflow = Workflow(...)

def split_document(ctx):
    client = SampleHealthcareClient()
    response = client.v2.documents.split(
        document=ctx.get_step_result("document-upload")["document"],
    )
    return response.async_result_id

workflow.then(
  # See: Document Upload Screen template
  ScreenStep( 
    "document-upload",
    screen_path="./screens/document-upload-screen.tsx",
  )
).then(
  Step(
    "split-document",
    split_document,
  )
)
.then(
    ScreenStep(
        "document-splitting",
        screen_path="./screens/document-splitting-screen.tsx",
        get_props=lambda ctx: {"resultId": ctx.get_step_result("split-document")},
    )
)

Returns

The screen returns information about the documents created from the split:

NameTypeDescription
documentsarrayArray of document objects created from the splits
documents[].idstringUnique identifier for the created document
documents[].fileNamestringName of the created document file
documents[].startPageInclusivenumberFirst page of the document (inclusive)
documents[].endPageInclusivenumberLast page of the document (inclusive)

Preview