Project

General

Profile

Reading and processing information from a database » History » Version 1

Rafael Bailon-Ruiz, 2020-08-28 18:16

1 1 Rafael Bailon-Ruiz
h1. Reading and processing information from a database
2
3
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.
4
5
h2. The database
6
7
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...).
8
Because of these reasons, this paragraph will only talk about the NephelaeDataServer.
9
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.
10
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.
11
Usage exemple :
12
<pre><code class=python>db = NephelaeDataServer.load('path/to/some/file')
13
db.find_entries(keys=keys, tags=['RCT']) # Finding all the SpbEntry related to the RCT</code></pre>
14
NephelaeDataServer comes also with notification methods, these methods are add_gps(), add_status() and add_sample().
15
These methods are always called when an Aircraft is sending data to the database, notifying these methods.
16
17
h2. Process data
18
19
Since the data registered in the database is raw data, we use objects that processes copies of registered data.
20
Why registering raw data ? Because of reuse ability. This way we can take this data to reproduce an experiment and try differently.
21
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.
22
A non-exhaustive list of usages :
23
24
  * Fetching from the database
25
26
  * Process a certain type of sample
27
28
  * Fetching status of an UAV
29
30
  * Reorganize data
31
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.