Skip to content

fabriciolopretto/Temperature-Data-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

README_Temperature_Data_Application.md

Temperature Data Application

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.

Objective

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.

Repository Structure

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__/

Main Features

Add Records

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.

Modify Records

Users can update the temperature value for an existing hour.

Delete Records

Users can remove a previously stored hourly record.

Query Records

Users can query the stored temperature for a selected hour.

Plot Temperature Curve

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.

Database

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.

Logging

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.

Technologies Used

  • Python 3
  • Tkinter
  • Peewee
  • SQLite
  • Matplotlib
  • NumPy
  • Pillow
  • Sphinx

Installation

Clone the repository:

git clone https://github.com/fabriciolopretto/Temperature-Data-Application.git
cd Temperature-Data-Application/Aplicacion

Create and activate a virtual environment:

python -m venv .venv
source .venv/bin/activate

On Windows:

.venv\Scripts\activate

Install the required dependencies:

pip install matplotlib numpy pillow peewee

Tkinter is included with most standard Python installations. If it is missing, install the Tkinter package for your operating system.

Usage

Run the application from the Aplicacion/ directory:

python main.py

When the app starts:

  1. A reference window opens with input-format instructions.
  2. Close that reference window to continue.
  3. The main application window opens.
  4. Use the interface sections to add, modify, delete, query, or plot records.

Input Format

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.

Documentation

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 html

On Windows:

make.bat html

Notes

The 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.

About

Realiza un "CRUD" de datos de Temperatura, permitiendo persistirlos en una base de datos relacional y graficarlos.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors