Releases: williamveith/wastetags
v2.3.0 New Add Chemical Feature, Streamlined Versioning
Highlights
-
Add Chemical Method Fully Implemented & Tested
- A new
AddChemical
workflow to handle the creation of chemical entries, including CAS number validation and alias insertions. - A dedicated API endpoint (
/api/get-cas
) that checks the database for existing chemical records, reducing data duplication. - Enhanced error handling and user feedback for chemical creation and lookups.
- A new
-
Improved CAS Number Validation
- CAS validation logic has been relocated from
input-validators.js
to a dedicated module (cas-api.js
), ensuring cleaner separation of concerns and easier maintainability. - JavaScript validation checks and in-application checks help prevent invalid CAS entries.
- CAS validation logic has been relocated from
-
GitHub Actions & Workflow Updates
- Updated the GitHub Action (
.github/workflows/build-and-release.yml
) to automatically useTAG: "v2.3.0"
for consistent versioning in releases. - Streamlined binary release creation: the final artifact’s tag and name are automatically updated to the new version.
- Improved instructions for creating new Git tags and triggering the build using
gh api
.
- Updated the GitHub Action (
-
Documentation Enhancements
- README.md now includes clearer instructions for:
- Creating new tags and triggering binary compilation via GitHub Actions.
- Understanding the general usage flow of the Waste Tagging System.
- README.md now includes clearer instructions for:
-
Under-the-Hood Improvements
- New SQL scripts (
insert_chemical.sql
andinsert_alias.sql
) to handle chemical and alias insertions more reliably. - Code cleanup to reduce redundancy and improve overall system stability.
- New SQL scripts (
Detailed Changelog
Added
InsertNewChemical
Function
Inserts new chemical entries along with a corresponding alias into the database./api/get-cas
Endpoint
Checks if a chemical entry already exists by CAS number. Returns detailed JSON feedback on success or failure.
Changed
- GitHub Action (
build-and-release.yml
)- Now references an environment variable
TAG: "v2.3.0"
for versioning. - Updated release artifacts to use
name: ${{ env.TAG }}
andtag: ${{ env.TAG }}
.
- Now references an environment variable
- JavaScript CAS Validation
- Removed old CAS validation logic in
input-validators.js
and replaced it with the newcas-api.js
module for improved accuracy and maintainability.
- Removed old CAS validation logic in
README.md
- Added a new “Github Action” section with usage and tagging instructions.
- Updated usage flow details to reflect the new chemical-add workflow.
Fixed
- Minor bugs in CAS validation that previously allowed incorrect numbers to pass.
- Potential edge cases in adding a new chemical where aliases were not always inserted correctly.
Removed
- Redundant CAS validation logic from
input-validators.js
, superseded by the newcas-api.js
.
Upgrade Notes
- Pull the Latest Code: Ensure you have the latest
main
ormaster
branch which includes the new tags and updated workflows. - Use New Tagging Approach: Follow the updated instructions in the README for creating new tags and triggering binary builds via GitHub Actions.
- Check CAS-Related Logic: If you had custom CAS validation or used the old
input-validators.js
approach, update your references to the newcas-api.js
module.
v2.2.0
Comparing changes from v2.1.0 to v2.2.0
1. Database & Schema Improvements
- Alias & Mixtures
- Introduced a new
alias
table and supportingmixtures_internal_names
view to more easily associate chemicals with mixtures. - Updated
schema.sql
to create triggers that ensure consistency between thealias
andmixtures
tables when display names change. - Added updated Protobuf export/import definitions to include the new
alias
data.
- Introduced a new
2. Add Mixture Workflow
- New “Add Mixture” Form
- Created a skeleton page (
add-mixture.html
) to facilitate adding mixtures with multiple components. - Implemented basic styling (
add-mixture.css
), client-side validation, and dynamic row management for adding or removing components.
- Created a skeleton page (
3. QR Code & UI Enhancements
- Copy QR Code Data to Clipboard
- Added a click handler on QR code images to copy the JSON content directly to the clipboard.
- Improved the waste-tag template (
waste-tag.html
) to display better user feedback and streamline the printing process.
- Help Menus & Preloading Scripts
- Updated waste tag forms to include small info popups (help text) and preloaded scripts to optimize page loading.
4. Build & Deployment Pipeline
- Docker Compose Build
- Finished configuring a Docker Compose workflow to build for Linux (ARM64) targets, with instructions for Raspberry Pi deployment.
- Introduced a minimal final image using
busybox
for smaller container sizes.
- GitHub Actions for Auto-Deploy
- Created a new
build-and-release.yml
workflow that can autodeploy Raspberry Pi–compatible binaries on tag or repository dispatch events. - Hardcoded test tags to validate the pipeline.
- Created a new
- Makefile & Tooling
- Refined the Makefile to unify local development, container builds, and minification steps.
- Reorganized Dockerfiles (e.g.,
CompileGo.Dockerfile
,MinifyJS.Dockerfile
,MinifyCSS.Dockerfile
) into logical folders.
5. Minor Fixes & Housekeeping
- Removed
.github
from.gitignore
to allow GitHub workflow files to remain in source control. - Cleaned up repeated or unused Docker instructions, ensuring the container build steps remain consistent across development and production.
Improved data validation, build optimization, and configs embedding
v2.1.0
🚀 Overview
Version v2.1.0 builds on the significant refactoring and modernization introduced in v2.0.0. This release refines our Add Chemical and Add Mixture workflows, enhances the overall developer/user experience through improved error handling, and streamlines Docker-based build processes. We’ve also incorporated additional validation checks and minor UI/UX tweaks to ensure smoother deployments and daily usage.
🔑 Key Highlights
-
Improved CAS Number Validation
- The Add Chemical form now enforces more robust checks for CAS numbers, preventing malformed inputs.
- Enhanced JavaScript-based validation for numeric fields and standardized messages to guide users.
-
Refined Mixture Interface
- The Add Mixture page lays groundwork for combining multiple chemicals into a single record.
- Though still under development, core features are in place for basic mixture creation.
-
Docker Build Optimization
- Linux Docker-based builds are now more efficient:
- Reduced build image size.
- Faster build times due to refined caching layers and minimal base images.
- Linux Docker-based builds are now more efficient:
-
UI Enhancements
- CSS tweaks and layout adjustments for mobile compatibility.
- Updated footer and navbar for a consistent, clean look.
-
Expanded Logging & Error Reporting
- More granular logs in both CLI and systemd-based deployments.
- Clearer error messages for debugging database connectivity and configuration issues.
📄 Changes & Improvements
- Build Tools:
- Adjusted Makefile targets for faster local development cycles (
make dev
). - Streamlined artifact output structure under
bin/
to match newly introduced directory patterns.
- Adjusted Makefile targets for faster local development cycles (
- Service Stability:
- Improved systemd handling for Linux (
wastetags.service
), ensuring correct restarts on crash or reboot. - More graceful error handling if the database file is locked or missing on startup.
- Improved systemd handling for Linux (
- Documentation:
- Additional notes on config usage and environment variables.
- Clarified upgrade steps for existing deployments.
⚙️ Upgrading to v2.1.0
- Pull or Download
git fetch --tags && git checkout v2.1.0
- Or download the release from GitHub directly.
- Build
- Linux:
make linux
- macOS:
make mac
- Development:
make dev
- Linux:
- Deploy
- For Linux, run
make push-linux
to copy artifacts and restart the systemd service. - For other platforms, copy the generated binary and config files into your environment manually.
- For Linux, run
- Verify
- Check logs to confirm a successful start.
- Ensure your existing waste tags, database records, and UI pages load correctly.
🔎 Known Issues
- Mixture Functionality: Still incomplete; advanced mixture editing will arrive in future releases.
- OS-Specific Config Overlaps: If you are running multiple OS-based builds in parallel (e.g., macOS for dev, Linux for production), ensure you specify correct config flags (
--dev
,--config
, etc.).
🔮 Looking Ahead
- Enhanced Automated Testing: We aim to broaden test coverage, especially around mixtures and QR generation routines.
- CI/CD Pipeline: Integration with additional CI providers for cross-platform build validations.
Easy Configuration, Automated Build/Test/Deploy Tools
🚀 Overview
This release introduces a significant re-architecture and modernization of our build process and project structure. With v2.0.0, we have:
- Modularized components to improve code maintainability and reusability.
- Introduced OS-specific configuration files, enabling platform-targeted deployments.
- Implemented refined build tools using Docker-based builds for Linux and native
go build
processes for macOS and development environments.
These changes streamline the workflow for developers, DevOps engineers, and system administrators alike, reducing complexity and ensuring more reliable, repeatable builds.
🔑 Key Highlights
-
Modularization of Components
- The codebase has been reorganized to better separate concerns and functionalities.
- Common functionality has been moved into
pkg/
, making it easier to reuse database connections, ID generation logic, and QR code generation. - Command-line (CLI) logic and templating reside in
cmd/wastetags/
, simplifying the main application structure.
-
OS-Specific Configurations
- Configuration files for Linux, macOS, and development builds are now neatly segregated under
configs/
. - Linux builds use
linux.json
to configure production deployments. - macOS builds use
macos.json
for Apple platform–aligned setups. - Dev builds use
dev.json
for rapid development and testing cycles.
- Configuration files for Linux, macOS, and development builds are now neatly segregated under
-
Enhanced Build & Deployment Workflow
- The
Makefile
now supports platform-specific targets:make linux
builds via Docker for consistent environment replication.make mac
relies on nativego build
for macOS.make dev
provides a streamlined development build.
- A new
push-linux
target deploys Linux artifacts to a remote host, ensuring smooth updates and service restarts post-deployment.
- The
-
Service Configuration for Linux
- The
wastetags.service
file is included and automatically installed as a systemd service for Linux deployments. - This ensures
wastetags
can easily start on boot and be managed via systemd.
- The
-
Data & Asset Management
data/chemicals.sqlite3
is integrated into the deployment workflow, ensuring the database is correctly placed at/var/lib/wastetags/
.- Templates, CSS, JS, and images are organized under
cmd/wastetags/assets/
andcmd/wastetags/templates/
for easy UI component serving.
📁 Directory Structure
├── Makefile
├── README.md
├── bin/
│ └── linux/
│ ├── config.json
│ ├── wastetags
│ └── wastetags.service
├── build/
│ ├── linux/
│ │ ├── Dockerfile
│ │ └── wastetags.service
│ └── mac/
│ ├── Info.plist
│ └── iconfile.icns
├── cmd/
│ └── wastetags/
│ ├── addchemical.go
│ ├── addmixture.go
│ ├── assets/...
│ ├── home.go
│ ├── main.go
│ ├── query/...
│ ├── templates/...
│ ├── wastetag.go
│ └── wastetagform.go
├── configs/
│ ├── dev.json
│ ├── linux.json
│ └── macos.json
├── data/
│ └── chemicals.sqlite3
├── pkg/
│ ├── database/database.go
│ ├── idgen/idgen.go
│ └── qrcodegen/qrcodegen.go
└── qrSchema/
├── v0.js
├── v0.json
├── v1.js
└── v1.json
⚙️ How to Build
Linux Build:
make linux
- Docker-based build and artifact placement in
bin/linux/
. - Copies
linux.json
andwastetags.service
.
macOS Build:
make mac
- Native
go build
for macOS. - Copies
macos.json
andchemicals.sqlite3
tobin/macos/
.
Development Build:
make dev
- Dev environment build with
dev.json
config.
▶️ Running the Application
-
Linux:
make run-linux
-
macOS:
make run-mac
-
Development:
make run-dev
📤 Deployment (Linux)
make push-linux
This will:
- Clean and rebuild the Linux artifacts.
- Securely copy the binary, config, and database to the remote server.
- Move them to their final destinations:
/usr/local/bin/wastetags
/etc/wastetags/config.json
/var/lib/wastetags/chemicals.sqlite3
- Restart the
wastetags
service.
🔧 Known Issues & Future Enhancements
-
Known Issues:
- None identified at this time.
-
Planned Enhancements:
- Enhanced CI/CD integration for automated tests.
- Cross-platform testing improvements.
- Additional configuration management for other UNIX-like platforms.
Full Changelog: https://github.com/williamveith/wastetags/commits/v2.0.0
Add Chemicals, Generate QR Codes, Simplify Labels
🚀 New Features
-
Chemical and Mixture Addition:
- Added
addChemical
andaddMixture
endpoints for submitting chemical and mixture data. - Supports CAS number input formatted as
XXX-XX-X
and chemical names.
- Added
-
QR Code Generation:
- Implemented functionality to generate QR codes for waste tags.
- Supports dynamic JSON payloads with embedded component data.
- Includes
makeCopy
for cloning QR code data with unique tags.
-
Waste Label Management:
completedWasteTag
generates detailed waste tags with QR codes and chemical components.- Form-based UI for creating and submitting waste tags, accessible via
/create-tag
.
-
Embedded Resources:
- Integrated embedded templates and assets for streamlined deployment.
- Embedded SQL files for schema and query management.
🛠 Enhancements
-
Database Initialization:
- Automated SQLite database creation and schema loading from embedded SQL.
- Structured data retrieval for chemicals, mixtures, locations, units, and containers.
-
Improved Middleware:
- Added
addCurrentPathMiddleware
for consistent route tracking and path management in templates.
- Added
-
Simplified Routing:
- Centralized routing logic with
pageHandler
for uniform HTML rendering.
- Centralized routing logic with
🐛 Bug Fixes
- Improved error handling for database queries and QR code generation.
- Fixed type assertions for retrieved database values to prevent runtime errors.
- Enhanced form validation for chemical and mixture submission.
🔧 Maintenance
- Refactored database operations to use shared SQL templates.
- Standardized naming conventions across handlers and middleware.
- Added robust error logging for easier debugging.
📚 Documentation
- Updated inline comments for clarity on new and existing features.
- Rewritten README to explain new features & how to build/use app
🌐 Routes Overview
- Home Page:
/home
- Waste Tag Creation:
/create-tag
- Add Chemical:
/add-chemical
- Add Mixture:
/add-mixture
- QR Code API:
/api/generate-qr
📦 Dependencies
github.com/gin-gonic/gin
for HTTP handling.github.com/williamveith/wastetags/pkg/database
for database operations.github.com/google/uuid
for generating unique identifiers.github.com/williamveith/wastetags/pkg/qrcodegen
for QR code generation.
Full Changelog: v1.0.0...v1.1.0
WasteTag Generator v1.0.0
Overview
This is the initial release of the WasteTag Generator system. The system provides a web-based form to generate physical waste tags that encode chemical waste information within a QR code. Once a tag is printed and attached to a container, waste disposal personnel can scan the QR code to automatically submit the waste data into a central disposal system.
Purpose
The introduction of the WasteTag Generator replaces a previously manual and error-prone process:
-
Old Process: Each waste container’s identifying tag was handwritten. Operators later transcribed these hand-written tags into a form, leading to potential errors, delays, and extra administrative work.
-
New Process: A digital form ensures accurate data entry at the source. Once submitted, the system generates a printable tag, complete with a QR code. The QR code encapsulates all necessary waste information. Scanning the code bypasses manual data re-entry, streamlining the disposal workflow and improving data accuracy.
Key Features
-
Digital Data Collection:
Users fill out a web-based form selecting the chemical mixture, location, container type, and other relevant details directly from validated dropdown lists sourced from a central database. -
Automated QR Code Generation:
Upon form submission, a unique identifier (waste tag number) is generated and embedded in a JSON structure. This data is then encoded as a QR code, which is displayed in the browser and can be printed directly onto a label. -
Database Integration:
The system uses a SQLite database to store:- Available chemical mixtures (with component percentages)
- Locations
- Units of measure
- Container types
- Physical states of materials
Users select these standardized values from dropdown menus, ensuring consistent and valid data entry.
-
Printable Tags:
The final web page displays a cleanly formatted label with:- Room number (location)
- Tag number (unique waste identifier)
- Generator name
- List of chemical components and their percentages
- A QR code encoding all waste tag data
Operators can print this label and attach it to the waste container.
Technology Stack
-
Backend:
- Go (Golang) for main server logic
- SQLite database for persistent storage
-
Frontend:
- HTML templates (embedded via
embed.FS
) - Gin web framework for routing and form handling
- HTML templates (embedded via
-
QR Code Generation:
github.com/skip2/go-qrcode
for generating inline PNG QR codes
Code Organization
-
main.go:
The primary entry point. Initializes the database, sets up routing using Gin, and defines handlers for the form and tag generation. -
database.go (in package
database
):
Handles database initialization, querying for dropdown values, and retrieving chemical mixture components. -
qrcodegen.go (in package
qrcodegen
):
Manages QR code creation as data URIs for inline embedding. -
templates/ directory:
Contains HTML templates for the input form (tag-form.html
) and the final output tag (tag.html
). -
query/ directory:
Includes SQL files for the schema and queries used to retrieve data. -
Makefile:
Provides convenient build and run targets.make build
: Builds the Wails application and generates the executable.make run
: Runs the built application immediately after building.
Installation & Setup
-
Building the Application:
make build
-
Running the Application:
make run
The server runs at
http://localhost:8080
.
Usage
- Navigate to
http://localhost:8080
. - Fill out the form, selecting the chemical mixture, container details, and location from dropdown menus.
- Submit the form.
- The system generates a printable waste tag with a QR code.
- Print and attach the tag to the waste container.
- Scanning the QR code at the disposal stage provides a fast, accurate way to submit waste information without re-entry.
Known Limitations and Future Enhancements
- Manual Printing: Users currently print the tag from their browser. Future versions may integrate directly with label printers.
- Reporting & Audit Trails: Future releases may include dashboards or APIs to track waste tags over time.
- UI to Add New Chemicals and Mixtures: A planned feature is a dedicated UI where authorized users can add new chemicals, define their mixtures, and update reference data directly from the application. This will simplify database maintenance and ensure the system stays current with available chemicals and waste components.