public
import "github.com/prescriptoo/prescriptoo-api/services/prescription/public"Package public exposes prescription-owned clinical contracts.
Index
- Variables
- type AdviceItem
- type Association
- type CancelPrescriptionInput
- type CancelPrescriptionParams
- type ClinicalContent
- type Complaint
- type ComplaintDetails
- type CreatePrescriptionInput
- type CreatePrescriptionParams
- type CustomClinicalDetail
- type Diagnosis
- type DoctorSnapshot
- type Duration
- type FollowUp
- type GetPatientHistoryInput
- type GetPrescriptionInput
- type HistoryItem
- type InvestigationOrder
- type IssuePrescriptionInput
- type IssuePrescriptionParams
- type ListPrescriptionsInput
- type ListSuggestionsInput
- type MedicationDuration
- type MedicationOrder
- type Observation
- type Page
- type PatchPrescriptionInput
- type PatchPrescriptionParams
- type PatientPrescriptionHistory
- type Prescription
- type SIG
- type SuggestionAdvice
- type SuggestionAdviceParams
- type SuggestionDiagnosis
- type SuggestionDiagnosisParams
- type SuggestionInvestigation
- type SuggestionInvestigationParams
- type Summary
- type UpdateSuggestionAdviceInput
- type UpdateSuggestionDiagnosisInput
- type UpdateSuggestionInvestigationInput
Variables
Suggestion errors distinguish validation, missing entries, duplicates and unavailable storage.
var (
ErrInvalidSuggestion = errors.New("invalid prescription suggestion input")
ErrSuggestionNotFound = errors.New("prescription suggestion not found")
ErrSuggestionConflict = errors.New("a suggestion with this label already exists")
ErrSuggestionsUnavailable = errors.New("prescription suggestion storage is unavailable")
)ErrNotImplemented identifies documentation-first prescription operations.
var ErrNotImplemented = errors.New("prescription operation is not implemented")type AdviceItem
AdviceItem preserves advice text and an optional reusable phrase reference.
type AdviceItem struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
PhraseID string `json:"phrase_id,omitempty"`
Text string `json:"text" minLength:"1" pattern:"\\S"`
}type Association
Association preserves the presence or absence of an associated complaint.
type Association struct {
ConceptID string `json:"concept_id,omitempty"`
Label string `json:"label" minLength:"1" pattern:"\\S"`
Polarity string `json:"polarity" enum:"present,absent"`
RawText string `json:"raw_text,omitempty"`
}type CancelPrescriptionInput
CancelPrescriptionInput retains the record while marking it canceled.
type CancelPrescriptionInput struct {
Authorization, PrescriptionID string
Params CancelPrescriptionParams
}type CancelPrescriptionParams
CancelPrescriptionParams requires an auditable reason and a current version.
type CancelPrescriptionParams struct {
ExpectedVersion int64 `json:"expected_version" minimum:"1" example:"1"`
Reason string `json:"reason" minLength:"1" maxLength:"2000" pattern:"\\S" example:"Created in error; replacement follows."`
}type ClinicalContent
ClinicalContent preserves the workspace sections in their supplied order.
type ClinicalContent struct {
Complaints []Complaint `json:"complaints,omitempty" nullable:"false"`
History []HistoryItem `json:"history,omitempty" nullable:"false"`
Observations []Observation `json:"observations,omitempty" nullable:"false"`
Investigations []InvestigationOrder `json:"investigations,omitempty" nullable:"false"`
Diagnoses []Diagnosis `json:"diagnoses,omitempty" nullable:"false"`
Medications []MedicationOrder `json:"medications,omitempty" nullable:"false"`
Advice []AdviceItem `json:"advice,omitempty" nullable:"false"`
FollowUp *FollowUp `json:"follow_up,omitempty"`
}type Complaint
Complaint is an ordered, locally identified clinical entry.
type Complaint struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
ConceptID string `json:"concept_id,omitempty"`
Label string `json:"label" minLength:"1" pattern:"\\S"`
Duration *Duration `json:"duration,omitempty"`
Details *ComplaintDetails `json:"details,omitempty"`
}type ComplaintDetails
ComplaintDetails preserves qualifiers entered in the complaint workspace.
type ComplaintDetails struct {
Onset string `json:"onset,omitempty"`
Course string `json:"course,omitempty"`
Severity string `json:"severity,omitempty"`
Location string `json:"location,omitempty"`
Laterality string `json:"laterality,omitempty" enum:"left,right,bilateral"`
Character string `json:"character,omitempty"`
Radiation string `json:"radiation,omitempty"`
Pattern string `json:"pattern,omitempty"`
AggravatingFactors []string `json:"aggravating_factors,omitempty" nullable:"false"`
RelievingFactors []string `json:"relieving_factors,omitempty" nullable:"false"`
Associated []Association `json:"associated,omitempty" nullable:"false"`
CustomDetails []CustomClinicalDetail `json:"custom_details,omitempty" nullable:"false"`
}type CreatePrescriptionInput
CreatePrescriptionInput carries credentials separately from client-owned fields.
type CreatePrescriptionInput struct {
Authorization string
Params CreatePrescriptionParams
}type CreatePrescriptionParams
CreatePrescriptionParams allows a patient-ID-only draft; organization and author are derived.
type CreatePrescriptionParams struct {
PatientID string `json:"patient_id" minLength:"1" pattern:"\\S" example:"patient_123"`
ClinicalContent
EncounterDate string `json:"encounter_date,omitempty" format:"date" doc:"Defaults to the server's current date."`
VisitReason string `json:"visit_reason,omitempty" maxLength:"2000"`
SpecialtyID string `json:"specialty_id,omitempty"`
Notes string `json:"notes,omitempty" maxLength:"10000"`
}type CustomClinicalDetail
CustomClinicalDetail retains custom clarification answers and their interpretation.
type CustomClinicalDetail struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
RawText string `json:"raw_text" minLength:"1" pattern:"\\S"`
NormalizedValue string `json:"normalized_value,omitempty"`
Attribute string `json:"attribute,omitempty"`
ConceptID string `json:"concept_id,omitempty"`
Confidence *float64 `json:"confidence,omitempty" minimum:"0" maximum:"1"`
Source string `json:"source" enum:"clarification-custom"`
Status string `json:"status" enum:"structured,new-complaint,unstructured"`
SourceQuestionID string `json:"source_question_id,omitempty"`
WasCustomAnswer *bool `json:"was_custom_answer,omitempty"`
IncludeInPaper *bool `json:"include_in_paper,omitempty"`
}type Diagnosis
Diagnosis retains an optional reference independently of its display label.
type Diagnosis struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
ConceptID string `json:"concept_id,omitempty"`
Label string `json:"label" minLength:"1" pattern:"\\S"`
}type DoctorSnapshot
DoctorSnapshot preserves the issuing doctor's display details independently of profile edits.
type DoctorSnapshot struct {
ID string `json:"id"`
Name string `json:"name"`
LicenseNumber string `json:"license_number"`
Specialization string `json:"specialization"`
}type Duration
Duration represents a positive clinical interval.
type Duration struct {
Value int `json:"value" minimum:"1"`
Unit string `json:"unit" enum:"hour,day,week,month,year"`
}type FollowUp
FollowUp contains a relative interval or an exact date plus its display label.
type FollowUp struct {
Label string `json:"label" minLength:"1" pattern:"\\S"`
Value *int `json:"value,omitempty" minimum:"1"`
Unit string `json:"unit,omitempty" enum:"hour,day,week,month,year"`
ExactDate string `json:"exact_date,omitempty" format:"date"`
FormattedDate string `json:"formatted_date,omitempty" doc:"Optional display text; exact_date remains authoritative."`
}type GetPatientHistoryInput
GetPatientHistoryInput retrieves prescription-derived history for an authorized patient.
type GetPatientHistoryInput struct {
Authorization, PatientID, Cursor string
Limit int
}type GetPrescriptionInput
GetPrescriptionInput identifies a prescription within the actor's permitted context.
type GetPrescriptionInput struct{ Authorization, PrescriptionID string }type HistoryItem
HistoryItem records positive or negative clinical history.
type HistoryItem struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
ConceptID string `json:"concept_id,omitempty"`
Label string `json:"label" minLength:"1" pattern:"\\S"`
Polarity string `json:"polarity,omitempty" enum:"present,absent"`
Duration *Duration `json:"duration,omitempty"`
Value string `json:"value,omitempty"`
Emphasis string `json:"emphasis,omitempty" enum:"allergy"`
}type InvestigationOrder
InvestigationOrder records an investigation without claiming completion tracking.
type InvestigationOrder struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
Code string `json:"code,omitempty"`
Label string `json:"label" minLength:"1" pattern:"\\S"`
}type IssuePrescriptionInput
IssuePrescriptionInput transitions the author's draft to immutable issued content.
type IssuePrescriptionInput struct {
Authorization, PrescriptionID string
Params IssuePrescriptionParams
}type IssuePrescriptionParams
IssuePrescriptionParams protects issuance from stale autosaves.
type IssuePrescriptionParams struct {
ExpectedVersion int64 `json:"expected_version" minimum:"1" example:"1"`
}type ListPrescriptionsInput
ListPrescriptionsInput scopes a newest-first list to one authorized organization.
type ListPrescriptionsInput struct {
Authorization, OrganizationID, PatientID, DoctorID, Status, Cursor string
Limit int
}type ListSuggestionsInput
ListSuggestionsInput selects a searchable, cursor-paginated catalog page.
type ListSuggestionsInput struct {
Q, Cursor string
Limit int
}type MedicationDuration
MedicationDuration allows incomplete draft instructions or an ongoing course.
type MedicationDuration struct {
Value *int `json:"value,omitempty" minimum:"1"`
Unit string `json:"unit,omitempty" enum:"hour,day,week,month,year"`
Ongoing bool `json:"ongoing,omitempty"`
}type MedicationOrder
MedicationOrder accepts a display name even without a catalog reference.
type MedicationOrder struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
MedicationID string `json:"medication_id,omitempty"`
DisplayName string `json:"display_name" minLength:"1" pattern:"\\S"`
Form string `json:"form,omitempty"`
Strength string `json:"strength,omitempty"`
SIG SIG `json:"sig"`
}type Observation
Observation retains textual values, including compound blood-pressure readings.
type Observation struct {
ID string `json:"id" minLength:"1" pattern:"\\S"`
Type string `json:"type" minLength:"1" pattern:"\\S"`
Label string `json:"label" minLength:"1" pattern:"\\S"`
Value string `json:"value" minLength:"1" pattern:"\\S"`
Unit string `json:"unit,omitempty"`
}type Page
Page contains a newest-first, cursor-paginated result.
type Page[T any] struct {
Items []T `json:"items" nullable:"false"`
NextCursor string `json:"next_cursor,omitempty"`
}type PatchPrescriptionInput
PatchPrescriptionInput updates the author's draft using optimistic concurrency.
type PatchPrescriptionInput struct {
Authorization, PrescriptionID string
Params PatchPrescriptionParams
}type PatchPrescriptionParams
PatchPrescriptionParams replaces supplied sections and preserves omissions.
type PatchPrescriptionParams struct {
ExpectedVersion int64 `json:"expected_version" minimum:"1" doc:"Must match the current version; stale writes return 409."`
Complaints *[]Complaint `json:"complaints,omitempty" nullable:"false"`
History *[]HistoryItem `json:"history,omitempty" nullable:"false"`
Observations *[]Observation `json:"observations,omitempty" nullable:"false"`
Investigations *[]InvestigationOrder `json:"investigations,omitempty" nullable:"false"`
Diagnoses *[]Diagnosis `json:"diagnoses,omitempty" nullable:"false"`
Medications *[]MedicationOrder `json:"medications,omitempty" nullable:"false"`
Advice *[]AdviceItem `json:"advice,omitempty" nullable:"false"`
FollowUp *FollowUp `json:"follow_up,omitempty"`
EncounterDate *string `json:"encounter_date,omitempty" nullable:"false" format:"date"`
VisitReason *string `json:"visit_reason,omitempty" nullable:"true" maxLength:"2000"`
SpecialtyID *string `json:"specialty_id,omitempty" nullable:"true"`
Notes *string `json:"notes,omitempty" nullable:"true" maxLength:"10000"`
Supplied map[string]bool `json:"-"`
}func (PatchPrescriptionParams) TransformSchema
func (PatchPrescriptionParams) TransformSchema(_ huma.Registry, schema *huma.Schema) *huma.SchemaTransformSchema describes clearing the optional object explicitly with null. Huma's nullable tag supports scalars only, so referenced objects use anyOf.
func (*PatchPrescriptionParams) UnmarshalJSON
func (p *PatchPrescriptionParams) UnmarshalJSON(data []byte) errorUnmarshalJSON records explicit null separately from omitted fields.
type PatientPrescriptionHistory
PatientPrescriptionHistory contains only prescription-derived clinical history.
type PatientPrescriptionHistory struct {
PatientID string `json:"patient_id"`
Visits Page[Summary] `json:"visits" doc:"Issued and canceled records, newest first; cancellations remain visible."`
RecentObservations []Observation `json:"recent_observations" nullable:"false" doc:"Derived from issued records only, not external lab results."`
}type Prescription
Prescription is doctor-owned, organization-contextual clinical content.
type Prescription struct {
Summary
ClinicalContent
SpecialtyID string `json:"specialty_id,omitempty"`
Notes string `json:"notes,omitempty"`
PatientSnapshot *patientpublic.Snapshot `json:"patient_snapshot,omitempty" doc:"Frozen at issuance; patient profile edits never rewrite issued content."`
DoctorSnapshot *DoctorSnapshot `json:"doctor_snapshot,omitempty" doc:"Frozen at issuance."`
CanceledByUserID string `json:"canceled_by_user_id,omitempty"`
CancellationReason string `json:"cancellation_reason,omitempty"`
}type SIG
SIG contains structured medication directions; drafts may be incomplete.
type SIG struct {
Frequency string `json:"frequency,omitempty"`
Duration *MedicationDuration `json:"duration,omitempty"`
MealRelation string `json:"meal_relation,omitempty" enum:"before,after,none"`
Timing []string `json:"timing,omitempty" nullable:"false"`
Instruction string `json:"instruction,omitempty"`
}type SuggestionAdvice
SuggestionAdvice is a globally shared advice phrase for prescription generation.
type SuggestionAdvice struct {
ID string `json:"id"`
Label string `json:"label"`
}type SuggestionAdviceParams
SuggestionAdviceParams supplies the editable advice suggestion label.
type SuggestionAdviceParams struct {
Label string `json:"label" minLength:"1" maxLength:"500" pattern:"\\S" example:"Example advice suggestion"`
}type SuggestionDiagnosis
SuggestionDiagnosis is a globally shared diagnosis phrase for prescription generation.
type SuggestionDiagnosis struct {
ID string `json:"id"`
Label string `json:"label"`
}type SuggestionDiagnosisParams
SuggestionDiagnosisParams supplies the editable diagnosis suggestion label.
type SuggestionDiagnosisParams struct {
Label string `json:"label" minLength:"1" maxLength:"500" pattern:"\\S" example:"Example diagnosis suggestion"`
}type SuggestionInvestigation
SuggestionInvestigation is a globally shared investigation phrase for prescription generation.
type SuggestionInvestigation struct {
ID string `json:"id"`
Label string `json:"label"`
}type SuggestionInvestigationParams
SuggestionInvestigationParams supplies the editable investigation suggestion label.
type SuggestionInvestigationParams struct {
Label string `json:"label" minLength:"1" maxLength:"500" pattern:"\\S" example:"Example investigation suggestion"`
}type Summary
Summary is a lightweight prescription list item, not the complete clinical payload.
type Summary struct {
ID string `json:"id"`
PatientID string `json:"patient_id"`
DoctorID string `json:"doctor_id"`
OrganizationID string `json:"organization_id"`
PatientName string `json:"patient_name"`
DoctorName string `json:"doctor_name"`
Status string `json:"status" enum:"draft,issued,canceled"`
Version int64 `json:"version" minimum:"1"`
EncounterDate string `json:"encounter_date" format:"date"`
VisitReason string `json:"visit_reason,omitempty"`
ClinicalSummary string `json:"clinical_summary,omitempty"`
IssuedAt *time.Time `json:"issued_at,omitempty"`
CanceledAt *time.Time `json:"canceled_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}type UpdateSuggestionAdviceInput
UpdateSuggestionAdviceInput updates one advice suggestion without changing its ID.
type UpdateSuggestionAdviceInput struct {
ID string
SuggestionAdviceParams
}type UpdateSuggestionDiagnosisInput
UpdateSuggestionDiagnosisInput updates one diagnosis suggestion without changing its ID.
type UpdateSuggestionDiagnosisInput struct {
ID string
SuggestionDiagnosisParams
}type UpdateSuggestionInvestigationInput
UpdateSuggestionInvestigationInput updates one investigation suggestion without changing its ID.
type UpdateSuggestionInvestigationInput struct {
ID string
SuggestionInvestigationParams
}Generated by gomarkdoc