Skip to main content

ReMAP SDK for RUL Models

Project description

  1. Introduction

The ReMAP SDK has been created in the context of the ReMAP project inside the WP2, it enables the models created in ReMAP WP5 to use the data coming from the airlines. Only using this SDK the models will be able to has access to this data and the metadata describing the data sources created by the airline staff. This document and the design of the ReMAP SDK has been developed from the requirements collected in the document ReMAP “Datasets for WP5” describing the operations that algorithms within the ReMAP project need to interact with the data. The ReMAP SDK has been developed for python and can be found on the python repository PyPI.

2 SDK Requirements

The ReMAP SDK is writen in python and designed to work inside the ReMAP platform to have access to the data and metadata, it can be used outside this environment, but the files needed for it to work must be provided and the folders structure recreated. A demonstration environment has been developed and is included in the public available python module.

3 SDK Description

The ReMAP SDK has been developed in python following the requirements found for WP5, it can be found on the pip repository for python in the url https://pypi.org/project/remapSDK/. The SDK has a folder structure to content the python code for the SDK python code to test and some data to perform the tests, these files are just for demonstration purposes and the data within this files does not come from any real aircraft component.

3.1. SDK Structure

The ReMAP SDK contains the following folder structure: sdk

remapSDK

|- __init__.py              #packaging file

|- remapSDK.py              #python code

|- data   
                  #data folder
|    |- dataset.csv          #data file in csv format
|    |- metadata.json        #metadata file in json format
|    |- sdk_config.json      #File containing SDK configuration information
|    |- secret               #File containing sdk configuration information

|- demo

|    |- __init__.py             #packaging file
|    |- test_remapSDK.py        #demo code
|    |- testing_env.py          #demonstration environment

|- LICENSE                  #File describing the license for the module

|- README.MD                #Description and usage of the module

|- requirements.txt         #File containing the dependences of the modules

|- setup.py                 #Python packaging information for the module

The SDK download from pip is a reduced version of this floder structure, the most important elements are the python files containing the code of the SDK. The files init.py are packaging requirements for python modules. The tests folder contains the python code to test the SDK and to simulate the ReMAP environment, the testing_env.py file will the files under the data directory to the correct folder which can not be recreated in the SDK structure but are provided by the ReMAP platform environment to the SDK.

3.2. SDK Data

The ReMAP SDK needs data to work, it expects to found three files:

• Dataset.csv: This file is the expected output from the dataset created on the ReMAP platform over a datasource created containing the information from the selected components and parameters in CSV format. CSV Format The data is provided in a csv file comma separated, organized by columns (one for parameter) and rows (one for timestamp). If there is parameter with no information for a timestamp the cell will be empty. The first row is a header including the parameters name, the others represent the data ordered by timestamp. The first column is reserved for the timestamp and the next ones will be the parameters in the order indicated by the airline staff.

• Metadata.json: contains the metadata information for datasource where the info comes from, components, parameters, tail number of the aircraft. The information in this file will be retrieved using the SDK methods.

• sdk_config.json: This file contains essential conifg information for the SDK as the url connections to obtain the security token, the client id to obtaind the token, the url to send the model output and internal information about the datasets, the runner and the models used to generate the output.

in the ReMAP platform these data files are automatically passed to the SDK through the environment, for demonstration purposes the SDK expects to find these data files under the /app/ directory, you need to recreate this directory and place the data files there in order to make the SDK work.

3.3. SDK Methods

As part of the security control, the models only can access the data using the functions of the ReMAP SDK. The SDK provides the methods needed to get any information related to the data set and the dataset itself.

getStartTime () : timestamp - Returns the first timestamp for the dataset

getEndTime (): timestamp - Returns the last timestamp for the dataset

getTailNumber () : string - Returns the aircraft’s tail number for the dataset 

getParamPartNumber (ParamName) : string - Returns the part number for the parameter passed to the function

getMetadata () : metadata [] - Returns the JSON containing the metadata for the model

