public
import "github.com/prescriptoo/prescriptoo-api/services/medicine/public"Package public defines medicine-owned catalog contracts and curated capabilities.
Index
- Variables
- type Brand
- type CatalogEmpty
- type CatalogSummary
- type CreateBrandCapability
- type CreateBrandInput
- type CreateBrandParams
- type CreateDrugCapability
- type CreateDrugInput
- type CreateDrugParams
- type CreateGenericCapability
- type CreateGenericInput
- type CreateGenericParams
- type CreateManufacturerCapability
- type CreateManufacturerInput
- type CreateManufacturerParams
- type DeleteBrandCapability
- type DeleteDrugCapability
- type DeleteGenericCapability
- type DeleteManufacturerCapability
- type Drug
- type DrugQuickSig
- type Generic
- type GetAdminBrandCapability
- type GetAdminDrugCapability
- type GetAdminGenericCapability
- type GetAdminManufacturerCapability
- type GetBrandCapability
- type GetDrugCapability
- type GetGenericCapability
- type GetManufacturerCapability
- type ListAdminBrandsCapability
- type ListAdminDrugsCapability
- type ListAdminGenericsCapability
- type ListAdminManufacturersCapability
- type ListBrandsCapability
- type ListDrugsCapability
- type ListGenericsCapability
- type ListInput
- type ListManufacturersCapability
- type Manufacturer
- type Metadata
- type Page
- type PatchBrandCapability
- type PatchBrandInput
- type PatchBrandParams
- type PatchDrugCapability
- type PatchDrugInput
- type PatchDrugParams
- type PatchGenericCapability
- type PatchGenericInput
- type PatchGenericParams
- type PatchManufacturerCapability
- type PatchManufacturerInput
- type PatchManufacturerParams
- type Query
- type RecordInput
- type RestoreBrandCapability
- type RestoreDrugCapability
- type RestoreGenericCapability
- type RestoreManufacturerCapability
Variables
Catalog errors are shared across the medicine capability boundary.
var (
ErrNotFound = errors.New("medicine catalog entry not found")
ErrInvalidInput = errors.New("invalid medicine catalog input")
ErrConflict = errors.New("medicine catalog conflict")
ErrUnavailable = errors.New("medicine catalog is unavailable")
)type Brand
Brand is a medicine-owned catalog record.
type Brand struct {
Metadata
Name string `json:"name"`
ManufacturerID string `json:"manufacturer_id"`
GenericID string `json:"generic_id"`
}type CatalogEmpty
CatalogEmpty represents the bodyless intended deletion response.
type CatalogEmpty struct{}type CatalogSummary
CatalogSummary supplies catalog display data without an extra lookup.
type CatalogSummary struct {
ID string `json:"id"`
Name string `json:"name"`
}type CreateBrandCapability
CreateBrandCapability exposes only the CreateBrand operation.
type CreateBrandCapability interface {
CreateBrand(context.Context, CreateBrandInput) (*Brand, error)
}type CreateBrandInput
CreateBrandInput carries credentials and editable parameters.
type CreateBrandInput struct {
Authorization string
Params CreateBrandParams
}type CreateBrandParams
CreateBrandParams contains client-editable catalog fields.
type CreateBrandParams struct {
Name string `json:"name" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
ManufacturerID string `json:"manufacturer_id" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
GenericID string `json:"generic_id" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status string `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}type CreateDrugCapability
CreateDrugCapability exposes only the CreateDrug operation.
type CreateDrugCapability interface {
CreateDrug(context.Context, CreateDrugInput) (*Drug, error)
}type CreateDrugInput
CreateDrugInput carries credentials and editable parameters.
type CreateDrugInput struct {
Authorization string
Params CreateDrugParams
}type CreateDrugParams
CreateDrugParams contains client-editable catalog fields.
type CreateDrugParams struct {
Route string `json:"route,omitempty" nullable:"false" maxLength:"255"`
TherapeuticClassID string `json:"therapeutic_class_id,omitempty" nullable:"false" maxLength:"255"`
Aliases []string `json:"aliases,omitempty" nullable:"false" maxItems:"50"`
IngredientIDs []string `json:"ingredient_ids,omitempty" nullable:"false" maxItems:"20"`
BrandID string `json:"brand_id" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Form string `json:"form" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Strength string `json:"strength" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status string `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}type CreateGenericCapability
CreateGenericCapability exposes only the CreateGeneric operation.
type CreateGenericCapability interface {
CreateGeneric(context.Context, CreateGenericInput) (*Generic, error)
}type CreateGenericInput
CreateGenericInput carries credentials and editable parameters.
type CreateGenericInput struct {
Authorization string
Params CreateGenericParams
}type CreateGenericParams
CreateGenericParams contains client-editable catalog fields.
type CreateGenericParams struct {
Name string `json:"name" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status string `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}type CreateManufacturerCapability
CreateManufacturerCapability exposes only the CreateManufacturer operation.
type CreateManufacturerCapability interface {
CreateManufacturer(context.Context, CreateManufacturerInput) (*Manufacturer, error)
}type CreateManufacturerInput
CreateManufacturerInput carries credentials and editable parameters.
type CreateManufacturerInput struct {
Authorization string
Params CreateManufacturerParams
}type CreateManufacturerParams
CreateManufacturerParams contains client-editable catalog fields.
type CreateManufacturerParams struct {
Name string `json:"name" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status string `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}type DeleteBrandCapability
DeleteBrandCapability exposes only the DeleteBrand operation.
type DeleteBrandCapability interface {
DeleteBrand(context.Context, RecordInput) (*CatalogEmpty, error)
}type DeleteDrugCapability
DeleteDrugCapability exposes only the DeleteDrug operation.
type DeleteDrugCapability interface {
DeleteDrug(context.Context, RecordInput) (*CatalogEmpty, error)
}type DeleteGenericCapability
DeleteGenericCapability exposes only the DeleteGeneric operation.
type DeleteGenericCapability interface {
DeleteGeneric(context.Context, RecordInput) (*CatalogEmpty, error)
}type DeleteManufacturerCapability
DeleteManufacturerCapability exposes only the DeleteManufacturer operation.
type DeleteManufacturerCapability interface {
DeleteManufacturer(context.Context, RecordInput) (*CatalogEmpty, error)
}type Drug
Drug is a medicine-owned catalog record.
type Drug struct {
Route string `json:"route"`
TherapeuticClassID string `json:"therapeutic_class_id"`
CatalogueVersion string `json:"catalogue_version"`
Aliases []string `json:"aliases" nullable:"false"`
IngredientIDs []string `json:"ingredient_ids" nullable:"false"`
QuickSigs []DrugQuickSig `json:"quick_sigs" nullable:"false"`
Metadata
BrandID string `json:"brand_id"`
Form string `json:"form"`
Strength string `json:"strength"`
Brand CatalogSummary `json:"brand"`
Generic CatalogSummary `json:"generic"`
Manufacturer CatalogSummary `json:"manufacturer"`
}type DrugQuickSig
DrugQuickSig describes a curated clinician-selected preset; no patient-specific dose validation is implied.
type DrugQuickSig struct {
ID string `json:"id"`
Label string `json:"label"`
Dose string `json:"dose"`
Frequency string `json:"frequency"`
Timing string `json:"timing"`
MealRelation string `json:"meal_relation"`
Duration string `json:"duration"`
}type Generic
Generic is a medicine-owned catalog record.
type Generic struct {
Metadata
Name string `json:"name"`
}type GetAdminBrandCapability
GetAdminBrandCapability exposes only the GetAdminBrand operation.
type GetAdminBrandCapability interface {
GetAdminBrand(context.Context, RecordInput) (*Brand, error)
}type GetAdminDrugCapability
GetAdminDrugCapability exposes only the GetAdminDrug operation.
type GetAdminDrugCapability interface {
GetAdminDrug(context.Context, RecordInput) (*Drug, error)
}type GetAdminGenericCapability
GetAdminGenericCapability exposes only the GetAdminGeneric operation.
type GetAdminGenericCapability interface {
GetAdminGeneric(context.Context, RecordInput) (*Generic, error)
}type GetAdminManufacturerCapability
GetAdminManufacturerCapability exposes only the GetAdminManufacturer operation.
type GetAdminManufacturerCapability interface {
GetAdminManufacturer(context.Context, RecordInput) (*Manufacturer, error)
}type GetBrandCapability
GetBrandCapability exposes only the GetBrand operation.
type GetBrandCapability interface {
GetBrand(context.Context, RecordInput) (*Brand, error)
}type GetDrugCapability
GetDrugCapability exposes only the GetDrug operation.
type GetDrugCapability interface {
GetDrug(context.Context, RecordInput) (*Drug, error)
}type GetGenericCapability
GetGenericCapability exposes only the GetGeneric operation.
type GetGenericCapability interface {
GetGeneric(context.Context, RecordInput) (*Generic, error)
}type GetManufacturerCapability
GetManufacturerCapability exposes only the GetManufacturer operation.
type GetManufacturerCapability interface {
GetManufacturer(context.Context, RecordInput) (*Manufacturer, error)
}type ListAdminBrandsCapability
ListAdminBrandsCapability exposes only the ListAdminBrands operation.
type ListAdminBrandsCapability interface {
ListAdminBrands(context.Context, ListInput) (*Page[Brand], error)
}type ListAdminDrugsCapability
ListAdminDrugsCapability exposes only the ListAdminDrugs operation.
type ListAdminDrugsCapability interface {
ListAdminDrugs(context.Context, ListInput) (*Page[Drug], error)
}type ListAdminGenericsCapability
ListAdminGenericsCapability exposes only the ListAdminGenerics operation.
type ListAdminGenericsCapability interface {
ListAdminGenerics(context.Context, ListInput) (*Page[Generic], error)
}type ListAdminManufacturersCapability
ListAdminManufacturersCapability exposes only the ListAdminManufacturers operation.
type ListAdminManufacturersCapability interface {
ListAdminManufacturers(context.Context, ListInput) (*Page[Manufacturer], error)
}type ListBrandsCapability
ListBrandsCapability exposes only the ListBrands operation.
type ListBrandsCapability interface {
ListBrands(context.Context, ListInput) (*Page[Brand], error)
}type ListDrugsCapability
ListDrugsCapability exposes only the ListDrugs operation.
type ListDrugsCapability interface {
ListDrugs(context.Context, ListInput) (*Page[Drug], error)
}type ListGenericsCapability
ListGenericsCapability exposes only the ListGenerics operation.
type ListGenericsCapability interface {
ListGenerics(context.Context, ListInput) (*Page[Generic], error)
}type ListInput
ListInput carries credentials separately from client-owned filters.
type ListInput struct {
Authorization string
Query Query
}type ListManufacturersCapability
ListManufacturersCapability exposes only the ListManufacturers operation.
type ListManufacturersCapability interface {
ListManufacturers(context.Context, ListInput) (*Page[Manufacturer], error)
}type Manufacturer
Manufacturer is a medicine-owned catalog record.
type Manufacturer struct {
Metadata
Name string `json:"name"`
}type Metadata
Metadata contains server-owned identifiers and lifecycle timestamps.
type Metadata struct {
ID string `json:"id"`
Status string `json:"status" enum:"active,inactive"`
Description *string `json:"description,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}type Page
Page is a newest-first cursor-paginated result.
type Page[T any] struct {
Items []T `json:"items" nullable:"false"`
NextCursor string `json:"next_cursor,omitempty"`
CurrentPage int `json:"current_page"`
PerPage int `json:"per_page"`
TotalPages int `json:"total_pages"`
TotalItems int `json:"total_items"`
}type PatchBrandCapability
PatchBrandCapability exposes only the PatchBrand operation.
type PatchBrandCapability interface {
PatchBrand(context.Context, PatchBrandInput) (*Brand, error)
}type PatchBrandInput
PatchBrandInput carries credentials and editable parameters.
type PatchBrandInput struct {
Authorization, ID string
Params PatchBrandParams
}type PatchBrandParams
PatchBrandParams contains client-editable catalog fields.
type PatchBrandParams struct {
Name *string `json:"name,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
ManufacturerID *string `json:"manufacturer_id,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
GenericID *string `json:"generic_id,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status *string `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
Supplied map[string]bool `json:"-"`
}func (*PatchBrandParams) UnmarshalJSON
func (p *PatchBrandParams) UnmarshalJSON(data []byte) errorUnmarshalJSON retains omission versus explicit description clearing.
type PatchDrugCapability
PatchDrugCapability exposes only the PatchDrug operation.
type PatchDrugCapability interface {
PatchDrug(context.Context, PatchDrugInput) (*Drug, error)
}type PatchDrugInput
PatchDrugInput carries credentials and editable parameters.
type PatchDrugInput struct {
Authorization, ID string
Params PatchDrugParams
}type PatchDrugParams
PatchDrugParams contains client-editable catalog fields.
type PatchDrugParams struct {
Route *string `json:"route,omitempty" nullable:"false" maxLength:"255"`
TherapeuticClassID *string `json:"therapeutic_class_id,omitempty" nullable:"false" maxLength:"255"`
Aliases *[]string `json:"aliases,omitempty" nullable:"false" maxItems:"50"`
IngredientIDs *[]string `json:"ingredient_ids,omitempty" nullable:"false" maxItems:"20"`
BrandID *string `json:"brand_id,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Form *string `json:"form,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Strength *string `json:"strength,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status *string `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
Supplied map[string]bool `json:"-"`
}func (*PatchDrugParams) UnmarshalJSON
func (p *PatchDrugParams) UnmarshalJSON(data []byte) errorUnmarshalJSON retains omission versus explicit description clearing.
type PatchGenericCapability
PatchGenericCapability exposes only the PatchGeneric operation.
type PatchGenericCapability interface {
PatchGeneric(context.Context, PatchGenericInput) (*Generic, error)
}type PatchGenericInput
PatchGenericInput carries credentials and editable parameters.
type PatchGenericInput struct {
Authorization, ID string
Params PatchGenericParams
}type PatchGenericParams
PatchGenericParams contains client-editable catalog fields.
type PatchGenericParams struct {
Name *string `json:"name,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status *string `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
Supplied map[string]bool `json:"-"`
}func (*PatchGenericParams) UnmarshalJSON
func (p *PatchGenericParams) UnmarshalJSON(data []byte) errorUnmarshalJSON retains omission versus explicit description clearing.
type PatchManufacturerCapability
PatchManufacturerCapability exposes only the PatchManufacturer operation.
type PatchManufacturerCapability interface {
PatchManufacturer(context.Context, PatchManufacturerInput) (*Manufacturer, error)
}type PatchManufacturerInput
PatchManufacturerInput carries credentials and editable parameters.
type PatchManufacturerInput struct {
Authorization, ID string
Params PatchManufacturerParams
}type PatchManufacturerParams
PatchManufacturerParams contains client-editable catalog fields.
type PatchManufacturerParams struct {
Name *string `json:"name,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
Status *string `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
Supplied map[string]bool `json:"-"`
}func (*PatchManufacturerParams) UnmarshalJSON
func (p *PatchManufacturerParams) UnmarshalJSON(data []byte) errorUnmarshalJSON retains omission versus explicit description clearing.
Example
PATCH distinguishes an omitted field from explicit null. This example only decodes the public contract used by the catalog use cases.
package main
import (
"encoding/json"
"fmt"
medicine "github.com/prescriptoo/prescriptoo-api/services/medicine/public"
)
func main() {
var patch medicine.PatchManufacturerParams
if err := json.Unmarshal([]byte(`{"description":null}`), &patch); err != nil {
panic(err)
}
fmt.Println("description supplied:", patch.Supplied["description"])
fmt.Println("description cleared:", patch.Description == nil)
fmt.Println("name preserved:", !patch.Supplied["name"])
}Output
description supplied: true
description cleared: true
name preserved: truetype Query
Query carries search, pagination and administrative visibility filters.
type Query struct {
Q, Cursor, ManufacturerID, GenericID, BrandID, Form, Status, Deletion string
Limit int
}type RecordInput
RecordInput carries credentials separately from the selected record.
type RecordInput struct{ Authorization, ID string }type RestoreBrandCapability
RestoreBrandCapability exposes only the RestoreBrand operation.
type RestoreBrandCapability interface {
RestoreBrand(context.Context, RecordInput) (*Brand, error)
}type RestoreDrugCapability
RestoreDrugCapability exposes only the RestoreDrug operation.
type RestoreDrugCapability interface {
RestoreDrug(context.Context, RecordInput) (*Drug, error)
}type RestoreGenericCapability
RestoreGenericCapability exposes only the RestoreGeneric operation.
type RestoreGenericCapability interface {
RestoreGeneric(context.Context, RecordInput) (*Generic, error)
}type RestoreManufacturerCapability
RestoreManufacturerCapability exposes only the RestoreManufacturer operation.
type RestoreManufacturerCapability interface {
RestoreManufacturer(context.Context, RecordInput) (*Manufacturer, error)
}Generated by gomarkdoc