Skip to content

Latest commit

 

History

History
148 lines (98 loc) · 4.86 KB

README.md

File metadata and controls

148 lines (98 loc) · 4.86 KB

Trefle

Présentation du projet

Trèfle est un simulateur de dispositifs de financement qui, en fonction des données du demandeur et de la formation, va générer une liste de financements possibles. Cette liste de financements proposés est accompagnée, selon le dispositif, de la rémunération dont pourrait bénéficier le demandeur. Les résultats sont donnés à titre informatif et nécessitent l'accompagnement d'un conseiller pour la suite des démarches.

Project overview

Trèfle is a simulator tool aim to propose a list of financial plans depending on buyer situation employment data and training courses data itself. A renumeration can be proposed with the formation plan. Results are given as information only and must be accompanied by an adviser to engage the process of any plan.

Dependencies

  • LBF Url to simulation on the web interface explorer
  • LBF Catalog API key to retrieve training courses data

Python3 dependencies for dev mode

  • python3-venv
  • python3-dev
  • python3-wheel

Install in dev mode

  • Create a venv : python3 -m venv .venv
  • Activate the virtualenv : source .venv/bin/activate
  • Then: make develop

Add env var

```
VERSION=api-vX.X.X
OLD_VERSION=api-vX.X.X
BACK_VERSION=backoffice-vX.X.X
LBF_CHARMAP="sA,4B,RC,cD,oE,gF,yG,wH,mI,HJ,7K,EL,aM,YN,XO,8P,GQ,BR,kS,iT,IU,AV,TW,DX,pY,JZ,2a,Lb,Mc, d,de,Cf,Qg,fh,ri,Pj,Nk,Vl,vm,0n,Ko,ep,jq,Zr,9s,ht,Fu,tv,-w,Ux,1y,xz,30,u1,52,q3,W4,S5,66,n7,b8,O9,_+,l/,z "
CATALOG_USER={ASK-YOUR-LBF-CATALOG-API-USER}
CATALOG_KEY={ASK-YOUR-LBF-CATALOG-API-KEY}
CATALOG_URL=https://labonneformation.pole-emploi.fr/api/v1/detail
TREFLE_GIT=https://git.beta.pole-emploi.fr/open-source/trefle.git
GITLAB_TOKEN={ASK-GITLAB-TOKEN}
```

Local API server

Launch dev mode server: `trefle serve`

Run a simulation

Swagger API DOC : https://app.swaggerhub.com/apis/labonneformation/moteur-financement-formation

trefle simulate var=value var2=value2…
# Or from an LBF URL
trefle simulate --url=https://xxx?a=yyy
# Or from JSON (like a request body from the logs)
trefle simulate --context='{"xxx": "yyyy"}'
# You can output a Gherkin scenario from this simulation
trefle simulate var=value var2=value2… --output-scenario
# Get details about the data (including retrieved data from catalog)
trefle simulate var=value var2=value2… --show-context
# Trace the rules to see which condition passed or failed
trefle simulate var=value var2=value2… --trace

Exemple:
trefle simulate --context='{"beneficiaire":{"inscrit_pe":true,"age":40},"formation":{ "codes_financeur":[2],"region":27,"heures":4000}}' --trace

Run the backoffice in dev mode

configure

To connect the front to your API server in dev mode, change in backoffice/vue.config.js:

`proxy: 'https://trefle.beta.pole-emploi.fr/0.7/'` for `proxy: 'http://127.0.0.1:3579/`

launch

cd backoffice
npm install
npm run serve

and go to url : http://127.0.0.1:8080/explorer

Run unittests

py.test

Run integration tests

behave

Get a detailed coverage report:

behave -D coverage-format=short

Get a more detailed coverage report:

behave -D coverage-format=long

Build project in PROD mode

  1. Go to docker folder

  2. Add this env var:

    VERSION=api-vX.X.X
    OLD_VERSION=api-vX.X.X
    BACK_VERSION=backoffice-vX.X.X
    LBF_CHARMAP="sA,4B,RC,cD,oE,gF,yG,wH,mI,HJ,7K,EL,aM,YN,XO,8P,GQ,BR,kS,iT,IU,AV,TW,DX,pY,JZ,2a,Lb,Mc, d,de,Cf,Qg,fh,ri,Pj,Nk,Vl,vm,0n,Ko,ep,jq,Zr,9s,ht,Fu,tv,-w,Ux,1y,xz,30,u1,52,q3,W4,S5,66,n7,b8,O9,_+,l/,z "
    CATALOG_USER={ASK-YOUR-LBF-CATALOG-API-USER}
    CATALOG_KEY={ASK-YOUR-LBF-CATALOG-API-KEY}
    CATALOG_URL=https://labonneformation.pole-emploi.fr/api/v1/detail
    TREFLE_GIT=https://git.beta.pole-emploi.fr/open-source/trefle.git
    GITLAB_TOKEN={ASK-GITLAB-TOKEN}
    

where X.X.X is a tag of the TREFLE_GIT OLD_VERSION and BACK_VERSION must be compatible

  1. Add email, password, and rule file authorized to be modified in docker/authorisations.csv i.e: [email protected], mypassord, Occitanie.rules

  2. docker-compose up --build -d to use image from the gitlab registry or docker-compose -f docker-compose.yml -f docker-compose.override-build.yml up -d --build to build the image from scratch

Update trefle

Update API

  1. Update VERSION in .env file
  2. Update API, in docker folder process : ./update_api.sh trefle

Update WEB

  1. Update BACK_VERSION in .env file
  2. Update the website, in docker folder process : ./update_web.sh

Update acces

  1. Update file authorisations.csv in docker/authorisations.csv
  2. in docker folder do sh update_access logs are in docker/logs

Format for authorisations.csv : email,password,files Note: multiple files must be separated with a "|"

Troubleshooting

Try to restart the stack with ./restart_stack.sh