Acts the roadmap fork #09
This commit is contained in:
parent
774ff877e2
commit
650fc334ca
116
documentation.md
116
documentation.md
|
@ -1,72 +1,68 @@
|
||||||
Documentation
|
Documentation
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
## Created with
|
||||||
|
|
||||||
|
- `python 3.6.4 `
|
||||||
|
- ~`Requests`~ [`TODO #4`][4]
|
||||||
|
- ~`PyMySQL` or `openfoodfacts-python`~ [`TODO #4`][4]
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. get the code : `git clone git@github.com:freezed/ocp5.git`
|
1. get the code : `git clone git@github.com:freezed/ocp5.git`
|
||||||
2. create a dedicated virtualenv
|
2. create a dedicated virtualenv : `python3.7 -m venv .venv; source .venv/bin/activate`
|
||||||
3. ~adds dependencies : `cd ocp5; pip3 install -r requirement.txt`~
|
3. ~adds dependencies : `cd ocp5; pip install -r requirement.txt`~ [TODO #4][4]
|
||||||
4. dowload the [HUDGE CSV file][3] ([more info about data here][4])
|
|
||||||
5. set up the data on a MariaDB/MySQL server with [`create-db.sql`][5]
|
|
||||||
5. ~run it : `./main.py`~
|
|
||||||
|
|
||||||
## Usage
|
## Collects data
|
||||||
|
|
||||||
### 1. Find an alternative product
|
|
||||||
|
|
||||||
1. Type the number corresponding to the product's category
|
|
||||||
2. Type the number corresponding to the choosen alternative product
|
|
||||||
3. The system shows you the product sheet :
|
|
||||||
- description
|
|
||||||
- a shop where you can buy it (if available)
|
|
||||||
- the product link to [OpenFoodFacts][1] website
|
|
||||||
4. Decide if you want to save the alternative product in DB
|
|
||||||
|
|
||||||
### 2. Retrieve saved alternatives products
|
|
||||||
|
|
||||||
1. Type the number corresponding to the choosen alternative product
|
|
||||||
2. The system shows you the product sheet :
|
|
||||||
- description
|
|
||||||
- a shop where you can buy it (if available)
|
|
||||||
- the product link to [OpenFoodFacts][1] website
|
|
||||||
|
|
||||||
## Data kept
|
|
||||||
|
|
||||||
1. Tagged `'countries':'france'`
|
|
||||||
2. [OpenFoodFacts data uses more than 170 fields][2]. Here are those we keep in this project :
|
|
||||||
|
|
||||||
|
1. [OpenFoodFacts data uses more than 170 fields][92]. Here are those we keep localy :
|
||||||
```
|
```
|
||||||
1 code
|
code
|
||||||
2 url
|
url
|
||||||
4 created_t
|
last_modified_t
|
||||||
6 last_modified_t
|
product_name
|
||||||
8 product_name
|
categories_fr
|
||||||
10 quantity
|
purchase_places
|
||||||
17 categories_fr
|
stores
|
||||||
18 origins_tags
|
nutrition-score-fr_100g
|
||||||
20 manufacturing_places_tags
|
|
||||||
24 labels_fr
|
|
||||||
30 purchase_places
|
|
||||||
31 stores
|
|
||||||
35 ingredients_text
|
|
||||||
41 serving_size
|
|
||||||
42 serving_quantity
|
|
||||||
47 additives_fr
|
|
||||||
55 nutrition_grade_fr
|
|
||||||
60 states_fr
|
|
||||||
62 main_category_fr
|
|
||||||
69 energy_100g
|
|
||||||
71 fat_100g
|
|
||||||
108 sugars_100g
|
|
||||||
122 salt_100g
|
|
||||||
123 sodium_100g
|
|
||||||
124 alcohol_100g
|
|
||||||
165 nutrition-score-fr_100g
|
|
||||||
```
|
```
|
||||||
|
2. Request will only ask for tagged products with `'countries':'france'`
|
||||||
|
3. ~Physical Data Model~ [`TODO #2`][2]
|
||||||
|
|
||||||
|
![-Physical Data Model-][2]
|
||||||
|
|
||||||
|
4. ~Creates local MariaDB/MySQL : `./create-db.py`~ [`TODO #2`][2]
|
||||||
|
|
||||||
|
## Use de CLI to get alternate product
|
||||||
|
|
||||||
|
1. ~run it : `./main.py`~ [`TODO #5`][5]
|
||||||
|
2. ~follow instructions :~ [`TODO #5`][5]
|
||||||
|
|
||||||
|
1. Find an alternative product
|
||||||
|
|
||||||
|
1. Type the number corresponding to the product's category
|
||||||
|
2. Type the number corresponding to the choosen alternative product
|
||||||
|
3. The system shows you the product sheet :
|
||||||
|
- description
|
||||||
|
- a shop where you can buy it (if available)
|
||||||
|
- the product link to [OpenFoodFacts][91] website
|
||||||
|
4. Decide if you want to save the alternative product in DB
|
||||||
|
|
||||||
|
2. Retrieve saved alternatives products
|
||||||
|
|
||||||
|
1. Type the number corresponding to the choosen alternative product
|
||||||
|
2. The system shows you the product sheet :
|
||||||
|
- description
|
||||||
|
- a shop where you can buy it (if available)
|
||||||
|
- the product link to [OpenFoodFacts][91] website
|
||||||
|
|
||||||
|
|
||||||
[1]: https://world.openfoodfacts.org/ "OpenFoodFacts project"
|
[91]: https://world.openfoodfacts.org/ "OpenFoodFacts project"
|
||||||
[2]: https://world.openfoodfacts.org/data/data-fields.txt "OpenFoodFacts field list"
|
[92]: https://world.openfoodfacts.org/data/data-fields.txt "OpenFoodFacts field list"
|
||||||
[3]: https://static.openfoodfacts.org/data/en.openfoodfacts.org.products.csv "CSV Data Export"
|
[93]: https://static.openfoodfacts.org/data/en.openfoodfacts.org.products.csv "CSV Data Export"
|
||||||
[4]: https://world.openfoodfacts.org/data "OpenFoodFacts data page"
|
[94]: https://world.openfoodfacts.org/data "OpenFoodFacts data page"
|
||||||
[5]: https://github.com/freezed/ocp5/blob/master/create-db.sql
|
[95]: https://github.com/freezed/ocp5/blob/master/create-db.sql
|
||||||
|
[96]: https://raw.githubusercontent.com/freezed/ocp5/master/doc/pdm.png "Image of the physical data model"
|
||||||
|
[2]: https://github.com/freezed/ocp5/issues/2 "Issue #2"
|
||||||
|
[4]: https://github.com/freezed/ocp5/issues/4 "Issue #4"
|
||||||
|
[5]: https://github.com/freezed/ocp5/issues/5 "Issue #5"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user