/EPCIS-IoT-detection-mechanism

Python3.x based automated script to detect changes in MongoDB for incoming EPC documents, obtain IoT information based on meta-data and send relevant data to a Blockchain API

Primary LanguagePythonMIT LicenseMIT

EPCIS-IoT-detection-mechanism

Python3.x based automated script to detect changes in MongoDB for incoming EPC documents, obtain IoT information based on meta-data and send relevant data to a Blockchain API.

System Requirements

  • DocumentDB: MongoDB 4.x
  • SensorDB: InfluxDB 1.7.x
  • Blockchain API: Standard RESTful service to communicate with Blockchain
  • python3.x

System Notes

DocumentDB:

  • The MongoDB needs to be configured to be a Replica Set. A single instance of MongoDB can become the Primary instance. Reference
  • Once the Replica Set is configured the script will use the Change Streams to detect incoming EPC documents. Reference

SensorDB:

  • For system setup refer to the following libraries:

    1. EPCIS-IoT-Arduino: Programming Sensor Nodes to send BME280 Environmental values to an MQTT broker
    2. EPCIS-IoT-Parser: Parsing Script to provision the insertion of meta-data from EPC documents and IoT Data into SensorDB

Management:

In order to connect to the DocumentDB for combination of EPCIS-IoT Application use the following libraries:

  1. epcis-iot-backend: GraphQL CRUD Backend to associate EPC data with IoT Data
  2. ng-epcis-iot: Angular and Apollo Client based Frontend to connect to epcis-iot-backend

Blockchain & Data Validation:

The solution is part of the NIMBLE-Project

Development

  • Develop using as virtual environment

      python -m venv venv
    
  • Activate the Virtual Environment

    Windows

      /venv/Scripts/activate.ps1
    

    Linux

      . venv/bin/activate
    
  • Install the dependencies using:

    pip install -r requirements.txt
    
  • Adapt the config.toml file with settings for all Databases

  • Execute the app using:

    python main.py
    

Development using Docker

  • Update the image using:

      docker build -t epcis-iot-detection .
    

Deployment using Docker

  1. Create a config.production.toml with your production parameters in it.

  2. Execute the following in the Terminal where the config.production.toml file exists:

     docker run --name="epcis-iot-detection" -v $(pwd)/config.production.toml:/app/config.toml:ro \
     --net=host --restart=always shantanoodesai/epcis-iot-detection:latest
    
  3. Track the log files using:

     docker logs -f epcis-iot-detection