Skip to content

Data Adapters

NagaSudhir Pulla edited this page Apr 17, 2020 · 22 revisions

Data Adapters

You can support new data sources in Electron Dashboard via Data Adapters

  • A Data adapter is a plugin to Electron Dashboard through which new data sources can be supported
  • A Data adapter is just a folder with manifest.json file and software files.
  • A snapshot of a sample Data Adapter folder is shown below Data Adapter Folder Snapshot
  • Sample code for a Data Adapter that serves random data is hosted here. You can use this template project to create your own data adapter
  • Code for a Data Adapter plugin that serves time series data from excel files is hosted here.

Manifest file

A sample manifest file can look as shown below

{
    "entry": "ElectronDashboardDummyDataAdapter.exe",
    "name": "DummyData",
    "app_id": "DummyDataAdapter",
    "out_types": ["timeseries"],
    "single_meas": true,
    "multi_meas": false,
    "quality_option": true,
    "is_meas_picker_present": true,
    "is_adapter_config_ui_present": true,
    "is_resampling_present": false
}

The following is the description of the manifest.json file properties

  • entry - Filename of the exe file that will be run Electron Dashboard for fetching data

  • name - A unique name by which the data adapter will be displayed in Electron Dashboard

  • app_id - A unique app_id by which the data adapter folder will be stored in Electron Dashboard's internal folder

  • out_types - Types of data that can be extracted from the data adapter. Currently supports only "timeseries"

  • single_meas - Whether single measurement fetching is supported

  • multi_meas - Whether multiple measurements fetching is supported. Currently not supported

  • quality_option - Whether data quality information can be fetched by the data adapter

  • is_meas_picker_present - Whether measurement picker is provided by the data adapter

  • is_adapter_config_ui_present - Whether data adapter configuration UI is provided by the data adapter

  • is_resampling_present - Whether data adapter supports resampling

How it works

Fetching data from data adapter

  • To fetch data of a measurement Id from data adapter, Electron dashboard will run the following command
DummyDataAdapter.exe --from_time <from_time> --to_time <to_time> --meas_id <meas_id> --resample_period <resample_period> --resampling_strategy <resampling_strategy>

and waits for the result. <meas_id> is the measurement id, <from_time> and <to_time> are the timestamps expressed in UNIX epoch milliseconds, <resample_period> is resample period string in the form of <years>_<months>_<days>_<hrs>_<mins>_<secs>_<millisecs>, <resampling_strategy> can be one of raw,snap,average,max,min,interpolated

  • Data adapter should write the timeseries data string to console as shown below
ts1, val1, ts2, val2, ts3, val3 ...

where ts is timestamp expressed in UNIX epoch milliseconds and val is the numerical value of the data sample.

  • If quality information is required, Electron Dashboard will add the flag --include_quality. For example, if the command

DummyDataAdapter.exe --from_time <from_time> --to_time <to_time> --meas_id <meas_id> --include_quality

is executed, the expected timeseries data string in the console would be

ts1, val1, qual1, ts2, val2, qual2, ts3, val3, qual3, ...

where qual should be one of the values in 0,1,2,3. Electron interprets them as 0=GOOD, 1=BAD, 2=SUSPECT, 3=REPLACED

Opening Data Adapter configuration UI

When user clicks the Configure adapter button in Data Adapters screen, Electron Dashboard will run the command

DummyDataAdapter.exe --config_adapter

Adapter Config UI

The Data adapter should open its configuration UI by recognizing the argument --config_adapter

Opening Measurement Picker

When user clicks on the measurement picker button in series editing screen, Electron Dashboard runs the following command

DummyDataAdapter.exe --show_meas_picker
  • The Data adapter should open its Measurement Picker UI by recognizing the argument --show_meas_picker
  • After user picks the measurement, the adapter should write a string to the console in the format [measurementId, measurementName, measurementDescription] and close itself. Then Electron Dashboard will do JSON.parse to get the measurement info.