Skip to main content

A Django App to manage a Fiware Orion context broker entities as Django Model Objects.

Install

In order to intall simply use pip

pip install django_orion_model

Usage

Simply add django_orion_model to your settings.py:

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
    ...
'django_orion_model',
    ...
]

ORION_URL = "https://yourorion:1234"
ORION_SCOPE = "/desiredscope"
ORION_EXPIRATION = 200 // living time of local values

To define a Entity Model simply define a class in your models.py Using OrionEntity as Class father and use Orion fields to properties expected to live in the context broker.

from django_orion_model import OrionEntityi

class WasteManagementStage(OrionEntity):
    name = OrionCharField("name", max_length=1024, blank=True)
    description = OrionTextField("description", max_length=1024, blank=True)

Available Field types for Orion Context ContextBroker:

  • OrionCharField
  • OrionTextField
  • OrionFloatField
  • OrionDateTimeField

An orion entity have a Default Field to manage Communication With Orion:

  • context_broker(ForeingKey-ContextBroker): The Orion Context ContextBroker that manages the entity
  • service_path(ForeingKey-Scope): The service-path where the entity lies.
  • orion_id(CharField): The ID of the entity in Orion.
  • type(CharField): The type of the entity in Orion.
  • data(JSONField): A local repository of the last known values of the entity.
  • updated(ArrayField-CharField): The name of the Orion field updates since las connection.
  • expiration(DateTimeField): The time when the local data is considered obsolete.
  • status(CharField): A predefined text that indicates the communication. Expected values:
    • OK Everything is OK and up to date
    • OFFLINE Set to Disable communication to Orion
    • MISSING Indicates that the Entity not exist in Orion
    • CREATING Set to Create the entity into Orion.
    • CREATED Indicates that the entity is created but is values are not yet pulled from Orion(Transitory)
    • PENDING_WRITING Indicates that the entity is performing a push to Orion(Transitory).
    • PENDING_READING Indicates that the entity is performing a pull to Orion(Transitory).
    • AWAIT_REFRESH The pull has failed and the entity is expecting a new opportunity to retry.
    • AWAIT_REWRITING The push has failed and the entity is expecting a new opportunity to retry.
  • error(TextField): IF the connection have a problem the Orion response is stored here.

Entity Behaivour

The entity is expected to pull values from Orion after its creation, when an orion attributes is read and expiration time is up, before saving to database and after values are updated to orion. The entity is expected to push values to Orion after a Orion values is Set.

Some status Values forces Some behavior:

  • OFFLINE Set to Disable communication to Orion
  • CREATING Set to Create the entity into Orion.

This library is partially funded by the Waste4Think proyect that has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreement 688995. The dissemination of results herein reflects only the author’s view and the European Commission is not responsible for any use that may be made of the information it contains.

Metadata

Release files for django-orion-model 0.92

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-orion-model 0.92
File Size Uploaded
django-orion-model-0.92.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-orion-model 0.92
File Interpreter ABI Platform
django_orion_model-0.92-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 29.6 kB

Release files / django-orion-model-0.92.tar.gz

Download URL django-orion-model-0.92.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f40d71029a21e7a13cfcb51e86978072587935177855c972f595cd3035c2a8ed
BLAKE2b-256 checksum
How to use checksums
7d41a9b194b6d6e118fa0e94f5c12411d613db2ed88714e62ed3ee4a0a07751e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.9

Release files / django_orion_model-0.92-py2.py3-none-any.whl

Download URL django_orion_model-0.92-py2.py3-none-any.whl
Size 16.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
679e5997d2b2cdb00e9111b36a5c233ea356ee64107b9db1c2451903ccc184ae
BLAKE2b-256 checksum
How to use checksums
006d7975636a4b350f20071afa7741d5020d18055c65a81ec365ca587288192c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.92 This release

2 release files

0.91

2 release files

0.70

2 release files

0.60

2 release files

0.58

2 release files

0.57

2 release files

0.56

2 release files

0.55

2 release files

0.54

2 release files

0.53

2 release files

0.52

2 release files

0.41

2 release files

0.40

2 release files

0.16

2 release files

0.15

2 release files

0.14

2 release files

0.13

2 release files

0.12

2 release files

0.11

2 release files

0.10

2 release files

0.9.9

1 release file

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.3

2 release files

0.9.1

2 release files

0.9

2 release files

0.4.1

2 release files

0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page