Plugins
We use plugins to categorize and isolate behavioral and health data in the client platform. For example:
- Physical Data including Weight, Height and Body Mass Index (BMI) is managed by the physical data plugin
- Vital signs including blood pressure, oxygen saturation, etc. is managed by the vitals plugin
- And many data
A plugin is a client-side npm package exporting a custom interface object in its entry point.
#
Plugin ManagerThe client platform has a plugin manager determines all available plugin form the config file and registers them to be used by other components.
#
LifecycleA lifecycle hook is called for each plugin before registration. Here is the main lifecycle:
Get available plugins from the config file
Call
onPreRegisteration
hook for each plugin, if definedRegister plugins in the plugin manager
Render dashboard
Plugins can use this lifecycle hook to import their dependencies, register other plugins, add event listeners, etc.
#
Plugin InterfaceA plugin interface is an object defining the following properties, components and functions:
id
: Plugin ID that must be uniquepath
: URL path to redirect to the plugin main componentname
: Plugin nameMenuModule
: Interface object to show plugin menu itemWidgetModule
: Interface object to show plugin widget in dashboardDataModule
: Interface object to render the plugin main component to manage / visualize plugin dataTimelineModule
: Interface object to show plugin data in timeline that is displayed in dashboard
#
Plugin ModulesPlugins are constructed by modules. All plugins must implement data module and one of menu or widget modules.
#
Menu ModuleMenu modules show plugins in profile menus, using the following properties:
name
: Menu item name to be shown in profile menusicon
: Material icon name to be used as menu item icon in profile menus, as listed herepriority
: Menu item priority in profile menus, higher numbers at the top of the list
#
Widget ModuleWidget modules show plugins in profile menus displayed in the header, using the following properties:
name
: Widget name to be shown in dashboardicon
: Material icon name to be used as widget icon in dashboard, as listed hereComponent
: React component to be shown as widget in dashboard. This is very useful to visualize individual plugin data in dashboard.priority
: Menu item priority in profile menus, higher numbers in the left of the list
caution
Define only one of "Component" or "icon" properties in the widget module!
#
Timeline ModuleTimeline modules provide plugin data to be visualized in dashboard timeline, using an array of objects with the following properties:
name
: Data name to be shown in timelinecolor
: Data color to be shown in timelineicon
: Data icon to be shown in timeline legendgetData
: Function to retrieve timeline data, providing an array of objects with the following properties:date
: Date/Time object of the datavalue
: Number value of the data
The timeline displayed in dashboard is very important component to visualize and compare different plugin data in one place.
important
Plugins should group timeline data on daily basis!
#
Data ModuleData module is a React Component to be rendered when user is redirected by dashboard.