https://github.com/alvaropaco/py-nameco-flask-microservice
https://github.com/alvaropaco/py-nameco-flask-microservice
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alvaropaco/py-nameco-flask-microservice
- Owner: alvaropaco
- Created: 2020-03-29T18:13:04.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-30T22:38:01.000Z (about 5 years ago)
- Last Synced: 2025-02-12T09:59:40.767Z (4 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Insurance [](https://circleci.com/gh/alvaropaco/py-nameco-flask-microservice) [](https://codeclimate.com/github/alvaropaco/py-nameco-flask-microservice/maintainability)
Insurance microservice implementation to predict the client profile based on risk metrics.
### Requeriments
* Docker I/O
### Building
Firstly we need to build the docker image:
`docker build -t api .`
### Running
Run command will push up the micro-service:
`docker run -it -v $(pwd):/app -p 5000:5000 api ./entrypoint.sh`
### Usage
### Get Insurance risk
Just nedd to consume one endpoint to get the insurance risk prediction:
* Endpoint: /insurance/risk
* Method: POST
* Payload:
```json
{
"age": Int,
"dependents": Int,
"house": {"ownership_status": String},
"income": Int,
"marital_status": String,
"risk_questions": Array,
"vehicle": {"year": Int}
}
```* Response:
```json
{
"auto": String,
"life": String,
"disability": String,
"home": String
}
```Simple http call to the service URL:
`curl -X POST 127.0.0.1:5000/insurance/risk -H "Content-Type: application/json" -d @data.example.json`
### Testing
Can run the API tests:
`docker run -it -v $(pwd):/app -p 5000:5000 api ./entrypoint.tests.sh`