Portal Connection (Lite) Workflow
OneRecord Portal Connection Workflow
Overview
The OneRecord Portal Connection Lite Workflow allows a user to request patient records with OneRecord API Integrator Services v0.1.x
.
Usage
To understand how to use this web component, let's first look at integrating a Workflow into a project that does not make use of a frontend framework:
Vanilla JS
// arbitraryJavaScriptFile.js
import '@onerecord/workflows/dist/OneRecordPortalConnectionLiteWorkflow';
const OneRecordPortalConnectionLiteWorkflow = document.querySelector('onerecord-portal-connection-lite-workflow')
// We need to set "properties" via JavaScript
// Set required getAuthorizationHeaderValue callback
OneRecordPortalConnectionLiteWorkflow.getAuthorizationHeaderValue = () => YOUR_AUTHORIZATION_HEADER_VALUE
// Set optional onSuccess callback
OneRecordPortalConnectionLiteWorkflow.onSuccess = (data) => console.log('onSuccess: ', data)
// See "Available Attributes & Properties" for the full list of available properties.
<!-- arbitraryHTMLFile.html -->
<!-- We can set "attributes" directly in the HTML -->
<!-- See "Available Attributes & Properties" for the full list of available attributes. -->
<onerecord-portal-connection-lite-workflow
api-origin="yourapi.com"
code="123ABC"
state="123XYZ">
</onerecord-portal-connection-lite-workflow>
React
import '@onerecord/workflows/dist/OneRecordPortalConnectionLiteWorkflow';
const OneRecordPortalConnectionLiteWorkflow = () => {
const element = useRef(null)
useEffect(() => {
if (elementRef.current) {
elementRef.current.getAuthorizationHeaderValue = () => YOUR_AUTHORIZATION_HEADER_VALUE
}
}, [elementRef.current])
useEffect(() => {
element.current.onSuccess = (data) => console.log('onSuccess: ', data)
}, [element])
return (
<onerecord-portal-connection-lite-workflow
api-origin="yourapi.com"
code="123ABC"
ref={element}
state="123XYZ">
</onerecord-portal-connection-lite-workflow>
)
}
SolidJS
import '@onerecord/workflows/dist/OneRecordPortalConnectionLiteWorkflow';
const getAuthorizationHeaderValue = () => YOUR_AUTHORIZATION_HEADER_VALUE;
const OneRecordPortalConnectionLiteWorkflow = () => {
const onSuccess = (data) => console.log('onSuccess', data);
return (
<onerecord-portal-connection-lite-workflow
attr:api-origin="yourapi.com"
attr:code="123ABC"
attr:state="123XYZ"
prop:getAuthorizationHeaderValue={() => getAuthorizationHeaderValue()}
prop:onSuccess={() => onSuccess()}>
</onerecord-portal-connection-lite-workflow>
)
}
Vue
<template>
<onerecord-portal-connection-lite-workflow
:api-origin.attribute="apiOrigin"
:code.attribute="code"
:code-verifier.attribute="codeVerifier"
:getAuthorizationHeaderValue.prop="getAuthorizationHeaderValue"
:onImport.prop="handleOnImport"
:onSuccess.prop="handleOnSuccess"
:state.attribute="state">
</onerecord-portal-connection-lite-workflow>
</template>
<script lang="ts">
import '@onerecord/workflows/dist/OneRecordPortalConnectionLiteWorkflow';
const getAuthorizationHeaderValue = () => import.meta.env.PUBLIC_AUTHENTICATION_HEADER_VALUE;
const handleOnImport = (data: any) => {
console.log('handleOnImport', data)
}
const handleOnSuccess = (data: any) => {
console.log('handleOnSuccess', data)
}
export default {
data: () => ({
apiOrigin: import.meta.env.PUBLIC_WORKFLOWS_API_ORIGIN,
getAuthorizationHeaderValue,
handleOnImport,
handleOnSuccess
}),
props: {
code: String,
codeVerifier: String,
state: String
},
}
</script>
Available Attributes & Properties
Note that the "Required" attributes and properties are necessary for the Workflow to do anything. The Workflow will be visible without them set, but it will remain in a loading state until it times out and switches to a failure state.
Please view the integration examples above to understand how your framework of choice integrates with web components. Note that web components are a web standard so Workflows will work with any framework, even if not detailed in the integration examples.
Attributes
Name | Required | Description |
---|---|---|
api-origin | ✅ | OneRecord API origin. Limited to same-origin requests. |
code | ✅ | Unique string returned in URL search parameters. |
code-verifier | Unique string returned in URL search parameters. | |
state | ✅ | Unique string returned in URL search parameters. |
Properties
Name | Required | Default | Description |
---|---|---|---|
getAuthorizationHeaderValue | ✅ | () => "" | A function that returns the appropriate Authorization header value for your authentication system |
onAuthenticationFailure | (response) => {} | When a patient records request cannot be authenticated. Returns the response. | |
onAuthenticationSuccess | (response) => {} | When a patient records request has been authenticated. Returns the response. | |
onCancel | () => {} | When a user abandons/exits the session. | |
onDiscardFailure | (organizations) => {} | When a user cannot delete patient records. Returns an array of organizations(s). | |
onDiscardSuccess | (organizations) => {} | When a uses has deleted patient records. Returns an array of organizations(s). | |
onMount | () => {} | When the workflow initializes. | |
onCleanup | () => {} | When the workflow terminates. | |
onFailure | (response) => {} | When a user cannot retrieve patient records. Returns the response. | |
onFetchFailure | (response) => {} | When a user cannot retrieve patient records. Returns the response. | |
onFetchSuccess | (resources) => {} | When a user has retrieved patient records. Returns an array of resource(s). | |
onImport | () => {} | When a user wishes to import patient records to the parent application. | |
onSuccess | (resources) => {} | When a user has retrieved patient records. Returns an array of resource(s). |
References
Resource type
{
resourceType: "string",
id: "string",
identifier: [
{
use: {
coding: [
{
system: "string",
code: "string",
display: "string",
}
],
text: "string",
},
type: "string",
system: "string",
value: "string",
}
],
name: [
{
family: "string",
given: "string",
text: "string",
}
],
telecom: [
{
system: "string",
value: "string",
use: "string",
}
],
status: "string",
patient: {
reference: "string",
display: "string",
},
clinicalStatus: {
coding: [
{
system: "string",
code: "string",
}
]
},
code: {
coding: [
{
system: "string",
code: "string",
}
],
text: "string",
},
onsetDateTime: "date|string",
category: [
{
coding: [
{
system: "string",
code: "string",
display: "string",
}
],
text: "string",
}
],
subject: {
reference: "string",
display: "string",
},
effectiveDateTime: "string",
criticality: "string",
// AllergyIntolerance resourceTypes
recorder: {
reference: "string",
display: "string",
},
reaction: [
manifestation: [
{
coding: [
{
system: "string",
code: "string",
display: "string",
}
],
text: "string",
}
],
severity: "string",
],
// Condition resourceType
verificationStatus: {
coding: [
{
system: "string",
code: "string",
}
],
},
// DocumentReference resourceType
type: {
coding: [
{
system: "string",
code: "string",
display: "string",
}
],
text: "string",
date: "date|string",
},
// DiagnosticReport resourceType
issued: "string",
result: [
{
reference: "string",
display: "string",
}
],
// Immunization resourceType
vaccineCode: {
coding: [
{
system: "string",
code: "string",
display: "string",
}
],
occurrenceDateTime: "date|string",
},
// Overservation resourceType
valueQuantity: {
value: "number|string",
unit: "string",
code: "string",
},
// Procedure resourceType
preformedDateTime: "date|string",
// Patient resourceType
extension: [
{
url: "string",
extension: [
{
url: "string",
valueCoding: {
system: "string",
code: "string",
display: "string",
},
valueString: "string",
}
],
valueCode: "string",
}
],
active: "string",
gender: "string",
birthDate: "string",
address: [
{
line: [],
city: "string",
state: "string",
postalCode: "string",
country: "string",
}
],
communication: [
{
language: {
coding: [
{
display: "string"
}
],
text: "string",
}
}
]
}
Organization
{
name: "string",
city: "string",
state: "string",
zip: "string",
vendor: "string",
endpointStatus: "string",
disposition: "string",
dataType: "string",
derivedAuthUri: "string",
latitude: "number|string",
longitude: "number|string",
location: {
latitude: "number|string",
longitude: "number|string",
},
_id: "string",
parent_org: "string",
}
Updated 3 months ago