Skip to content

A service which collects data and alerts if the CO2 concentrations reached critical levels.

License

Notifications You must be signed in to change notification settings

BohdanKyryliuk/carbon-dioxide-mesurements

Repository files navigation

Carbon Dioxide measurements

A service which collects data and alerts if the CO2 concentrations reached critical levels.

Requirements

  • Docker

Sail

The local development environment uses Docker powered by Laravel Sail. It is recommended that you alias sail with this command:

$ alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'

Installation

$ gh repo clone BohdanKyryliuk/carbon-dioxide-mesurements
$ cd carbon-dioxide-mesurements
$ ./install
$ sail up -d
$ sail artisan migrate

Redis queues

The app uses built in Laravel queues

To run queues in Redis, just set up your local env variable:

QUEUE_CONNECTION=redis

and run Laravel Horizon:

$ sail artisan horizon

Testing

Run the test suite

$ sail composer test

Run the full CI suite of checks

$ sail composer suite

API documentation

Collect sensor measurements

POST /api/v1/sensors/{uuid}/mesurements
{
    "co2" : 2000,
    "time" : "2022-05-19T14:55:47+00:00"
}

Sensor status

GET /api/v1/sensors/{uuid}

Response:
{
  "status" : "OK" // Possible status OK,WARN,ALERT
}

Sensor metrics

GET /api/v1/sensors/{uuid}/metrics
Response:
{
    "maxLast30Days" : 1200,
    "avgLast30Days" : 900
}

Listing alerts

GET /api/v1/sensors/{uuid}/alerts
Response:
[
    {
        "startTime" : "2022-05-019T18:55:47+00:00",
        "endTime" : "2022-05-019T20:00:47+00:00",
        "mesurement1" : 2100,
        "mesurement2" : 2200,
        "mesurement3" : 2100
    }
]

About

A service which collects data and alerts if the CO2 concentrations reached critical levels.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published