README_Temperature_Data_Application.md
Desktop application for storing, editing, querying, and plotting hourly temperature records for a given day. The app uses a Tkinter graphical interface, stores records in a local SQLite database, and generates a temperature time-series plot with Matplotlib.
The project follows a simple MVC-style structure:
main.py: application controller and entry point.modelo.py: database model, CRUD operations, plotting, and logging.vista.py: Tkinter user interface.
Provide a small desktop tool for managing hourly temperature observations.
The application allows users to:
- Add hourly temperature records.
- Modify existing temperature records.
- Delete records.
- Query the temperature for a specific hour.
- Plot the daily hourly temperature curve.
- Store errors and invalid operations in a log file.
Temperature-Data-Application/
└── Aplicacion/
├── main.py
├── modelo.py
├── vista.py
├── mibase.db
├── log.txt
├── marcha.png
├── fondo.png
├── docs/
│ ├── index.rst
│ ├── primeros pasos.rst
│ ├── main.rst
│ ├── modelo.rst
│ ├── vista.rst
│ └── _build/
└── __pycache__/
Users can enter:
- Hour: integer value representing the observation hour.
- Temperature: real number in degrees Celsius.
The hour field is unique in the database, so duplicate hours are not allowed.
Users can update the temperature value for an existing hour.
Users can remove a previously stored hourly record.
Users can query the stored temperature for a selected hour.
The application generates a plot of hourly temperature against time and saves it as:
Aplicacion/marcha.png
The generated image is also displayed inside the Tkinter interface.
The application uses SQLite through Peewee ORM.
The database file is:
Aplicacion/mibase.db
The main table stores:
| Field | Type | Description |
|---|---|---|
hora |
Integer, unique | Observation hour. |
temperatura |
Float | Temperature in degrees Celsius. |
When the application starts, it checks whether a .db file already exists. If not, it creates the SQLite database and required table.
Invalid operations and database errors are written to:
Aplicacion/log.txt
Examples of logged situations include:
- Trying to insert a duplicated hour.
- Trying to modify, delete, or query a non-existing hour.
- Trying to plot without available data.
- Python 3
- Tkinter
- Peewee
- SQLite
- Matplotlib
- NumPy
- Pillow
- Sphinx
Clone the repository:
git clone https://github.com/fabriciolopretto/Temperature-Data-Application.git
cd Temperature-Data-Application/AplicacionCreate and activate a virtual environment:
python -m venv .venv
source .venv/bin/activateOn Windows:
.venv\Scripts\activateInstall the required dependencies:
pip install matplotlib numpy pillow peeweeTkinter is included with most standard Python installations. If it is missing, install the Tkinter package for your operating system.
Run the application from the Aplicacion/ directory:
python main.pyWhen the app starts:
- A reference window opens with input-format instructions.
- Close that reference window to continue.
- The main application window opens.
- Use the interface sections to add, modify, delete, query, or plot records.
The app expects:
- Hour: natural number, representing the hour in HOA/UTC-style hourly format.
- Temperature: real number in degrees Celsius. Decimal points and negative values are accepted.
The repository includes Sphinx documentation in:
Aplicacion/docs/
The built HTML documentation is already present in:
Aplicacion/docs/_build/html/
To rebuild the documentation from Aplicacion/docs/:
make htmlOn Windows:
make.bat htmlThe repository includes existing generated/runtime files such as mibase.db, marcha.png, and log.txt. These allow the app to start with previous data and a previously generated plot.
If the database or plot file does not exist yet, add at least one valid temperature record before trying to query or plot data.