taskengine

package
v0.0.0-...-310d36a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWorkflowNotFound = errors.New("workflow not found")

Functions

func LoadTestQuestionnairesAndHealthcareSevices

func LoadTestQuestionnairesAndHealthcareSevices(t *testing.T, client fhirclient.Client)

Types

type FhirApiQuestionnaireLoader

type FhirApiQuestionnaireLoader struct {
	// contains filtered or unexported fields
}

func (FhirApiQuestionnaireLoader) Load

type FhirApiWorkflowProvider

type FhirApiWorkflowProvider struct {
	Client fhirclient.Client
}

FhirApiWorkflowProvider is a WorkflowProvider queries a FHIR API to provide workflows.

func (FhirApiWorkflowProvider) Provide

func (f FhirApiWorkflowProvider) Provide(ctx context.Context, serviceCode fhir.Coding, conditionCode fhir.Coding) (*Workflow, error)

Provide returns the workflow for a given service and condition. It looks up the workflow through FHIR HealthcareServices in the FHIR API, searching for instances that match:

  • Service code must be present in HealthcareService.category
  • Condition code must be present in the HealthcareService.type

func (FhirApiWorkflowProvider) QuestionnaireLoader

func (f FhirApiWorkflowProvider) QuestionnaireLoader() QuestionnaireLoader

type MemoryWorkflowProvider

type MemoryWorkflowProvider struct {
	// contains filtered or unexported fields
}

MemoryWorkflowProvider is a WorkflowProvider that uses in-memory FHIR resources to provide workflows. To use this provider, you must first load the resources using LoadBundle.

func (*MemoryWorkflowProvider) Load

func (e *MemoryWorkflowProvider) Load(ctx context.Context, questionnaireUrl string) (*fhir.Questionnaire, error)

func (*MemoryWorkflowProvider) LoadBundle

func (e *MemoryWorkflowProvider) LoadBundle(ctx context.Context, bundleUrl string) error

LoadBundle fetches the FHIR Bundle from the given URL and adds the contained Questionnaires and HealthcareServices to the provider. They can then be used to provide workflows.

func (*MemoryWorkflowProvider) Provide

func (e *MemoryWorkflowProvider) Provide(ctx context.Context, serviceCode fhir.Coding, conditionCode fhir.Coding) (*Workflow, error)

func (*MemoryWorkflowProvider) QuestionnaireLoader

func (e *MemoryWorkflowProvider) QuestionnaireLoader() QuestionnaireLoader

type QuestionnaireLoader

type QuestionnaireLoader interface {
	// Load a questionnaire from a URL. It returns nil if the URL can't be handled by the loader (e.g. file does not exist), or an error if something went wrong (e.g. read or unmarshal error).
	Load(ctx context.Context, url string) (*fhir.Questionnaire, error)
}

type TestQuestionnaireLoader

type TestQuestionnaireLoader struct {
}

func (TestQuestionnaireLoader) Load

type TestWorkflowProvider

type TestWorkflowProvider map[string]map[string]Workflow

TestWorkflowProvider is an in-memory WorkflowProvider. It's a map of a care service (e.g. Telemonitoring, http://snomed.info/sct|719858009), to conditions (e.g. COPD, http://snomed.info/sct|13645005) and their workflows.

func DefaultTestWorkflowProvider

func DefaultTestWorkflowProvider() TestWorkflowProvider

func (TestWorkflowProvider) Provide

func (m TestWorkflowProvider) Provide(_ context.Context, serviceCode fhir.Coding, conditionCode fhir.Coding) (*Workflow, error)

func (TestWorkflowProvider) QuestionnaireLoader

func (m TestWorkflowProvider) QuestionnaireLoader() QuestionnaireLoader

type Workflow

type Workflow struct {
	Steps []WorkflowStep
}

func (Workflow) Proceed

func (w Workflow) Proceed(previousQuestionnaireRef string) (*WorkflowStep, error)

func (Workflow) Start

func (w Workflow) Start() WorkflowStep

type WorkflowProvider

type WorkflowProvider interface {
	// Provide returns the workflow for a given service and condition.
	// If no workflow is found, an error is returned.
	Provide(ctx context.Context, serviceCode fhir.Coding, conditionCode fhir.Coding) (*Workflow, error)
	QuestionnaireLoader() QuestionnaireLoader
}

WorkflowProvider provides workflows (a set of questionnaires required for accepting a Task) to the Task Filler.

type WorkflowStep

type WorkflowStep struct {
	QuestionnaireUrl string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL