Code Monkey home page Code Monkey logo

cre-adapter's Introduction

Cannabis Reporting Engine Adapters

API Adapters for BioTrack, LeafData and METRC regulatory compliance engines These scripts expose a common interface for these different API interfaces.

Examples

There is a convenience factory method to use with the proper configuration (loaded from etc/cre.ini).

$cfg = \OpenTHC\CRE::getEngine('usa/wa');
$cre = \OpenTHC\CRE::factory($cfg);
$res = $cre->license()->search();
$res = $cre->crop()->search();
foreach ($res as $rec) {
	echo $rec['variety']['name'] . "\n";
}

$res = $cre->lot()->search();
foreach ($res as $rec) {
	echo $rec['id'] . ' ' . $rec['product_id'] . "\n";
}

Supported Cannabis Reporting Engines

  • BioTrack: Hawai'i, Illinois, New Mexico, Puerto Rico, Washington*
  • LeafData: Pennsylvania*, Utah* Washington
  • METRC: Alaska, California, Colorado, Maine, Massachusetts, Michigan, Montana, Nevada, Oklahoma, Oregon

Other engines will be added, of course :) Some of the engine specific adapters are very thin layers, they really only exist for consistency.

The services for BioTrack/Washington was for their official interface but is now for their system called UCS. For LeafData there is not yet an API available in Pennsylvania or Utah but we're keeping a watch on that.

Connect

$cre = \OpenTHC\CRE::factory($cfg);
$cre->ping();

Reading Objects

A low level, GET and POST/PUT interface exists.

$res = $cre->get('/object?page=0&sort=created_at');
$res = $cre->post('/object', $arg);
$res = $cre->put('/object/id', $arg);

High Level API

It's also possible to interface with the objects at a higher level.

$obj_list = $cre->license()->search($arg);
$obj = $cre->license()->single($oid);
$res = $cre->license()->create($obj);
$res = $cre->license()->update($obj);

cre-adapter's People

Contributors

djbusby avatar mashiox avatar thecompanydream avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cre-adapter's Issues

Implement Test Cases for Each CRE

First a basic test to make sure all the classes load extend/implement the correct interface.

Second is making calls to search() and single() functions to make sure those are working and returning consistent response data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.