AgTag Gateway
Python tools for reading, validating, converting, and loading AgTag .agseg binary segment data into PostgreSQL.
AgriGates Inc. This package is developed for AgriGates Inc. and is used to parse binary data generated by AgTag devices into a structured, tabular format for storage and analysis. The input files use
.agseg, a custom binary segment format designed specifically for AgTag devices.
Installation
pip install agtag-gateway
The package provides:
agseg-load— load an AGSEG export bundle into PostgreSQLagseg-dump— inspect and verify.agsegfilesagseg-to-csv— convert.agsegfiles to AgriGates-standard CSV
Load an AGSEG bundle into PostgreSQL
An AGSEG export bundle contains a manifest.json, metadata dump, and one or more .agseg segment files:
agtag_e001_20260911T185552Z/
├── manifest.json
├── meta.dump
└── segments/
├── e001_00000000_20260904T171023Z.agseg
├── e001_00000001_20260904T171146Z.agseg
└── e001_00000002_20260904T172910Z.agseg
Load the bundle with:
agseg-load /path/to/agtag_bundle \
--dsn "host=127.0.0.1 dbname=agtag user=agrigates password=YOUR_PASSWORD"
The loader:
- Verifies the bundle against
manifest.json. - Creates the required sensor table if needed.
- Restores bundle metadata.
- Verifies the CRC of each AGSEG record.
- Decodes the segment records.
- Inserts the decoded sensor data into PostgreSQL.
- Rebuilds the required views.
Options
Use a specific timezone for legacy date/time columns:
agseg-load /path/to/bundle \
--dsn "..." \
--tz America/New_York
Set the edge_id:
agseg-load /path/to/bundle \
--dsn "..." \
--edge-id 1
Verify the bundle without inserting data:
agseg-load /path/to/bundle \
--dsn "..." \
--verify-only
Skip metadata restoration:
agseg-load /path/to/bundle \
--dsn "..." \
--skip-meta
Store the original .agseg files in PostgreSQL
The package can optionally preserve the original binary .agseg files in PostgreSQL as BYTEA.
Use:
agseg-load /path/to/bundle \
--dsn "host=127.0.0.1 dbname=agtag user=agrigates password=YOUR_PASSWORD" \
--store-binary
With this option, the loader creates the following table when necessary:
CREATE TABLE IF NOT EXISTS agseg_files (
id BIGSERIAL PRIMARY KEY,
filename TEXT NOT NULL,
sha256 TEXT NOT NULL UNIQUE,
file_size BIGINT NOT NULL,
uploaded_at TIMESTAMPTZ NOT NULL DEFAULT now(),
content BYTEA NOT NULL
);
Each .agseg file is stored as its original binary content.
The SHA-256 hash is used to prevent duplicate files from being inserted.
This gives you both:
.agseg file
│
├── original binary ──> agseg_files.content (BYTEA)
│
└── decoded records ──> sensor_data
Inspect an AGSEG file
Display segment information:
agseg-dump info /path/to/file.agseg
Verify every record:
agseg-dump verify /path/to/file.agseg
Decode records:
agseg-dump dump /path/to/file.agseg
Decode using physical/scaled values:
agseg-dump dump /path/to/file.agseg --scaled
Verify an entire bundle:
agseg-dump bundle /path/to/bundle
Convert AGSEG to CSV
agseg-to-csv /path/to/file.agseg -o /path/to/output
Multiple segments can be supplied:
agseg-to-csv \
/path/to/segment1.agseg \
/path/to/segment2.agseg \
/path/to/segment3.agseg \
-o /path/to/output
AGSEG format
.agseg is a custom binary segment format designed for data generated by AgriGates AgTag devices. It contains compressed sensor records and is intended to provide an efficient representation of device data before conversion into structured tabular data.
The package includes the reference reader and validation tools. The detailed format specification is available in:
docs/agtag_binary_segment_format_v1.md
PostgreSQL
The package requires PostgreSQL for the database-loading functionality.
Python dependencies are installed automatically:
bleakpsycopg2-binaryzstandard
You do not need to install these separately when installing the package:
pip install agtag-gateway
License
MIT
Metadata
Release files for agtag-gateway 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agtag_gateway-0.1.1.tar.gz | 42.1 kB | Without provenance | Details for agtag_gateway-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agtag_gateway-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for agtag_gateway-0.1.1-py3-none-any.whl |
Total release size: 88.5 kB
Release files / agtag_gateway-0.1.1.tar.gz
| Download URL | agtag_gateway-0.1.1.tar.gz |
|---|---|
| Size | 42.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5e2595d8f88fa7504067f8d6c71a1ad0722b106c1dfb81d66e31ce8f898017f
|
|
BLAKE2b-256 checksum How to use checksums |
4bacf9365ea9756264a2df57906528d9bd2edf43d616eb0dca061207dfd5ff4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / agtag_gateway-0.1.1-py3-none-any.whl
| Download URL | agtag_gateway-0.1.1-py3-none-any.whl |
|---|---|
| Size | 46.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50367799f905e1030dc51f33690bf92e6441e3de0fda4c113abd4118e62f2c8e
|
|
BLAKE2b-256 checksum How to use checksums |
4176d53e5d4d7fa7a1a6ea8da71aa0ba1fd3043ac308b9fbe9a44865ab9bc3b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for agtag-gateway 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.