service to detect temperature and humidity based on geo position
- install node and yarn. Install yarn using below command.
npm install -g yarn
- clone the repo from the github.
git clone "[email protected]:iAbhishek91/temperature-service-api.git"
- install the required packages
yarn
- quick start the application
yarn start
- this microservice has 100% unit test coverage.
- also lint test are integrated.
yarn test
post execution of unit test, following reports are generated.
- coverage report: available at
./coverage/Icov-report/index.html
. - unit test report: avialble at
./unitTestResult.html
docker build -t abdas81/temperature-service
refer API documentation: <hosted-domain>/api/v1/docs
for simplicity, I have divided earth into 3 zone (purly fictitious)
- tropical region (latitude between +20 and -20)
- high temperature: 30 to 55 degree celcius
- high humidity: between 60 and 90 %
- arctic region (latitude between +45 and 90 or -45 and -90)
- low temperature: 0 to 15 degree celcius
- low humidity: between 0 and 20 %
- between topical and arctic (latitude between +21 and 44 or -21 to -44)
- medium temperature: 10 to 25 degree celcius
- medium humidity: between 10 and 70 %
If longitude is +ve(east hemisphere) then the above calculated temperature and humidity are increased by 5
- latitude: between -90 and +90
- longitude: between -180 and +180
If invalid values are passed the service throws HTTP 400
latitude = 85.76868; longitude = 120.6876;
{
temperature: 18,
humidity: 20,
}
latitude = -95.; longitude = 120;
{
error: 'error message......',
}