https://github.com/openthc/bong
Basic Object Normalization Gateway
https://github.com/openthc/bong
seed-to-sale traceability
Last synced: about 1 month ago
JSON representation
Basic Object Normalization Gateway
- Host: GitHub
- URL: https://github.com/openthc/bong
- Owner: openthc
- License: mit
- Created: 2020-06-04T18:08:03.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-12-15T16:07:38.000Z (3 months ago)
- Last Synced: 2025-12-18T21:49:23.785Z (3 months ago)
- Topics: seed-to-sale, traceability
- Language: PHP
- Homepage: https://openthc.com/bong
- Size: 740 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Basic Object Normalization Gateway
Interfaces with multiple Cannabis APIs (BioTrack, CCRS, Metrc).
Normalizes to the OpenTHC API interfaces and data-models.
```mermaid
sequenceDiagram
App->>+Bong: Create Object (100)
Bong->>+CRE: Upload Object (102)
CRE-->>-Bong: Success (201)
Bong-->>-App: Success (201)
```
## Install
1. Clone this Repository to somewhere clever `git clone $REPO /opt/openthc/bong`
1. Update the Apache Config (use `etc/apache2-example.conf` as a template)
1. Create the Base Database from `etc/sql/*.sql` and add the triggers.
1. Configure in `etc/config.php` from `etc/config-example.php`
## Connect
You can use BONG through it's normal web-interface to view objects in real time or view logs.
BONG also provides an API -- so that other services can consume the data from the different back-ends easier.
### With JWT
```
curl --header "Bearer: jwt/$JWT" $BONG/auth/open
```
### With Session
```php
curl --cookie=cookie-file.dat $BONG/auth/open
```
## Sync & Cache
The APIs that BONG interfaces with don't all agree on how to do pages of data, or sorting, or filtering.
BONG has tools that work in the background to pull and cache data.
```
GET $BONG/status
GET $BONG/inventory/status
```
## Reading Objects
A low level, GET and POST/PUT interface exists.
```
GET https://$BONG/license
GET https://$BONG/license/current/status
GET https://$BONG/license/$ID/status
```
## Reading Crop
```
GET /crop
GET /crop?filter=(active|wet-collect|dry-collect|done|dead)
GET /crop?filter=and&f-[n0]=[v0]&f-[n1]=[v1]
GET /crop?filter=or&f-[n0]=[v0]&f-[n1]=[v1]
```
## Reading Inventory
```
GET /inventory
GET /inventory?filter=(active)
GET /inventory?filter=and
GET /inventory?filter=or
```
## Reading Transfer Data
```
GET /b2b
GET /b2b/outgoing?filter=(active)
GET /b2b/incoming?filter=(active)
GET /b2b?filter=and
GET /b2b?filter=or
```