https://github.com/msfidelis/nutrition-overengineering
:bread: :hamburger: :pizza: :sandwich: :egg: :bacon: - Application to calc healthcare and nutrition metrics, but using the most over engineered as possible
https://github.com/msfidelis/nutrition-overengineering
golang grpc jaeger microservice microservices overengineering
Last synced: about 1 year ago
JSON representation
:bread: :hamburger: :pizza: :sandwich: :egg: :bacon: - Application to calc healthcare and nutrition metrics, but using the most over engineered as possible
- Host: GitHub
- URL: https://github.com/msfidelis/nutrition-overengineering
- Owner: msfidelis
- License: mit
- Created: 2022-01-04T21:49:07.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-10T18:52:15.000Z (about 1 year ago)
- Last Synced: 2025-04-10T20:00:59.713Z (about 1 year ago)
- Topics: golang, grpc, jaeger, microservice, microservices, overengineering
- Language: Go
- Homepage:
- Size: 585 KB
- Stars: 21
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nutrition Overengineering
Application to calc healthcare and nutrition metrics, but using the most over engineered as possible
> "Caraca Matheus, tu é idiota???
> "Sim"
# Overenginner Microservices Summary
* `health-api`: REST Interface for product. Using API Composition pattern.
* `bmr-grpc`: gRPC Microservice to calc Basal Metabolic Rate
* `imc-grpc`: gRPC Microservice to calc IMC
* `recommendations-grpc`: gRPC Microservice to summarize diet recommendations and contabilize Macros
* `proteins-grpc`: gRPC Microservice to calc daily protein necessity
* `water-grpc`: gRPC Microservice to calc daily water ingestion
* `calories-grpc`: gRPC to calc calories ingestion necessity
* `health-data-offload`: Worker to save health-reports on data layer
* `frontend`: VueJS SPA
## Docker Images
| Application | Image |
|-------------------------------|---------------------------------------------------|
| health-api | fidelissauro/health-api:latest |
| bmr-grpc-service | fidelissauro/bmr-grpc-service:latest |
| imc-grpc-service | fidelissauro/imc-grpc-service:latest |
| water-grpc-service | fidelissauro/water-grpc-service:latest |
| calories-grpc-service | fidelissauro/calories-grpc-service:latest |
| proteins-grpc-service | fidelissauro/proteins-grpc-service:latest |
| recommendations-grpc-service | fidelissauro/recommendations-grpc-service:latest |
| health-data-offload | fidelissauro/health-data-offloa:latest |
## Workflow

# API
## Usage
```bash
curl --location --request POST '0.0.0.0:8080/calculator' \
--header 'Content-Type: application/json' \
--data-raw '{
"age": 26,
"weight": 90.0,
"height": 1.77,
"gender": "M",
"activity_intensity": "very_active"
} ' --silent | jq .
```
```json
{
"status": 200,
"imc": {
"result": 28.72737719046251,
"class": "overweight"
},
"basal": {
"bmr": {
"value": 2011.7,
"unit": "kcal"
},
"necessity": {
"value": 3470.1825000000003,
"unit": "kcal"
}
},
"health_info": {
"age": 26,
"weight": 90,
"height": 1.77,
"gender": "M",
"activity_intensity": "very_active"
},
"recomendations": {
"protein": {
"value": 180,
"unit": "g"
},
"water": {
"value": 3150,
"unit": "ml"
},
"calories": {
"maintain_weight": {
"value": 3470.1825000000003,
"unit": "kcal"
},
"loss_weight": {
"value": 3123.1642500000003,
"unit": "kcal"
},
"gain_weight": {
"value": 5205.27375,
"unit": "kcal"
}
}
}
}
```
# Jaeger and Zipkin
## Using Tracing between services
To use jaeger tracing with zipkin you can specify environment variable called `ZIPKIN_COLLECTOR_ENDPOINT`.
```bash
export ZIPKIN_COLLECTOR_ENDPOINT=http://jaeger:9411/api/v2/spans
```


# TODO
* Refactor communication lib
* Customize log lib for trace id
* Error Handling and Retries
* Implement Prometheus HTTP Endpoint
* Create Kubernetes Deployment
* Create Istio Manifests to Service Mesh gRPC Optimizations
## Notes
```
brew install grpc protobuf protoc-gen-go-grpc
protoc --proto_path=proto/bmr --go_out=proto/bmr --go_out=plugins=grpc:bmr --go_opt=paths=source_relative proto/bmr/bmr.proto
protoc --go_out=plugins=grpc:bmr bmr.proto
```