fieldmaster 0.0.8
Source code for the temperature prediction project
Requires Python: >=3.6
Keywords: temperature,forecasting,timeseries,prophet

<br/>
<p align="center">
    <a>
        <img width="50%" src="https://github.com/ismaelcv/sourceag-ds/blob/f023d3a939ecd7417021ef43a3544499bb52aebc/fieldmaster/assets/source_white.png" alt="Source logo">
    </a>
</p>
<br/><br/>

# Fieldmaster

This repository contains the core framework for ``Fieldmaster``, an Air-temperature (``Tair``)/Relative Humidity(``Rhair``) forecaster app for Greenhouse climate control. Its goal is to predict the Temperature and Humidity of the greenhouse for the next day based on the data collected from the sensors, weather conditions, and the current greenhouse state.

``Fieldmaster`` app runs using 
* ``Plotly Dash``, a web-based interactive graphing and visualization library.
* It is hosted on ``Pipy`` so it can be installed via pip.
* It is written using ``pre-commit`` for linting and code-formatting.
* It contains a CLI to run and debug the hosting server.
    

<br/>
<br/>

<p align="center">
    <a>
        <img width="100%" src="https://github.com/ismaelcv/sourceag-ds/blob/23a5842ad3685f0797991c54b5236ded2e3595df/fieldmaster/assets/app.png" alt="app">
    </a>
</p>
<br/>
<br/>


 #### 1: Assumptions

* ``Fieldmaster`` is designed as a simmulator that tries to get the best prediction for ``Tair`` and ``Rhair`` on a given day.
* Historical data is shown in Blue 
* The day to predict is shown in lightgray as a reference. This data is not used in the model training.
* It is possible to navigate through different days using the calendar provided.
* Additionally the app is able to estimate predictions for all the greenhouses of the different teams using the dropdown menu.
* It is possible to select among three different models
    - Seasonal ARIMA (SARIMA)
    - FBProphet Univariate
    - FBProphet Multivariate
* Please be patient, each time a model is selected, it will be re-trained therefore can take up a couple of seconds per model to run. In a production environent this would be avoided by running the models overnight and just making predictions for the next day.
* Model results are a cached per day, so if the model has been trained once, it will do it faster the next time it is selected.
* 90% Confidence intervals are shown for each model.
* In the case of facebook prophet multivariate the only regressor used is total outside irradiance (``PARout``). This is done to avoid many regressors needed as input for prediction. Total irradiance can be forecasted for the next day used externals API like [SOLCAST](https://solcast.com/).
* The prediction is calculated on 30 days of historical days fixed. The days to show slider is just there for visualization purposes and doesn't have any impact on the model.


## ✅&nbsp; Installation

This code can be run on:

* MAC terminal
* Linux terminal
* WSL terminal on Windows 10/11

It also requires Python 3.6 or higher.

 ``Facebook Prophet`` has special dependencies and installation sequence with pystan, numpy and pandas.
Its therefore strongly advised to install The fieldmaster package using ``virtualenv``.
This can be achieved used the following comands:

Note: Using a conda environment will probably fail due to FBProphet dependencies. But you can try :P

### Environment setup

First install virtualenv in case you dont have it already in your machine.
```bash
pip install virtualenv 
```

Create a new virtual environment
```bash
virtualenv venv
```

Activate the environment
```bash
source venv/bin/activate
```
 ### Install Fieldmaster

```bash
pip install fieldmaster==0.0.8 
```
*note: since the package is so new, sometimes it struggles the first time. Give it a second chance and run it again.


run the Fieldmaster app with the following comand:
```bash
fieldmaster run 
```

Then your are prompted to a local:host location
[http://127.0.0.1:8085/](http://127.0.0.1:8085/)

by making click on it you will be prompted to the fieldmaster app


## 📫&nbsp; Have a question?  Ran into a problem?

You can always **reach me** my personal email account: ismaelcv@gmail.com


## 🤝&nbsp; Found a bug? Missing a specific feature?

Feel free to **file a new issue** with a respective title and description on the the Project repository. 

 
## 📘&nbsp; License
This project has been developed as part of the Source Data Science assessment. For this same reason this github repository has been kept private.