Skip to main content

A small example package

Project description

Read Me File

How does this library works?

In the library there are 3 types of folders:

  • The "g" type
  • The "s" type
  • The "w" type

Brief Explanation:

The "g" files are files that are the gateway to the database itself. These files helps us to make use of the database as simple as possible. These type of files include one file which is the "gCentralCompenent" and, as the name suggests, is the center of all of the operation in the database and access to it.

The "s" files are the struture and architecture of each of the tables of the database, for example, sMeasure and sService arbitrage. In these files, there are fucntions to access the small tables for each "dataType".

The "w" files, the last type, is for web files. These type of files are the gateway to access and write in the database through the help of the Flask library. With these files, we can write, read and manipulate data from the database using the application layer protocol (get, post, put, delete, ...).

The "g" files:

gBaseDB:

This file has the code to implement and create the database. Its only funtion is to create the data base and the architecture

gCentralComponent:

This is the cerebro or the brain of all of the action. This file is the most important file of all.

This file is compost out of 5 blocks:

    1- The imports and data types
    2- The Strucutre of the main table (this table have the information of all tables) 
    3- The List functions
    4- The manipulate functions
    5- And the new Information funtions


1) First, it is imported the files to have access to the other tables and the functions to use it. The it has a list of dataTypes that are available to use. 

2) Second tge declaration of tha main table. It has the follwing data

    id = Column(Integer, primary_key=True)
    topic = Column(String)
    iotDeviceID = Column(String)
    dataType = Column(String)

    id - Every record or row in the table has its id. This is how the table controls all the flow of information

    topic - this information should be blank if it was sent throught the internet protocol but it is automatically filled if it was recived through mqtt because every information is sent linked to a topic

    iotDeviceID - this is the id of the "person" or device who is sending the information. It should be unique for every person

    dataType -  is the the name of the table that the information should be write on

    dataTypesAvailable = [
        "bessMeasurementData",
        "bessSetPointDataDB",
        "measurementData",
        "pVGeneratorData",
        "pVGeneratorSetPoint",
        "serviceArbitrage",
        "ServicePeakShaving",
        "serviceSelfConsumption",
        "inverterData",
               ]

3) The list functions, includes to gather all information by ID, by topic or all the information 

4) These block has 3 main functions:

    - deleteEntryByID which deletes rows, giving an ID
    - Tranforms the entry/row into a dictionary form
    - Tranforms a group of rows into a dictionary form
    
    WARNING: If it is more than one row or a list of one element, IT HAS to be used the table2dict fucntion instead of the row2dict function

5) This function is used to create a new entry in the main table and this fucntion is in charge of forward the information to the correct table. 
It has to be given a topic (even if there is blank), and ID, a dataType that is in the dataTypes availables and the data in the correct format.

This format is decrbied in  another document

The "s" files:

This files are not to be used directly.

They store and manipulate the information of each table that is related to the each table

The "w" files:

As mentioned above this files are the gateway of the database. It can be access through the internet.

To run the the server thorught the RESTFul, we need to run the funciton launchDataBase()

To run throught MQTT, we need to run the laucnhMQTT()

Then, everytime someone publishes a message, it automatically saves in the server's database.

Everytime someone POST or GET thourght an URL available, it saves info in the database or retrieve data from the database (so far):

URL's Available:

GATEDATASERVICE = "http://localhost:8000" is the Base URL

then we add /info/example to get have access to the funtions we get

http://localhost:8000/info/example

routes available:

/API/data Methods: [GET,POST]

Description: If Get, ir returns all the information in the central database If POST, reads the information in the body and creates a record of that data (creates a row in the database)

/API/data/ID/path:dataID Methods: [GET]

Description: Gets a specific row with that id

Example: /API/data/ID/4 gives the data realted to the entry with 4 as an ID

/API/data/dataType/path:dataType Methods: [GET]

Description: Gets all the records within that dataType. It returns a dictionary with all the information

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

ssopdatabase-0.1.1.tar.gz (25.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssopdatabase-0.1.1-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file ssopdatabase-0.1.1.tar.gz.

File metadata

  • Download URL: ssopdatabase-0.1.1.tar.gz
  • Upload date:
  • Size: 25.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for ssopdatabase-0.1.1.tar.gz
Algorithm Hash digest
SHA256 13ebcddb828fd0fc6b7584d26b9ed1a8741af55eb71b3081a468fbb9a611b893
MD5 c7498f7b04f7eb291f193e8a50746134
BLAKE2b-256 644cded92dd0ace789857bc90644443f4fa5eecb942cc72cca0519b293eef321

See more details on using hashes here.

File details

Details for the file ssopdatabase-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ssopdatabase-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for ssopdatabase-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31f8ee6537007599d4ae7ab96aba029467048ae547067af86cc33f220a9f89b4
MD5 b25b1bced9a106b5311f57324198d813
BLAKE2b-256 73bebf05d37123efab28cd54fd2e0f5d9eee91bd001ff41e98ada31263080e0f

See more details on using hashes here.

Supported by

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