- FlowMeterAI - is an AI-powered application that automates the reading of water and gas consumption meters through image analysis, providing real-time data processing and accurate measurements.
Ensure you have the following installed:
- Docker
-
Clone the Repository
git clone https://github.com/lucasbrasantos/FlowMeterAI.git cd FlowMeterAI
-
Build and Start the Containers
Build and start the Docker containers using Docker Compose:
docker-compose up --build
This command will build the Docker images for the Node.js application and PostgreSQL database, then start the containers.
To stop the Docker containers, use the following command:
docker-compose down
This will stop and remove the containers, but the database data will persist.
- Ensure Docker and Docker Compose are up-to-date to avoid compatibility issues.
- Adjust environment variables and configuration in
docker-compose.yml
and.env
files as needed for different environments.
Uploads an image of a water or gas meter, processes it to extract the reading, and stores the information.
-
Request Body:
customer_code
: Unique identifier for the customer (required).measure_datetime
: Date and time of the measurement (format: YYYY-MM-DDTHH:MM:SS, optional).measure_type
: Type of meter ("WATER" or "GAS", required).image
: The image file (sent as form-data with keyimage
, required).
-
Response:
- 200 OK: Returns the URI of the uploaded image and the extracted measurement.
- 400 Bad Request: If any required fields are missing or invalid.
- 409 Conflict: If a measurement for this customer and type already exists for the current month.
- 500 Internal Server Error: If the upload or processing fails.
Retrieves a list of measurements for a specific customer.
-
URL Parameters:
customer_code
: The unique identifier for the customer (required).
-
Query Parameters:
measure_type
(optional): Type of measurement to filter by ("WATER" or "GAS").
-
Response:
- 200 OK: Returns a list of measurements for the given customer code.
- 400 Bad Request: If the
measure_type
is invalid. - 404 Not Found: If no measurements are found for the given customer code.
- 500 Internal Server Error: If there is an issue retrieving the measurements.
Confirms or updates the measurement value for a given reading.
-
Request Body:
measure_uuid
: UUID of the measurement to be updated (required).confirmed_value
: The confirmed or corrected value of the measurement (required).
-
Response:
- 200 OK: Indicates successful confirmation or update.
- 400 Bad Request: If the request body is invalid or the measurement does not exist.
- 404 Not Found: If the measurement UUID does not exist.
- 409 Conflict: If the measurement has already been confirmed.
- 500 Internal Server Error: If the update or confirmation fails.
-
Endpoint:
POST /upload
-
Body:
{
"image": "Path to the image file (e.g., /path/to/image.jpg)",
"customer_code": 1234,
"measure_datetime": "30/08/2024",
"measure_type": "gas"
}
- Example Response:
{ "measure_uuid": "13f3678a-7435-4c24-acf3-23e23e548369", "recognized_value": 1234, "temporary_link": "http://example.com/temp/13f3678a.jpg" }
- Endpoint:
PATCH /confirm
- Body:
{ "measure_uuid": "13f3678a-7435-4c24-acf3-23e23e548369", "confirmed_value": 123123 }
- Example Response:
{ "status": "success", }
- Endpoint:
GET /<customer_code>/list
- Query Parameters:
measure_type
:gas
measure_type
:water
- Example Response:
[ { "measure_uuid": "13f3678a-7435-4c24-acf3-23e23e548369", "value": 1234, "datetime": "2024-08-30T14:30:00", "measure_type": "gas" } ]
This project is licensed under the MIT License - see the LICENSE file for details.