Optional URL Parameters
When you define in Portal Builder an "External Page" tab, the URL you set there can be dynamic. BioT enables you to embed dynamic parameters within the URLs specified for "External Page" tabs.
Specifying parameters
To include dynamic parameters within URLs, enclose them within double curly braces {{parameter_name}}.
For example:
https://example.com/{{my_param1}}?name={{my_param2}}
BioT will attempt to resolve these parameters against the relevant context entity.
If resolution is not possible, BioT will pass 'blank' instead of the parameter value.
3 parameters: User, Entity & Entity Type
JSON Name | Description | Comment |
---|---|---|
user | Data about the current logged in user | Always exists |
entityType | Describes the type of entity to expect under the entity attribute. | Only exists when the iFrame is embedded under another entity |
entity | Data about the current entity on screen. | Only exists when the iFrame is embedded under another entity |
Accessing user attributes
For any view in any of BioT's portals, the following user attributes are available:
- _accessToken
- _refreshToken
- _id
- _userType
- _ownerOrganizationId
- _templateName
Accessing entity attributes
Context passed from expanded views (views ending in "Add, Edit, Expand" in Portal Builder) includes an additional variable, "entity," along with all its attributes.
Note that the resolved parameters names are case sensitive.
Examples
Opening a custom tab in the main window will send the embedded iFrame the following object:
{
"user": {
"_id":"7971939b-e005-4d90-9019-f660c66eb7b2",
"_userType":"organization-user",
"_ownerOrganizationId":"00000000-0000-0000-0000-000000000000",
"_templateName":"Clinician",
"_accessToken":"eyJhbGciOiJSUzUxMiJ9...",
"_refreshToken":"eyJhbGciOiJSUzUxMiJ9..."
}
}
While opening a custom tab in a patient entity will send the embedded iFrame the following object:
{
"user": {
"_id":"7971939b-e005-4d90-9019-f660c66eb7b2",
"_userType":"organization-user",
"_ownerOrganizationId":"00000000-0000-0000-0000-000000000000",
"_templateName":"Clinician",
"_accessToken":"eyJhbGciOiJSUzUxMiJ9...",
"_refreshToken":"eyJhbGciOiJSUzUxMiJ9..."
},
"entityType":"patient",
"entity":{
"_name":{
"firstName":"Patient",
"lastName":"Zero"
},
"_id":"c5b53c05-cef2-403d-aa25-51fb0a555591",
"_description":"patient",
"_email":"[email protected]",
"_phone":"+125XXXXXXXX",
"_locale":"en-us",
"_gender":"MALE",
"_dateOfBirth":"1985-11-11",
"_address":{
"countryCode":"US",
"state":null,
"city":null,
"zipCode":null,
"address1":null,
"address2":null
},
"_caregiver": {
"id": "1f22bd65-73de-4e78-b005-07b92df54bdc",
"templateId": "336ad952-5261-48b5-918f-0d5aef03dced",
"templateName": "Clinician",
"name": "Caregiver 98 (00516)"
},
//....
}
}
In the latter case, if we would like to set the following parameters as query parameters:
- The current entity type
- Entity first name
- Entity last name
- Logged in user template name
We can access them like this:
Current entity type: {{entityType}}
First name: {{entity._name.firstName}}
Last name: {{entity._name.lastName}}
Logged in user template name: {{user._templateName}}
And a possible URL construction would be:
https://example.com?eType={{entityType}}&fName={{entity._name.firstName}}&lName={{entity._name.lastName}}&template={{user._templateName}}
Finally BioT will initiate an HTTPS request to:
GET https://example.com?eType=patient&fName=Patient&lName=Zero&template=Clinician
Nested entities
BioT's functionality does not extend to the resolution of nested entities. This means that attributes residing within entities linked to the context entity, such as a device entity referenced by a patient entity, cannot be directly accessed.
Updated 4 months ago