Add databases doc.
[infos-pratiques:etalage.git] / docs / databases.rst
1 Base de donnĂ©es
2 ===============
3
4
5 **Etalage** implement a proof of concept of databases loaded in RAM. This has the inconvenient to be very slow at
6 startup and consume lots of memory.
7
8 But, in the other hand, it grant us with a high speed research trhough data and all related actions are verry fast too.
9
10
11 MongoDB
12 -------
13
14 .. FIXME Add links href
15
16 The standard data source for **etalage** is the `Petitpois <https://gitorious.org/infos-pratiques/petitpois.git>`_
17 *POIs* collection and the `Territoria2 <https://gitorious.org/infos-pratiques/territoria.git>`_ *territories*
18 collections. Both collections are stored within a `**MongoDB** <https://www.mongodb.org/>`_ Database.
19
20 Those two collections are entirely browsed in **etalage.ramdb.load** method, called in the **load_environment** at
21 startup.
22
23 RAMDB
24 -----
25
26 Browsed data are partially stored in **python dict**. You can found the following indexes in **Etalage**
27
28 Categories related indexes:
29
30 * categories_slug_by_tag_slug
31 * categories_slug_by_word
32 * category_by_slug
33 * category_slug_by_pivot_code
34
35 Territories related indexes:
36
37 * schema_title_by_name
38 * territories_id_by_ancestor_id
39 * territories_id_by_postal_distribution
40 * territory_by_id
41 * territory_id_by_kind_code
42
43 POIs related indexes:
44
45 * ids_by_category_slug
46 * ids_by_competence_territory_id
47 * ids_by_begin_datetime
48 * ids_by_end_datetime
49 * ids_by_last_update_datetime
50 * ids_by_parent_id
51 * ids_by_presence_territory_id
52 * ids_by_word
53 * slug_by_id
54
55 And two specials **dict**:
56
57 * indexed_ids : A set of all ids, used to verify if a POI is correctly loaded
58 * instance_by_id : Data are directly stored in that dict in case the database is small enough to enter in RAM