sdk.getReplacements () : replacement [] - Returns the list of the replacements including parameter, part number and replacement date, if someone occurs.

getDataset () : string - Returns the route to the dataset file. Useful to retrieve the file and access directly to the information inside it.

sendOutput(rulUnit, rulValue, probabilityOfFailure, ConfidenceInterval) : json - Send the output of the model to the ReMAP platform to be stored, Returns the output sent with the mongo id of the database. This function expects the following parameters:
    o	rulUnit: unit of the output eg. Flight cycles, flight hours
    o	rulValue: the value of the rul output with unit above, eg. 400
    o	probabilityOfFailure: the probability of failure for the component
    o	ConfidenceInterval: interval confidence percentage

4 SDK Installation

The ReMAP SDK has been developed in python, it’s has been packaged as a python module and uploaded to PYPI (Python Pakage Index) to make it publicly available. It can be found in: https://pypi.org/project/remapSDK/. It’s highly recommended to install always the latest version in the repository. To install and use the ReMAP SDK you need some prerequisites:

  • Python 2.7
  • Pip

The SDK has been developed with python 2.7, it will only work for python scripts compatible with version. Pip is a python Package magament tool, that helps to install and manage python modules, you can use a different one if you like. Once you have this two softwares installed go to your console and type:

pip install 'remapSDK'

To upgrade the latest version of the module:

pip install --upgrade remapSDK

Once the module is installed with pip, you can start using it in your python script in you IDE. For more information about python modules installation visit: https://packaging.python.org/tutorials/installing-packages/

5 SDK Usage

Once you have installed python and the ReMAP SDK and recreated the data directory in the environment, you can start creating your python script and using the SDK module to access the aircraft data. • To use the Remap SDK it needs to be imported in your script, from remapSDK import remapSDK

the remapSDK is the module to be imported from the remapSDK Folder. If the module has been installed with pip you don’t need to change this import line, if you have moved or change the name of the folder containing the module, you will need to update this line.

• Create and SDK instance: The SDK is a python class and needs to be instatiated to be configured properly: remapSdk=remapSDK.Sdk()

Once you have created an instance of the sdk class you can start using the methods in the sdk. This is an example of using the sdk methods:

start=remapSdk.getStartTime() print(start)

end_date=remapSdk.getEndTime() print(end_date)

tailno=remapSdk.getTailNumber() print(tailno)

partNo=remapSdk.getParamPartNumber("param1") print(partNo)

metadata=remapSdk.getMetadata() print(metadata)

replacements=remapSdk.getReplacements() print(replacements)

6 SDK Demo

The ReMAP SDK has been developed to work in the ReMAP platform inside an environment with configuration files, its use outside the platform must be done emulating this environment, not just the configuraiton files but also the APIs the SDK uses to interact, extract the authentication token and send the output. To illustrate the use of the sdk a demonstration environment has been developed. This environment is recreated with two folders, data folder contains the configuration files the SDK needs to work, the tests folder contains two mains pyhton files besides the init.py, the testing_env.py file contains the python code to emulate the this environment, the test_remap.py file launch the SDK tests. To create a script for the sdk and test it, you first will need to run the testing_env python file to turn the demonstration environment on. Once it’s up and running you will be able to test the SDK. Note that the demonstration environment runs a REST API Server on port 5000, you can change the port number inside this file.

7 SDK Dependecies

The ReMAP SDK has some extra dependencies to work, they can be seen in the requirements.txt file under the root directory, in this file the modules required by the SDK are listed, and will be automatically installed when install the SDK with the pip install command.

Request	
The requests module allows the SDK to send HTTP requests using Python. This will allow the SDK to obtain the access token to for security environment and send the output to the ReMAP repository.

Flask	
Flask is a lightweight web application framework designed to make getting started quick and easy, with the ability to scale up to complex applications. The demonstration environment uses this module to emulate the ReMAP environment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

remapSDK-0.1.3.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

remapSDK-0.1.3-py2-none-any.whl (8.4 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page