Skip to content

Repository containing the SCRAL core functions as well as implementation of specific adapters for resources integrated along the project.

License

Notifications You must be signed in to change notification settings

MONICA-Project/scral-framework

Repository files navigation

SCRAL - Smart City Resource Adaptation Layer

License Language: Python3

Logo

The Smart City Resource Adaptation Layer (SCRAL) is a framework used in MONICA european project to manage several different kinds of IoT devices.

Getting Started

This file was written to explain how you can run a SCRAL module already developed or how to develop your own.

If you would like to start a ready-to-use SCRAL Docker Container, you can have a look to the quickstart containers that you can find on this Docker Hub repository. SCRAL was tested mainly with Python 3.6 so it is suggested to install at least that version.

How to use SCRAL

        _____ __________  ___    __                                     
       / ___// ____/ __ \/   |  / /                                     
       \__ \/ /   / /_/ / /| | / /                                      
      ___/ / /___/ _, _/ ___ |/ /___                                    
     /____/\____/_/ |_/_/  |_/_____/   Smart City Resource Adaptation Layer

     (c) 2017-2020, LINKS Foundation
     developed by Jacopo Foglietti & Luca Mannella


usage: SCRAL [-h] -p PILOT

arguments:
  -h, --help
        show this help message and exit
  -p PREFERENCES_FOLDER, --preferences PREFERENCES_FOLDER
        the name of the configuration folder

example: start_module.py -p MOVIDA  

Have a look to config folder to find more details about SCRAL configuration parameter.

Examples

To better understand the MONICA environment and the SCRAL framework, you can have a look to the tutorials contained on the official MONICA website. In particular, to start using SCRAL it is suggested to follow this tutorial, meanwhile to start developing your own SCRAL module, you can read this other tutorial.

As you can see in the UML Class diagram, when you start developing a new SCRAL module, it is usually necessary to develop at least two methods, the first one for the registration of new datastreams, and the second one for the management of the Observation. If you will not extend the SCRALRestModule, it will be mandatory also to write your own "runtime" method. UML Diagram

Deployment

To deploy a new SCRAL image, modify to your needs one of the dockerfile already contained in each module folder.

Docker

To start using SCRAL is strongly suggest to take a Docker image "as is" and to configure properly the environmental variables.
An update list of the configurable variable is available in the Docker hub repository.

Prerequisites

Download or Fork SCRAL repository.

The SCRAL source code is available in MONICA project repository. It is possible to fork (or simply download) the repository and start working directly on the source code.

Docker

To start working with SCRAL is necessary to have Docker installed on your machine. To install the proper version for your operating system, have a look to the Docker documentation page.

GOST

SCRAL depends on the GOST server, a Go implementation of the Sensing OGC SensorThings API. To learn more about OGC and GOST visit the GOST GitHub page or the MONICA tutorial about OGC Historical Data Retrieval & Visualizations.

To start GOST, you need the docker-compose file that you can download from GOST repository or the file "docker-compose-gost.yml" contained inside the "docker-compose" folder of SCRAL repository. Once you have the file, from the directory in which the file is stored, you can execute the following command:

$ docker-compose -f docker-compose-gost.yml up -d

Python Packages

To work properly SCRAL requires the following Python packages (with the recommended versions):

Test

SCRAL does not have at the moment a test suite.
Feel free to contribute if you want! :)

Build

SCRAL is mainly written in Python 3 (that is an interpreted language) and so it could just be started without building anything.

Contributing

Contributions are welcome.

Please fork, make your changes, and submit a pull request. For major changes, please open an issue first and discuss it with the other authors.

Licensing

Copyright © 2017-2020 Jacopo Foglietti and Luca Mannella for LINKS Foundation.

SCRAL is licensed under the Apache 2 License (click here for details).

Affiliation

MONICA
This work is supported by the European Commission through the MONICA H2020 PROJECT under grant agreement No 732350.

About

Repository containing the SCRAL core functions as well as implementation of specific adapters for resources integrated along the project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published