Welcome to SivNorm’s documentation!

API pour nettoyer les champs marque/modèle d’une carte grise en leur affectant une référence.

Clean car make and model using a reference table.

Structure

├── docker-compose.yml
├── docs                                   <- Sphinx documentation folder
│   ├── build
│   ├── make.bat
│   ├── Makefile
│   └── source
├── dss
│   ├── caradisiac_marque_modele.csv
│   ├── esiv_caradisiac_marque_modele_genre.csv
│   └── esiv_marque_modele_genre.csv
├── artifacts                              <- Env variables definition file
├── Makefile                               <- Orchestring commands
├── README.md                              <- Top-level README for developers using this project
├── setup.py
├── sivnorm                                <- Python application folder
│   ├── app.py
│   ├── __init__.py
│   ├── process.py
│   └── __pycache__
└── tests                                  <- Unit test scripts
    ├── check.csv
    ├── check.py
    ├── README.md
    └── test_small.csv

Installation

This module can be installed locally using docker compose

Install docker

sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER

Install docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Deploy aws lambda function

AWS SAM is used to deploy lambda application. These functions have been compiled in the Makefile

make sam_build
make sam_package
make sam_deploy

API

GET /clean

Clean brand and model field

Query Parameters
  • marque (string) – Vehicle brand (eg: Renault)

  • modele (string) – Vehicle model (eg: Clio)

Status Codes
Response JSON Object
  • marque (string) – Cleaned brand

  • modele (string) – Cleaned model

GET /norm/{table_ref_name}

Normalize a single brand and model using a defined referential table

Parameters
  • table_ref_name (string) – Reference table [siv,cardisiac,siv_caradisiac]

Query Parameters
  • marque (string) – Vehicle brand (eg: Renault)

  • modele (string) – Vehicle model (eg: Clio)

Status Codes
Response JSON Object
  • marque (string) – Matched brand

  • modele (string) – Matched model

  • score (number) – Global matching score. Combination of score_marque and score_modele

  • score_marque (integer) – Matching score for brand

  • score_modele (integer) – Matching score for model

POST /norm/{table_ref_name}

Normalize a table of brand and model using a defined referential table

Parameters
  • table_ref_name (string) – Reference table [siv,cardisiac,siv_caradisiac]

Status Codes
  • 200 OK

    CSV file containing matching brand model and score like:

    RENAULT,CLIO,1.0 RENAULT,CLIO,0.945 AUDI, TTS,1.0 RENAULT,CLIO,0.945 RENAULT,CLIO,0.95 RENAULT,CLIO,1.0

Functions Documentation

Application modules

Flask application

class app.Clean(api=None, *args, **kwargs)

Docstring for MyClass.

get()

Clean brand and model field

class app.Custom_API(app=None, version='1.0', title=None, description=None, terms_url=None, license=None, license_url=None, contact=None, contact_url=None, contact_email=None, authorizations=None, security=None, doc='/', default_id=<function default_id>, default='default', default_label='Default namespace', validate=None, tags=None, prefix='', ordered=False, default_mediatype='application/json', decorators=None, catch_all_404s=False, serve_challenge_on_401=False, format_checker=None, **kwargs)
property specs_url

The Swagger specifications absolute url (ie. swagger.json)

Return type

str

class app.Information(api=None, *args, **kwargs)

Docstring for MyClass.

get(table_ref_name)

Get brand and model image

class app.Normalization(api=None, *args, **kwargs)

Docstring for MyClass.

get(table_ref_name)

Normalize a single brand and model using a defined referential table

post(table_ref_name)

Normalize a table of brand and model using a defined referential table

Process function

process.cleaning(row, column)

Cleaning function

Parameters
  • row (dict) – Detected boxes

  • column (str) – Image used for detection

Returns

Cleaned marque and model

Return type

row