Git Product home page Git Product logo

django-orion-exporter's Introduction

Orion Exporter

This app is responsible to send every X minutes the configures data to Orion Context Broker.

Installation

To install you must add the package `` to your requirements.

Configuration

To set the data that you want to send to OCB you must configure the correspondent data model. The model must inherit the OrionEntity model from this package and the you must set the following property for the model:

Inheritance

from orion_exporter.models import OrionEntity

class Reading(OrionEntity):
    timestamp = models.DateTimeField()

Property

    @property
    def orion_properties(self):
        """Returns orion translation fields"""
        fields = {
            "<field_name>": self.<field_name>
        }
        _type = "<fiware_data_model_type>"

        return _type, fields

Example:

    @property
    def orion_properties(self):
        """Returns orion translation fields and type"""
        fields = {
            "pm10": self.pm10
        }
        _type = "AirQualityObserved"

        return _type, fields

From this point you are ready to send data to OCB. Before you just need to set in your project settings the task to do it:

# Celery settings for tasks scheduling
CELERY_BEAT_SCHEDULE = {
    'export_to_orion': {
        'task': 'orion_exporter.tasks.send_to_orion',
        'schedule': timedelta(seconds=10),
        # 'schedule': crontab(minute='0', hour='0'),
        'options': {'queue': 'orion_exporter'}
    }
}

django-orion-exporter's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.