Documentation
¶
Index ¶
- Constants
- func CSVString(str string) string
- func IsBrandErroneous(b *Brand) bool
- func IsEmptyMeasurement(str string) bool
- func IsErrorMeasurement(str string) bool
- func IsTraceMeasurement(str string) bool
- func RegisterMCP(mcpServer *mcp_server.MCPServer, conn *sql.DB) error
- type Brand
- type Image
- type Measure
- func (m Measure) Amount() (result float64, trace bool, empty bool)
- func (m Measure) AsCSV() string
- func (m Measure) AsSQL() string
- func (m *Measure) FromString(str string) error
- func (m Measure) IsEmpty() bool
- func (m Measure) IsEqual(other Measure) bool
- func (m Measure) IsNil() bool
- func (m Measure) IsTrace() bool
- func (m Measure) IsValidPercent() bool
- func (m Measure) IsZero() bool
- func (m Measure) MarshalCSV() (string, error)
- func (m *Measure) MarshalJSON() ([]byte, error)
- func (m *Measure) UnmarshalCSV(value string) error
- func (m *Measure) UnmarshalJSON(b []byte) error
- func (m Measure) Value() (driver.Value, error)
Constants ¶
const ( BRAND_JSON_FILENAME = "us_ct_brands.json" BRAND_CSV_FILENAME = "us_ct_brands.csv" // CTBrandsURL is the URL to fetch the CT cannabis brands data BrandsURL = "https://data.ct.gov/resource/egd5-wb6r.json" )
Variables ¶
This section is empty.
Functions ¶
func IsBrandErroneous ¶
IsBrandErroneous checks if the brand is erroneous, returning true if it is
func IsEmptyMeasurement ¶
IsEmptyMeasurement returns true if the string is considered a trace measure Examples are: "" and "<0.1"
func IsErrorMeasurement ¶
IsErrorMeasurement returns true if the string is considered to be erroneous Examples are:
func IsTraceMeasurement ¶
IsTraceMeasurement returns true if the string is considered a trace measure Examples are: "TRC" "<LOQ" and "<0.1"
func RegisterMCP ¶
func RegisterMCP(mcpServer *mcp_server.MCPServer, conn *sql.DB) error
RegisterMCP registers CT MCP tools with the MCPServer
Types ¶
type Brand ¶
type Brand struct {
BrandName string `csv:"BRAND-NAME" json:"brand_name"`
DosageForm string `csv:"DOSAGE-FORM" json:"dosage_form"`
BrandingEntity string `csv:"BRANDING-ENTITY" json:"branding_entity"`
ProductImage Image `csv:"PRODUCT-IMAGE" json:"product_image"`
LabelImage Image `csv:"LABEL-IMAGE" json:"label_image"`
LabAnalysis Image `csv:"LAB-ANALYSIS" json:"lab_analysis"`
ApprovalDate iso8601.Time `csv:"APPROVAL-DATE" json:"approval_date"`
RegistrationNumber string `csv:"REGISTRATION-NUMBER" json:"registration_number"`
TetrahydrocannabinolThc Measure `csv:"TETRAHYDROCANNABINOL-THC" json:"tetrahydrocannabinol_thc"`
TetrahydrocannabinolAcidThca Measure `csv:"TETRAHYDROCANNABINOL-ACID-THCA" json:"tetrahydrocannabinol_acid_thca"`
CannabidiolsCbd Measure `csv:"CANNABIDIOLS-CBD" json:"cannabidiols_cbd"`
CannabidiolAcidCbda Measure `csv:"CANNABIDIOL-ACID-CBDA" json:"cannabidiol_acid_cbda"`
APinene Measure `csv:"A-PINENE" json:"a_pinene"`
BMyrcene Measure `csv:"B-MYRCENE" json:"b_myrcene"`
BCaryophyllene Measure `csv:"B-CARYOPHYLLENE" json:"b_caryophyllene"`
BPinene Measure `csv:"B-PINENE" json:"b_pinene"`
Limonene Measure `csv:"LIMONENE" json:"limonene"`
Ocimene Measure `csv:"OCIMENE" json:"ocimene"`
LinaloolLin Measure `csv:"LINALOOL-LIN" json:"linalool_lin"`
HumuleneHum Measure `csv:"HUMULENE-HUM" json:"humulene_hum"`
Cbg Measure `csv:"CBG" json:"cbg"`
CbgA Measure `csv:"CBG-A" json:"cbg_a"`
CannabavarinCbdv Measure `csv:"CANNABAVARIN-CBDV" json:"cannabavarin_cbdv"`
CannabichromeneCbc Measure `csv:"CANNABICHROMENE-CBC" json:"cannabichromene_cbc"`
CannbinolCbn Measure `csv:"CANNBINO-CBN" json:"cannbinol_cbn"`
TetrahydrocannabivarinThcv Measure `csv:"TETRAHYDROCANNABIVARIN-THCV" json:"tetrahydrocannabivarin_thcv"`
ABisabolol Measure `csv:"A-BISABOLOL" json:"a_bisabolol"`
APhellandrene Measure `csv:"A-PHELLANDRENE" json:"a_phellandrene"`
ATerpinene Measure `csv:"A-TERPINENE" json:"a_terpinene"`
BEudesmol Measure `csv:"B-EUDESMOL" json:"b_eudesmol"`
BTerpinene Measure `csv:"B-TERPINENE" json:"b_terpinene"`
Fenchone Measure `csv:"FENCHONE" json:"fenchone"`
Pulegol Measure `csv:"PULEGOL" json:"pulegol"`
Borneol Measure `csv:"BORNEOL" json:"borneol"`
Isopulegol Measure `csv:"ISOPULEGOL" json:"isopulegol"`
Carene Measure `csv:"CARENE" json:"carene"`
Camphene Measure `csv:"CAMPHENE" json:"camphene"`
Camphor Measure `csv:"CAMPHOR" json:"camphor"`
CaryophylleneOxide Measure `csv:"CARYOPHYLLENE_OXIDE" json:"caryophyllene_oxide"`
Cedrol Measure `csv:"CEDROL" json:"cedrol"`
Eucalyptol Measure `csv:"EUCALYPTOL" json:"eucalyptol"`
Geraniol Measure `csv:"GERANIOL" json:"geraniol"`
Guaiol Measure `csv:"GUAIOL" json:"guaiol"`
GeranylAcetate Measure `csv:"GERANYL_ACETATE" json:"geranyl_acetate"`
Isoborneol Measure `csv:"ISOBORNEOL" json:"isoborneol"`
Menthol Measure `csv:"MENTHOL" json:"menthol"`
LFenchone Measure `csv:"L-FENCHONE" json:"l_fenchone"`
Nerol Measure `csv:"NEROL" json:"nerol"`
Sabinene Measure `csv:"SABINENE" json:"sabinene"`
Terpineol Measure `csv:"TERPINEOL" json:"terpineol"`
Terpinolene Measure `csv:"TERPINOLENE" json:"terpinolene"`
TransBFarnesene Measure `csv:"TRANS-B-FARNESENE" json:"trans_b_farnesene"`
Valencene Measure `csv:"VALENCENE" json:"valencene"`
ACedrene Measure `csv:"A-CEDRENE" json:"a_cedrene"`
AFarnesene Measure `csv:"A-FARNESENE" json:"a_farnesene"`
BFarnesene Measure `csv:"B-FARNESENE" json:"b_farnesene"`
CisNerolidol Measure `csv:"CIS-NEROLIDOL" json:"cis_nerolidol"`
Fenchol Measure `csv:"FENCHOL" json:"fenchol"`
TransNerolidol Measure `csv:"TRANS-NEROLIDOL" json:"trans_nerolidol"`
Market string `csv:"Market" json:"market"`
Chemotype string `csv:"Chemotype" json:"chemotype"`
ProcessingTechnique string `csv:"Processing Technique" json:"processing_technique"`
SolventsUsed string `csv:"Solvents Used" json:"solvents_used"`
NationalDrugCode string `csv:"National Drug Code" json:"national_drug_code"`
}
Raw Cannabis Brand Record
func CleanBrands ¶
CleanBrands modifies the passed brand slice in place, filtering out bad Brand samples using IsBrandErroneous(). It returns the cleaned slice.
func FetchBrands ¶
FetchBrands fetches all the CT cannabis brands data from the CT API
func (Brand) CSVHeaders ¶
CSVHeaders returns the CSV headers for the Brand struct
type Measure ¶
type Measure struct {
// contains filtered or unexported fields
}
Measure tracks a a measurement, with special flags for no-measurment and trace measurement
func NewEmptyMeasure ¶
func NewEmptyMeasure() Measure
NewEmptyMeasure creates a new "empty" measure. This may also be created through nil-initialization Measure{}
func NewErrorMeasure ¶
func NewErrorMeasure() Measure
NewErrorMeasure creates a new "error" measure.
func NewMeasure ¶
NewMeasure creates a new measure with the given amount. Any amount < 0, will be treated as a trace measurement. To create an "empty" Measure object, use nil-initialization Measure{} or NewEmptyMeasure
func NewTraceMeasure ¶
func NewTraceMeasure() Measure
NewTraceMeasure creates a new "trace amount" measure.
func (Measure) Amount ¶
Amount returns the value, isTrace, isEmpty If it is a trace amount, result will be 0 and isTrace will be true If it is an empty value, result will be 0 and isEmpty will be true
func (Measure) AsSQL ¶
AsSQL converts the measure to "NULL" or "<amount>". Trace is converted to NULL.
func (*Measure) FromString ¶
FromString modifies the given measure based on the passed string It undergoes some cleaning and Trace and Empty detection
func (Measure) IsEmpty ¶
IsEmpty returns true if the measure is empty (no measurement) Same as IsNil
func (Measure) IsValidPercent ¶
IsValidPercent returns true if the measure is a valid percentage (0-100)
func (Measure) MarshalCSV ¶
MarshalCSV marshals the measure to a CSV string
func (*Measure) MarshalJSON ¶
MarshalJSON converts the measure to JSON, which is a string
func (*Measure) UnmarshalCSV ¶
UnmarshalCSV unmarshals the measure from a CSV string
func (*Measure) UnmarshalJSON ¶
MarshalJSON converts the measure from JSON, which can be string or number