Reading and processing information from a database » History » Revision 1
Revision 1/4
| Next »
Rafael Bailon-Ruiz, 2020-08-28 18:16
Reading and processing information from a database¶
The purpose of this page is to show you how to use the CAMS database and how to process data inside without modifying stored data.
The database¶
The databases objects here are SpatializedDatabase and its subclass, NephelaeDataServer. While being both usable, only the NephelaeDataServer is being used to register data and play simulations / real-flights. The reason is because this version is tailored to the CAMS needs (notification methods, uav ids, variable names...).
Because of these reasons, this paragraph will only talk about the NephelaeDataServer.
The NephelaeDataServer uses SpbEntry objects to register data. These objects have a Position to know where the data has been found, aswell as a list of tags to know what type of data is inside. The data attribute of SpbEntry are either AircraftStatus object or SensorSample during simulations.
You can retrieve data from the database using the getitem() function or the find_entries() (see the getitem function as a sugar syntax of the find entries function). This will return a list of SpbEntries.
Usage exemple :
db = NephelaeDataServer.load('path/to/some/file')
db.find_entries(keys=keys, tags=['RCT']) # Finding all the SpbEntry related to the RCT
NephelaeDataServer comes also with notification methods, these methods are add_gps(), add_status() and add_sample().
These methods are always called when an Aircraft is sending data to the database, notifying these methods.
Process data¶
Since the data registered in the database is raw data, we use objects that processes copies of registered data.
Why registering raw data ? Because of reuse ability. This way we can take this data to reproduce an experiment and try differently.
To process copies of registered data, we use a dataview. It's a sort of "view" that process copies of registered data. There is a lot of dataviews types, each for a specific usage.
A non-exhaustive list of usages :
- Fetching from the database
- Process a certain type of sample
- Fetching status of an UAV
- Reorganize data
A dataview can generally have multiple parents and children dataviews. Fetching data from a dataview will return the result of all the parent dataviews, applying the different data process. Once finished, the dataview will apply its own data process and return it.
Updated by Rafael Bailon-Ruiz about 4 years ago · 4 revisions