Sign inSign up

beetaone/data-converter

By beetaone

Updated almost 2 years ago

Image
0

295

beetaone/data-converter repository overview

Data Converter

NameData Converter
Versionv1.0.3
DockerHubdata-converter
AuthorsGhassen Barbouchi

Table of Content


Description

The function of this module is to convert the selected input of the previous module to another type. Available options are hex string, int, ieee754 float, text, and data can be converted from and to those types.

Features
  1. Detect the value to convert from the incoming JSON data.
  2. Validate the selected from type.
  3. Convert the detected value from selected input Type to selected out Type.
  4. Forward the new converted JSON to the next module.

Module Variables

Module Specific
Environment VariablestypeDescription
INPUT_KEYstringInput Key eg "Device.pc.price"
FROM_TYPEstringInput type
TO_TYPEstringOutput type
Set by the beetaone Agent on the edge-node

There are 5 module variables that are required by each module to correctly function within beetaone ecosystem. In development, these variables can overridden for testing purposes. In production, these variables are set by beetaone Agent.

Environment VariablestypeDescription
MODULE_NAMEstringName of the module
MODULE_TYPEstringType of the module (Input, Processing, Output)
LOG_LEVELstringAllowed log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL. Refer to logging package documentation.
INGRESS_HOSTstringHost to which data will be received
INGRESS_PORTstringPort to which data will be received
EGRESS_URLSstringHTTP ReST endpoint for the next module

Dependencies

The following are module dependencies:

  • bottle
  • requests

The following are developer dependencies:

  • pytest
  • flake8
  • black

Input

Input example:

{
"manufacturer" : "beetaone",
"device" :{
"SN" : "1232",
"newobj":{
      "a":12,
      "b":"0xFD"
},
"year" : 2021
}
}

Output

output example in case the input key is : "device.newobj.b" , the fromType :"hex" and the toType :"int"

{
"manufacturer" : "beetaone",
"device" :{
"SN" : "1232",
"newobj":{
      "a":12,
      "b":253
},
"year" : 2021
}
}

Tag summary

Content type

Image

Digest

sha256:db6c6b5e1

Size

49.1 MB

Last updated

almost 2 years ago

docker pull beetaone/data-converter:v1.0.3