A simple PHP Lumen based extractor to save and export data from CPTEC temperature maps from Leme-SP region and export to a JSON response.
The extraction process use Lumen jobs to download the CPTEC heat map images and extract the average temperature using the image color from the region of Leme-SP, so building a MySQL database with the extracted data.
http://{host}/api/extract/start={start}&end={end}
- {host}: The actual host of the application¹
- {start}: The starting year² of extraction
- {end}: The last year² of extraction
The exporting process is responsable for returning a JSON response based on all database data from the desired kind.
http://{host}/api/export/kind={kind}
- {host}: The actual host of the application¹
- {kind}: The type of data to be exported, can be:
- 'tempmin': The minimum temperature
- 'tempmax': The maximum temperature
- Clone this repository
- Copy .env.example to .env and change the necessary env vars
- Use
docker-compose up --build
to start the necessary containers and active the Artisan Queue - Enter on PHP docker container bash using
docker-compose exec php bash
- Run
composer install
to install all dependencies - Run
php artisan migrate
to initialize the database - exit PHP docker container bash using
exit
- Grant the necessary permissions to
storage/logs/ storage/framework/ public/uploads/
- Start sending requests 😃
¹ If the application is running on local the host will be 127.0.0.1
.
² A valid four digit year between 1961 and 2020.