diff --git a/README.md b/README.md index 3f81b83..61aa82d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ _La dernière version à jour de ce document est disponible sur [github](https:/ - [Code source publié sur _Github_][4] - [Tableau agile][5] - [Modèle physique de données][6] -- [Script de création de votre base de données][7] +- Script de création de votre base de données - [Document texte expliquant la démarche][8] * difficultés rencontrées / solutions trouvées * lien _Github_ @@ -53,7 +53,7 @@ _La dernière version à jour de ce document est disponible sur [github](https:/ [3]: https://fr.openfoodfacts.org/ [4]: https://github.com/freezed/ocp5/blob/master/README.md [5]: https://github.com/freezed/ocp5/projects/1 -[6]: https://github.com/freezed/ocp5/blob/master/mpd.png +[6]: https://github.com/freezed/ocp5/blob/master/doc/pdm.png [7]: https://github.com/freezed/ocp5/blob/master/create-db.sql -[8]: https://github.com/freezed/ocp5/blob/master/approach.md -[9]: https://github.com/freezed/ocp5/blob/master/documentation.md#documentation "Project documentation" +[8]: https://github.com/freezed/ocp5/blob/master/doc/approach.md +[9]: https://github.com/freezed/ocp5/blob/master/doc/documentation.md#documentation "Project documentation" diff --git a/approach.md b/doc/approach.md similarity index 100% rename from approach.md rename to doc/approach.md diff --git a/documentation.md b/doc/documentation.md similarity index 86% rename from documentation.md rename to doc/documentation.md index 21e5898..fb9d3b1 100644 --- a/documentation.md +++ b/doc/documentation.md @@ -4,32 +4,28 @@ Documentation ## Created with - `python 3.6.4 ` -- ~`Requests`~ [`TODO #4`][4] +- `Requests` - ~`PyMySQL` or `openfoodfacts-python`~ [`TODO #4`][4] ## Installation 1. get the code : `git clone git@github.com:freezed/ocp5.git` -2. create a dedicated virtualenv : `python3.7 -m venv .venv; source .venv/bin/activate` -3. ~adds dependencies : `cd ocp5; pip install -r requirement.txt`~ [TODO #4][4] +2. create a dedicated virtualenv : `python3 -m venv .venv; source .venv/bin/activate` +3. adds dependencies : `cd ocp5; pip install -r requirements.txt` ## Collects data 1. [OpenFoodFacts data uses more than 170 fields][92]. Here are those we keep localy : ``` code -url -last_modified_t product_name categories_fr -purchase_places -stores nutrition-score-fr_100g ``` 2. Request will only ask for tagged products with `'countries':'france'` -3. ~Physical Data Model~ [`TODO #2`][2] +3. Physical Data Model -![-Physical Data Model-][2] +![-Physical Data Model-][96] 4. ~Creates local MariaDB/MySQL : `./create-db.py`~ [`TODO #2`][2] diff --git a/doc/pdm.png b/doc/pdm.png new file mode 100644 index 0000000..89dce07 Binary files /dev/null and b/doc/pdm.png differ diff --git a/doc/pdm.puml b/doc/pdm.puml new file mode 100644 index 0000000..706708f --- /dev/null +++ b/doc/pdm.puml @@ -0,0 +1,55 @@ +@startuml + +title Physical data model\n + +/' = = = = = = = STYLE = = = = = = = '/ +hide empty methods +hide circle +skinparam linetype ortho +skinparam class { + BackgroundColor<> lightblue +} + +/' = = = = = = = MACRO = = = = = = = '/ +!define rel(a,b,c,d,e) a c e +!define pyk(n,t="MEDIUMINT NOT NULL UNSIGNED") PK:n [t] +!define fnk(n,r,t="MEDIUMINT NOT NULL UNSIGNED") FK:n [t] +!define pfk(n,r,t="MEDIUMINT NOT NULL UNSIGNED") PFK:n [t] +!define att(n,u,s) {field} n [s] + +/' = = = = = = = CLASSE = = = = = = = '/ +class product +class category +class prod_category <> + +/' = = = = = = = RELATION = = = = = = = '/ +rel(product,1..,--,1..*,category) + +/' = = = = = = = KEY = = = = = = = '/ +class product { + pyk(id) + .. +} +class category { + pyk(id) + .. +} +class prod_category <> { + pfk(category_id,category.id) + pfk(product_id,product.id) + .. +} +/' = = = = = = = ATTRIBUTE = = = = = = = '/ +class product { + att(name,String,VARCHAR(200)) + att(nutrition_grades,String,VARCHAR(1)) +} +class category { + att(name,String,VARCHAR(200)) +} + +/' = = = = = = = ASSOCIATION = = = = = = = '/ +rel(product,.,--,.,prod_category) +rel(category,.,-,.,prod_category) + +@enduml