Documentation ¶
Index ¶
- type AccessToken
- type AgeRange
- type Appointment
- type AppointmentServiceRequests
- type AppointmentsPage
- type Author
- type AuthorMeta
- type AuthorityPermission
- type AuthorityRole
- type AuthorizationCode
- type Booking
- type BusinessHours
- type Caregiver
- type CaregiverClient
- type CaregiverProfile
- type CaregiverRegistration
- type CategoryDetail
- type ClientCaregivers
- type ClientHealthDiaryEntry
- type ClientHealthDiaryQuote
- type ClientProfile
- type ClientRegistrationPayload
- type ClientResponse
- type Community
- type CommunityProfile
- type Conditions
- type ConsentStatus
- type Contact
- type Content
- type ContentItem
- type ContentItemCategory
- type ContentMeta
- type Coordinates
- type Document
- type DocumentData
- type DocumentMeta
- type Facility
- type FacilityIdentifier
- type FacilityPage
- type FacilityService
- type FacilityServicePage
- type FeaturedMedia
- type FeedbackResponse
- type FiltersParam
- type GalleryImage
- type HeroImage
- type HeroImageRendition
- type Identifier
- type ImageDetail
- type ImageMeta
- type MHomeserver
- type ManagedClient
- type MatrixAuth
- type MatrixUserRegistration
- type MatrixUserSearchResult
- type Meta
- type Metric
- type Notification
- type NotificationFilters
- type NotificationTypeFilter
- type NotificationsPage
- type OTP
- type OTPResponse
- type OauthClient
- func (c OauthClient) GetAudience() fosite.Arguments
- func (c OauthClient) GetGrantTypes() fosite.Arguments
- func (c OauthClient) GetHashedSecret() []byte
- func (c OauthClient) GetID() string
- func (c OauthClient) GetRedirectURIs() []string
- func (c OauthClient) GetResponseTypes() fosite.Arguments
- func (c OauthClient) GetRotatedHashes() [][]byte
- func (c OauthClient) GetScopes() fosite.Arguments
- func (c OauthClient) IsPublic() bool
- type OauthClientJWT
- type Organisation
- type PKCE
- type Pagination
- type Program
- type ProgramPage
- type PushRulePayload
- type PusherData
- type PusherPayload
- type QueryPathValues
- type Question
- func (s Question) GetNormalizedResponseForMultipleChoice(response string) map[string]interface{}
- func (s Question) GetNormalizedResponseForSingleChoice(response string) map[string]interface{}
- func (s Question) GetScore(response string) int
- func (s Question) GetScoreForMultipleChoice(response string) int
- func (s Question) GetScoreForSingleChoice(response string) int
- func (s Question) ValidateResponse(response string) error
- type QuestionInputChoice
- type Questionnaire
- type QuestionnaireScreeningToolQuestionResponse
- type QuestionnaireScreeningToolResponse
- type RecordSecurityQuestionResponse
- type RefreshToken
- type RequestTypeCount
- type Result
- type ScreeningTool
- type ScreeningToolPage
- type ScreeningToolRespondent
- type ScreeningToolRespondentsPage
- type SecurityQuestion
- type SecurityQuestionResponse
- type ServiceIdentifier
- type ServiceRequest
- type ServiceRequestPage
- type ServiceRequestsCount
- type ServiceRequestsCountResponse
- type Session
- func (s *Session) Clone() fosite.Session
- func (s *Session) GetExpiresAt(key fosite.TokenType) time.Time
- func (s *Session) GetExtraClaims() map[string]interface{}
- func (s *Session) GetSubject() string
- func (s *Session) GetUsername() string
- func (s *Session) IDTokenClaims() *jwt.IDTokenClaims
- func (s *Session) IDTokenHeaders() *jwt.Headers
- func (s *Session) SetExpiresAt(key fosite.TokenType, exp time.Time)
- type SortParam
- type StaffProfile
- type StaffRegistrationPayload
- type StaffResponse
- type Submission
- type Submitter
- type SurveyForm
- type SurveyRespondent
- type SurveyRespondentPage
- type SurveyResponse
- type SurveyServiceRequestUser
- type SurveyServiceRequestUserPage
- type TermsOfService
- type UpdateFacilityPayload
- type UpdateServiceRequestsPayload
- type User
- type UserPIN
- type UserSurvey
- type WellKnown
- type WorkStationDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken struct { ID string Active bool Signature string RequestedAt time.Time RequestedScopes []string GrantedScopes []string Form url.Values RequestedAudience []string GrantedAudience []string ClientID string Client OauthClient SessionID string Session Session }
AccessToken represents an oauth2 access token
type Appointment ¶
type Appointment struct { ID string `json:"id"` ExternalID string `json:"externalID"` Reason string `json:"reason"` Date scalarutils.Date `json:"date"` ClientID string `json:"clientID"` FacilityID string `json:"facilityID"` Provider string `json:"provider"` HasRescheduledAppointment bool `json:"hasRescheduledApointment"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
Appointment represents a single appointment
type AppointmentServiceRequests ¶
type AppointmentServiceRequests struct { ID string `json:"id"` ExternalID string `json:"AppointmentID"` Reason string `json:"AppointmentReason"` Date scalarutils.Date `json:"SuggestedDate"` Status string `json:"Status"` InProgressAt *time.Time `json:"InProgressAt"` InProgressBy *string `json:"InProgressBy"` ResolvedAt *time.Time `json:"ResolvedAt"` ResolvedBy *string `json:"ResolvedBy"` ClientName *string `json:"ClientName"` ClientContact *string `json:"ClientContact"` CCCNumber string `json:"CCCNumber"` MFLCODE string `json:"MFLCODE"` }
AppointmentServiceRequests is a list of appointment service requests
type AppointmentsPage ¶
type AppointmentsPage struct { Appointments []*Appointment `json:"appointments"` Pagination Pagination `json:"pagination"` }
AppointmentsPage is a list of paginated appointments
type Author ¶
type Author struct { ID string `json:"id"` Meta AuthorMeta `json:"meta"` }
Author models the details about an author
type AuthorMeta ¶
type AuthorMeta struct {
Type string `json:"type"`
}
AuthorMeta holds the properties that are associated to the author model
type AuthorityPermission ¶
type AuthorityPermission struct { PermissionID string `json:"permissionID"` Active bool `json:"active"` Name enums.PermissionType `json:"name"` Description string `json:"description"` Category string `json:"category"` Scope string `json:"scope"` }
AuthorityPermission defines user permissions
type AuthorityRole ¶
type AuthorityRole struct { AuthorityRoleID string `json:"authorityRoleID"` Name string `json:"name"` Active bool `json:"active"` OrganisationID string `json:"organisationID"` ProgramID string `json:"programID"` Permissions []AuthorityPermission `json:"permissions"` }
AuthorityRole defines user roles
type AuthorizationCode ¶
type AuthorizationCode struct { ID string Active bool Code string RequestedAt time.Time RequestedScopes []string GrantedScopes []string Form url.Values RequestedAudience []string GrantedAudience []string SessionID string Session Session ClientID string Client OauthClient }
AuthorizationCode represents an Oauth2 authorization code
type Booking ¶
type Booking struct { ID string `json:"id"` Active bool `json:"active"` Services []string `json:"services"` Date time.Time `json:"date"` Facility Facility `json:"facility"` Client ClientProfile `json:"clientProfile"` OrganisationID string `json:"organisationID"` ProgramID string `json:"programID"` VerificationCode string `json:"verificationCode"` VerificationCodeStatus enums.BookingCodeStatus `json:"verificationCodeStatus"` BookingStatus enums.BookingStatus `json:"bookingStatus"` }
Booking is the booking class data model
type BusinessHours ¶
type BusinessHours struct { ID string `json:"id"` Day string `json:"day"` OpeningTime string `json:"openingTime"` ClosingTime string `json:"closingTime"` FacilityID string `json:"facilityID"` }
BusinessHours models data that show facility's operational hours
type Caregiver ¶
type Caregiver struct { ID string `json:"id"` UserID string `json:"userID"` CaregiverNumber string `json:"caregiverNumber"` Active bool `json:"active"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
Caregiver maps the schema for the table that stores the caregiver
type CaregiverClient ¶
type CaregiverClient struct { CaregiverID string `json:"caregiverID"` ClientID string `json:"clientID"` Active bool `json:"active"` RelationshipType enums.CaregiverType `json:"relationshipType"` CaregiverConsent enums.ConsentState `json:"caregiverConsent"` CaregiverConsentAt *time.Time `json:"caregiverConsentAt"` ClientConsent enums.ConsentState `json:"clientConsent"` ClientConsentAt *time.Time `json:"clientConsentAt"` OrganisationID string `json:"organisationID"` AssignedBy string `json:"assignedBy"` ProgramID string `json:"programID"` }
CaregiverClient models the clients
type CaregiverProfile ¶
type CaregiverProfile struct { ID string `json:"id"` UserID string `json:"userID"` User User `json:"user"` CaregiverNumber string `json:"caregiverNumber"` IsClient bool `json:"isClient"` Consent ConsentStatus `json:"consent"` CurrentClient *string `json:"currentClient"` CurrentFacility *string `json:"currentFacility"` }
CaregiverProfile is the profile for a caregiver with user's name
type CaregiverRegistration ¶
type CaregiverRegistration struct { User *User `json:"user"` Contact *Contact `json:"contact"` Caregiver *Caregiver `json:"caregiver"` }
CaregiverRegistration is the input used for creating a caregiver
type CategoryDetail ¶
type CategoryDetail struct { ID int `json:"category_id"` CategoryName string `json:"category_name"` CategoryIcon string `json:"category_icon"` }
CategoryDetail holds all information regarding a certain item's category. It will be used to determine which content to show on the UI based on the category ID provided to the API
type ClientCaregivers ¶
type ClientCaregivers struct {
Caregivers []*CaregiverProfile `json:"caregivers"`
}
ClientCaregivers is the model that holds the client's caregivers
type ClientHealthDiaryEntry ¶
type ClientHealthDiaryEntry struct { ID *string `json:"id"` Active bool `json:"active"` Mood string `json:"mood"` Note string `json:"note"` EntryType string `json:"entryType"` ClientID string `json:"clientID"` CreatedAt time.Time `json:"createdAt"` PhoneNumber string `json:"phoneNumber"` ClientName string `json:"clientName"` CCCNumber string `json:"cccNumber"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` CaregiverID *string `json:"caregiverID"` }
ClientHealthDiaryEntry models the health diary entry. It is used to capture the client's moods on a day-by-day basis
type ClientHealthDiaryQuote ¶
ClientHealthDiaryQuote is a health diary quote collection
type ClientProfile ¶
type ClientProfile struct { ID *string `json:"id"` User *User `json:"user"` Active bool `json:"active"` ClientTypes []enums.ClientType `json:"clientTypes"` UserID string `json:"userID"` TreatmentEnrollmentDate *time.Time `json:"treatmentEnrollmentDate"` FHIRPatientID *string `json:"fhirPatientID"` HealthRecordID *string `json:"healthRecordID"` TreatmentBuddy string `json:"treatmentBuddy"` ClientCounselled bool `json:"counselled"` OrganisationID string `json:"organisationID"` DefaultFacility *Facility `json:"defaultFacility"` CHVUserID *string `json:"chvUserID"` CHVUserName string `json:"chvUserName"` CaregiverID *string `json:"caregiverID"` Facilities []*Facility `json:"facilities"` // TODO: needs at least one ProgramID string `json:"programID"` Identifiers []*Identifier `json:"identifiers"` Program *Program `json:"program"` Organisation *Organisation `json:"organisation"` }
ClientProfile holds the details of end users who are not using the system in a professional capacity e.g consumers, patients etc. It is a linkage model e.g to tie together all of a person's identifiers and their health record ID
type ClientRegistrationPayload ¶
type ClientRegistrationPayload struct { UserProfile User `json:"userProfile"` Phone Contact `json:"phone"` ClientIdentifier Identifier `json:"clientIdentifier"` Client ClientProfile `json:"client"` }
ClientRegistrationPayload is the payload for a client registration
type ClientResponse ¶
type ClientResponse struct { ClientProfile *ClientProfile `json:"clientProfile"` Roles []*AuthorityRole `json:"roles"` Permissions []*AuthorityPermission `json:"permissions"` CommunityProfile CommunityProfile `json:"communityProfile"` }
ClientResponse represents the data model to return the client payload
type Community ¶
type Community struct { ID string `json:"id"` RoomID string `json:"roomID"` Name string `json:"name"` Description string `json:"description"` // The fields below are custom to our implementation AgeRange *AgeRange `json:"ageRange"` Gender []enumutils.Gender `json:"gender"` ClientType []enums.ClientType `json:"clientType"` OrganisationID string `json:"organisationID"` ProgramID string `json:"programID"` FacilityID string `json:"facilityID"` }
Community defines the payload to create a channel
type CommunityProfile ¶
type CommunityProfile struct { UserID string `json:"user_id"` AccessToken string `json:"access_token"` HomeServer string `json:"home_server"` DeviceID string `json:"device_id"` WellKnown WellKnown `json:"well_known"` }
CommunityProfile returns the matrix user's profile on login
type Conditions ¶
type Conditions struct { Kind string `json:"kind,omitempty"` Key string `json:"key,omitempty"` Pattern string `json:"pattern,omitempty"` }
Conditions are configurations that that MUST hold true for an event in order for a rule to match
type ConsentStatus ¶
type ConsentStatus struct {
ConsentStatus enums.ConsentState `json:"consentStatus"`
}
ConsentStatus is used to indicate the consent status of a caregiver
type Contact ¶
type Contact struct { ID *string `json:"id"` ContactType string `json:"contactType"` ContactValue string `json:"contactValue"` Active bool `json:"active"` // a user may opt not to be contacted via this contact // e.g if it's a shared phone owned by a teenager OptedIn bool `json:"optedIn"` UserID *string `json:"userID"` OrganisationID string `json:"organisationID"` }
Contact hold contact information/details for users
type Content ¶
type Content struct { Meta Meta `json:"meta"` Items []ContentItem `json:"items"` }
Content aggregates all content details into one payload that is returned from an API and rendered on the front end
type ContentItem ¶
type ContentItem struct { ID int `json:"id"` Meta ContentMeta `json:"meta"` Title string `json:"title"` Date string `json:"date"` Intro string `json:"intro"` Author Author `json:"author"` AuthorName string `json:"author_name"` ItemType string `json:"item_type"` TimeEstimateSeconds int `json:"time_estimate_seconds"` Body string `json:"body"` TagNames []string `json:"tag_names"` HeroImage HeroImage `json:"hero_image"` HeroImageRendition HeroImageRendition `json:"hero_image_rendition"` LikeCount int `json:"like_count"` BookmarkCount int `json:"bookmark_count"` ViewCount int `json:"view_count"` Documents []Document `json:"documents"` CategoryDetails []CategoryDetail `json:"category_details"` FeaturedMedia []FeaturedMedia `json:"featured_media"` GalleryImages []GalleryImage `json:"gallery_images"` }
ContentItem holds all the information necessary relating to content item
type ContentItemCategory ¶
type ContentItemCategory struct { ID int `json:"id"` Name string `json:"name"` IconURL string `json:"icon_url"` }
ContentItemCategory maps the schema for the table that stores the content item category
type ContentMeta ¶
type ContentMeta struct { ContentType string `json:"type"` ContentDetailURL string `json:"detail_url"` ContentHTMLURL string `json:"html_url"` Slug string `json:"slug"` ShowInMenus bool `json:"show_in_menus"` SEOTitle string `json:"seo_title"` SearchDescription string `json:"search_description"` FirstPublishedAt string `json:"first_published_at"` Locale string `json:"locale"` }
ContentMeta represents a list of properties that are associated with the content model
type Coordinates ¶
Coordinates is used to show geographical locations
type Document ¶
type Document struct { ID int `json:"id"` Meta DocumentMeta `json:"meta"` Document DocumentData `json:"document"` }
Document contains details about a document eg a PDF file
type DocumentData ¶
type DocumentData struct { ID int `json:"id"` Title string `json:"title"` Meta DocumentMeta `json:"meta"` }
DocumentData holds the information regarding a document
type DocumentMeta ¶
type DocumentMeta struct { Type string `json:"type"` DocumentDetailURL string `json:"detail_url"` DocumentDownloadURL string `json:"download_url"` }
DocumentMeta represents a list of properties that are associated with the document
type Facility ¶
type Facility struct { // ID is the Global facility ID(GCID) ID *string `json:"id,omitempty"` // unique within this structure Name string `json:"name,omitempty"` Phone string `json:"phone,omitempty"` Active bool `json:"active,omitempty"` Country string `json:"country,omitempty"` County string `json:"county,omitempty"` Address string `json:"address,omitempty"` Description string `json:"description,omitempty"` FHIROrganisationID string `json:"fhirOrganisationId,omitempty"` Distance float64 `json:"distance,omitempty"` Identifiers []*FacilityIdentifier `json:"identifiers,omitempty"` WorkStationDetails WorkStationDetails `json:"workStationDetails,omitempty"` Coordinates *Coordinates `json:"coordinates,omitempty"` Services []FacilityService `json:"services,omitempty"` BusinessHours []BusinessHours `json:"businessHours,omitempty"` }
Facility models the details of healthcare facilities that are on the platform.
e.g CCC clinics, Pharmacies.
type FacilityIdentifier ¶
type FacilityIdentifier struct { ID string `json:"id"` Active bool `json:"active"` Type enums.FacilityIdentifierType `json:"type"` Value string `json:"value"` }
FacilityIdentifier is the identifier of the facility
type FacilityPage ¶
type FacilityPage struct { Pagination Pagination `json:"pagination"` Facilities []*Facility `json:"facilities"` }
FacilityPage returns a list of paginates facilities
type FacilityService ¶
type FacilityService struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Identifiers []ServiceIdentifier `json:"identifiers"` }
FacilityService models the data class that is used to show facility services
type FacilityServicePage ¶
type FacilityServicePage struct { Results []FacilityService `json:"results"` Count int `json:"count"` Next string `json:"next"` Previous string `json:"previous"` PageSize int `json:"page_size"` CurrentPage int `json:"current_page"` TotalPages int `json:"total_pages"` StartIndex int `json:"start_index"` EndIndex int `json:"end_index"` }
FacilityServicePage models the services offered in a facility
type FeaturedMedia ¶
type FeaturedMedia struct { ID int `json:"id"` URL string `json:"url"` Title string `json:"title"` Type string `json:"type"` Width int `json:"width"` Height int `json:"height"` Thumbnail string `json:"thumbnail"` Duration float64 `json:"duration"` }
FeaturedMedia ...
type FeedbackResponse ¶
type FeedbackResponse struct { UserID string `json:"userID"` FeedbackType enums.FeedbackType `json:"feedbackType"` SatisfactionLevel int `json:"satisfactionLevel"` ServiceName string `json:"serviceName"` Feedback string `json:"feedback"` RequiresFollowUp bool `json:"requiresFollowUp"` PhoneNumber string `json:"phoneNumber"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
FeedbackResponse defines the field passed when sending feedback
type FiltersParam ¶
type FiltersParam struct { Name string DataType enums.FilterSortDataType Value string // TODO: Clear spec on validation e.g dates must be ISO 8601. This is the actual data being filtered }
FiltersParam contains the inputs for filter parameters
func (FiltersParam) Validate ¶
func (f FiltersParam) Validate() error
Validate is a filter param method that performs validations
type GalleryImage ¶
type GalleryImage struct { ID int `json:"id"` Image ImageDetail `json:"image"` }
GalleryImage contains details about images that can be featured on a gallery
type HeroImage ¶
type HeroImage struct { ID int `json:"id"` Meta ImageMeta `json:"meta"` Title string `json:"title"` }
HeroImage contains details about the hero image i.e. The title This is the oversize image displayed at the top of a content
type HeroImageRendition ¶
type HeroImageRendition struct { URL string `json:"url"` Width int `json:"width"` Height int `json:"height"` Alt string `json:"alt"` }
HeroImageRendition contains more details about the hero image. These details will be used by the frontend to get the actual image and render it on the app
type Identifier ¶
type Identifier struct { ID string `json:"id"` Type enums.UserIdentifierType `json:"type"` Value string `json:"value"` Use string `json:"use"` Description string `json:"description"` ValidFrom time.Time `json:"validFrom"` ValidTo time.Time `json:"validTo"` IsPrimaryIdentifier bool `json:"isPrimaryIdentifier"` Active bool `json:"active"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
Identifier is used to store a user's identifying details e.d ID number, CCC number
type ImageDetail ¶
type ImageDetail struct { ID int `json:"id"` Title string `json:"title"` Meta ImageMeta `json:"meta"` }
ImageDetail contains more information about an image
type ImageMeta ¶
type ImageMeta struct { Type string `json:"type"` ImageDetailURL string `json:"detail_url"` ImageDownloadURL string `json:"download_url"` }
ImageMeta holds more information about an Image
type MHomeserver ¶
type MHomeserver struct {
BaseURL string `json:"base_url"`
}
MHomeserver is display the domain from which Matrix is serving from
type ManagedClient ¶
type ManagedClient struct { ClientProfile *ClientProfile `json:"clientProfile"` CaregiverConsent enums.ConsentState `json:"caregiverConsent"` ClientConsent enums.ConsentState `json:"clientConsent"` WorkStationDetails WorkStationDetails `json:"workStationDetails"` }
ManagedClient represents a client who is managed by a caregiver
type MatrixAuth ¶
MatrixAuth models the Matrix's user authentication data
type MatrixUserRegistration ¶
type MatrixUserRegistration struct { Username string `json:"username"` Password string `json:"password"` Admin bool `json:"admin"` }
MatrixUserRegistration defines the structure of the input to be used when registering a Matrix user
type MatrixUserSearchResult ¶
type MatrixUserSearchResult struct { Limited bool `json:"limited"` Results []Result `json:"results"` }
MatrixUserSearchResult defines the structure of the users search output
type Meta ¶
type Meta struct {
TotalCount int `json:"total_count"`
}
Meta holds the information that shows the total count of items returned from the API The total count displayed is irrespective of pagination
type Metric ¶
type Metric struct { ID int `json:"id"` UserID *string `json:"userID"` Type enums.MetricType `json:"type"` Event map[string]interface{} `json:"event"` Timestamp time.Time `json:"timestamp"` }
Metric is a recording of an event that occurs within the platform
type Notification ¶
type Notification struct { ID string `json:"id"` Title string `json:"title"` Body string `json:"body"` Type enums.NotificationType `json:"type"` IsRead bool `json:"isRead"` CreatedAt time.Time `json:"createdAt"` UserID *string `json:"userID"` FacilityID *string `json:"facilityID"` Flavour feedlib.Flavour `json:"flavour"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
Notification represents a notification
type NotificationFilters ¶
type NotificationFilters struct { IsRead *bool `json:"isRead"` NotificationTypes []*enums.NotificationType `json:"notificationTypes"` }
NotificationFilters represents the filters used to fetch notifications
type NotificationTypeFilter ¶
type NotificationTypeFilter struct { Enum enums.NotificationType Name string `json:"name"` }
NotificationTypeFilter represents an enum and its name value
type NotificationsPage ¶
type NotificationsPage struct { Notifications []*Notification `json:"notifications"` Pagination Pagination `json:"pagination"` }
NotificationsPage response for fetching notifications
type OTP ¶
type OTP struct { UserID string `json:"userID"` Valid bool `json:"valid"` GeneratedAt time.Time `json:"generatedAt"` ValidUntil time.Time `json:"validUntil"` Channel string `json:"channel"` Flavour feedlib.Flavour `json:"flavour"` PhoneNumber string `json:"phoneNumber"` OTP string `json:"otp"` }
OTP model the OTP details of OTP data
type OTPResponse ¶
OTPResponse models the object to be returned to the client when an OTP is generated
type OauthClient ¶
type OauthClient struct { // unique identifier of the OAuth2 client ID string // human-readable name of the OAuth2 client Name string // indicates whether the OAuth2 client is active or not Active bool // secret used by the client to authenticate with the authorization server // uses bcrypt by default Secret string // list of previously used secrets that were rotated out RotatedSecrets []string // indicates whether the client is a public or confidential client Public bool // list of valid URIs to redirect the user after authorization RedirectURIs []string // list of scopes the client is authorized to request Scopes []string // list of intended audiences for the access token Audience []string // a list of OAuth2 grant types that the client is authorized to use when requesting access tokens // e.g ["authorization_code", "refresh_token"] Grants []string // a list of OAuth2 response types that the client is authorized to use when requesting authorization // e.g ["code", "token"] ResponseTypes []string // the authentication method that the client uses to authenticate with the auth server when requesting tokens. // e.g "client_secret_basic" TokenEndpointAuthMethod string }
OauthClient represents an application that is authorized to access a user's resources on a server using the OAuth2 protocol.
func (OauthClient) GetAudience ¶
func (c OauthClient) GetAudience() fosite.Arguments
GetAudience returns the allowed audience(s) for this client.
func (OauthClient) GetGrantTypes ¶
func (c OauthClient) GetGrantTypes() fosite.Arguments
GetGrantTypes returns the client's allowed grant types.
func (OauthClient) GetHashedSecret ¶
func (c OauthClient) GetHashedSecret() []byte
GetHashedSecret returns the hashed secret as it is stored in the store.
func (OauthClient) GetRedirectURIs ¶
func (c OauthClient) GetRedirectURIs() []string
GetRedirectURIs returns the client's allowed redirect URIs.
func (OauthClient) GetResponseTypes ¶
func (c OauthClient) GetResponseTypes() fosite.Arguments
GetResponseTypes returns the client's allowed response types. All allowed combinations of response types have to be listed, each combination having response types of the combination separated by a space.
func (OauthClient) GetRotatedHashes ¶
func (c OauthClient) GetRotatedHashes() [][]byte
func (OauthClient) GetScopes ¶
func (c OauthClient) GetScopes() fosite.Arguments
GetScopes returns the scopes this client is allowed to request.
func (OauthClient) IsPublic ¶
func (c OauthClient) IsPublic() bool
IsPublic returns true, if this client is marked as public.
type OauthClientJWT ¶
OauthClientJWT
type Organisation ¶
type Organisation struct { ID string `json:"id"` Active bool `json:"active"` Code string `json:"code"` Name string `json:"name"` Description string `json:"description"` EmailAddress string `json:"emailAddress"` PhoneNumber string `json:"phoneNumber"` PostalAddress string `json:"postalAddress"` PhysicalAddress string `json:"physicalAddress"` DefaultCountry string `json:"defaultCountry"` Programs []*Program `json:"programs"` }
Organisation represents the DAO of an organisation
type PKCE ¶
type PKCE struct { ID string Active bool Signature string RequestedAt time.Time RequestedScopes []string GrantedScopes []string Form url.Values RequestedAudience []string GrantedAudience []string SessionID string Session Session ClientID string Client OauthClient }
PKCE
type Pagination ¶
type Pagination struct { Limit int `json:"limit"` CurrentPage int `json:"currentPage"` Count int64 `json:"count"` TotalPages int `json:"totalPages"` NextPage *int `json:"nextPage"` PreviousPage *int `json:"previousPage"` Sort *SortParam `json:"sortParam"` }
Pagination contains the struct fields for performing pagination.
func (*Pagination) GetLimit ¶
func (p *Pagination) GetLimit() int
GetLimit calculates the maximum number of items to be shown per page
func (*Pagination) GetOffset ¶
func (p *Pagination) GetOffset() int
GetOffset calculates the deviation in pages that come before
func (*Pagination) GetSort ¶
func (p *Pagination) GetSort() string
GetSort returns the sort order, and defaults to the latest items if no sort was passed in.
type Program ¶
type Program struct { ID string `json:"id"` Active bool `json:"active"` Name string `json:"name"` Description string `json:"description"` FHIROrganisationID string `json:"fhirOrganisationID"` Organisation Organisation `json:"organisation"` Facilities []*Facility `json:"facilities"` }
Program defines the program structure
type ProgramPage ¶
type ProgramPage struct { Pagination Pagination `json:"pagination"` Programs []*Program `json:"programs"` }
ProgramPage returns a list of paginated programs
type PushRulePayload ¶
type PushRulePayload struct { Conditions []Conditions `json:"conditions,omitempty"` Actions []any `json:"actions,omitempty"` Kind string `json:"kind,omitempty"` }
PushRulePayload is used to define under what conditions an event should be passed to the push gateway configured.
type PusherData ¶
type PusherData struct { Format string `json:"format,omitempty"` URL string `json:"url,omitempty"` }
PusherData dictionary of information for the pusher implementation itself
type PusherPayload ¶
type PusherPayload struct { AppDisplayName string `json:"app_display_name,omitempty"` AppID string `json:"app_id,omitempty"` Append bool `json:"append,omitempty"` PusherData PusherData `json:"data,omitempty"` DeviceDisplayName string `json:"device_display_name,omitempty"` Kind *string `json:"kind,omitempty"` Lang string `json:"lang,omitempty"` ProfileTag string `json:"profile_tag,omitempty"` Pushkey string `json:"pushkey,omitempty"` }
PusherPayload models the data class to be used in configuration of Matrix's pusher data
type QueryPathValues ¶
type QueryPathValues struct { Scope string `json:"scope,omitempty"` RuleID string `json:"ruleId,omitempty"` Kind string `json:"kind,omitempty"` Before string `json:"before,omitempty"` After string `json:"after,omitempty"` }
QueryPathValues is used to provide the url path values used to construct the path used to create push rules
type Question ¶
type Question struct { ID string `json:"id"` Active bool `json:"active"` QuestionnaireID string `json:"questionnaireID"` Text string `json:"text"` QuestionType enums.QuestionType `json:"questionType"` ResponseValueType enums.QuestionResponseValueType `json:"responseValue"` Required bool `json:"required"` SelectMultiple bool `json:"selectMultiple"` Sequence int `json:"sequence"` Choices []QuestionInputChoice `json:"choices"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
Question represents a question within a questionnaire.
func (Question) GetNormalizedResponseForMultipleChoice ¶
GetNormalizedResponseForMultipleChoice returns the human readable response for a multiple choice question response
func (Question) GetNormalizedResponseForSingleChoice ¶
GetNormalizedResponseForSingleChoice returns the human readable response for a single choice question response
func (Question) GetScoreForMultipleChoice ¶
GetScoreForMultipleChoice returns the score for a multiple choice question response
func (Question) GetScoreForSingleChoice ¶
GetScoreForSingleChoice returns the score for a single choice question response
func (Question) ValidateResponse ¶
ValidateResponse helps with validation of a question response input
type QuestionInputChoice ¶
type QuestionInputChoice struct { ID string `json:"id"` Active bool `json:"active"` QuestionID string `json:"questionID"` Choice string `json:"choice"` Value string `json:"value"` Score int `json:"score"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
QuestionInputChoice defines the structure of choices for the Question
type Questionnaire ¶
type Questionnaire struct { ID string `json:"id"` Active bool `json:"active"` Name string `json:"name"` Description string `json:"description"` Questions []Question `json:"questions"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
Questionnaire defines the structure of a questionnaire
func (Questionnaire) GetQuestionByID ¶
func (q Questionnaire) GetQuestionByID(id string) (Question, error)
GetQuestionByID returns a question by ID
type QuestionnaireScreeningToolQuestionResponse ¶
type QuestionnaireScreeningToolQuestionResponse struct { ID string `json:"id"` Active bool `json:"active"` ScreeningToolResponseID string `json:"screeningToolResponseID"` QuestionID string `json:"questionID"` QuestionType enums.QuestionType `json:"questionType"` SelectMultiple bool `json:"selectMultiple"` ResponseValueType enums.QuestionResponseValueType `json:"responseValueType"` Sequence int `json:"sequence"` QuestionText string `json:"questionText"` Response string `json:"response"` NormalizedResponse map[string]interface{} `json:"normalizedResponse"` Score int `json:"score"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` FacilityID string `json:"facilityID"` }
QuestionnaireScreeningToolQuestionResponse defines the structure of a screening tool question response TODO: Rename to ScreeningToolQuestionResponse after removing old screening tool implementation
type QuestionnaireScreeningToolResponse ¶
type QuestionnaireScreeningToolResponse struct { ID string `json:"id"` Active bool `json:"active"` ScreeningToolID string `json:"screeningToolID"` FacilityID string `json:"facilityID"` ClientID string `json:"clientID"` DateOfResponse time.Time `json:"dateOfResponse"` AggregateScore int `json:"aggregateScore"` QuestionResponses []*QuestionnaireScreeningToolQuestionResponse `json:"questionResponses"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` CaregiverID *string `json:"caregiverID"` }
QuestionnaireScreeningToolResponse defines the response to the ScreeningTool question TODO: Rename to ScreeningToolResponse after removing old screening tool implementation
type RecordSecurityQuestionResponse ¶
type RecordSecurityQuestionResponse struct { SecurityQuestionID string `json:"securityQuestionID"` IsCorrect bool `json:"isCorrect"` }
RecordSecurityQuestionResponse models the response to a security question
type RefreshToken ¶
type RefreshToken struct { ID string Active bool Signature string RequestedAt time.Time RequestedScopes []string GrantedScopes []string Form url.Values RequestedAudience []string GrantedAudience []string ClientID string Client OauthClient SessionID string Session Session }
RefreshToken
type RequestTypeCount ¶
type RequestTypeCount struct { RequestType enums.ServiceRequestType `json:"requestType"` Total int `json:"total"` }
RequestTypeCount ...
type Result ¶
type Result struct { UserID string `json:"user_id"` DisplayName string `json:"display_name"` AvatarURL string `json:"avatar_url"` }
Results contain the details of the searched user
type ScreeningTool ¶
type ScreeningTool struct { ID string `json:"id"` Active bool `json:"active"` QuestionnaireID string `json:"questionnaireID"` Threshold int `json:"threshold"` ClientTypes []enums.ClientType `json:"clientTypes"` Genders []enumutils.Gender `json:"genders"` AgeRange AgeRange `json:"ageRange"` Questionnaire Questionnaire `json:"questionnaire"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
ScreeningTool defines the structure of a screening tool that belongs to the questionnaire
func (ScreeningTool) GetNormalizedResponse ¶
func (s ScreeningTool) GetNormalizedResponse(questionID, response string) map[string]interface{}
GetNormalizedResponse returns the human readable response for a given question response
func (ScreeningTool) GetQuestion ¶
func (s ScreeningTool) GetQuestion(questionID string) *Question
GetQuestion returns the question details for a given screening tool question
type ScreeningToolPage ¶
type ScreeningToolPage struct { ScreeningTools []*ScreeningTool `json:"screeningTools"` Pagination Pagination `json:"pagination"` }
ScreeningToolPage represents the screening tool pagination mode
type ScreeningToolRespondent ¶
type ScreeningToolRespondent struct { ClientID string `json:"clientID"` ScreeningToolResponseID string `json:"screeningToolResponseID"` ServiceRequestID string `json:"serviceRequestID"` Name string `json:"name"` PhoneNumber string `json:"phoneNumber"` ServiceRequest string `json:"serviceRequest"` }
ScreeningToolRespondent defines the structure of a screening tool respondent the respondent is the client who has a service request for the screening tool
type ScreeningToolRespondentsPage ¶
type ScreeningToolRespondentsPage struct { ScreeningToolRespondents []*ScreeningToolRespondent `json:"screeningToolRespondents"` Pagination Pagination `json:"pagination"` }
ScreeningToolRespondentsPage represents a list of respondents Pagination is included
type SecurityQuestion ¶
type SecurityQuestion struct { SecurityQuestionID string `json:"securityQuestionID"` QuestionStem string `json:"questionStem"` Description string `json:"description"` Flavour feedlib.Flavour `json:"flavour"` Active bool `json:"active"` ResponseType enums.SecurityQuestionResponseType `json:"responseType"` Sequence int `json:"sequence"` }
SecurityQuestion models the security questions for the users
func (*SecurityQuestion) Validate ¶
func (s *SecurityQuestion) Validate(response string) error
Validate validates the security question response type
type SecurityQuestionResponse ¶
type SecurityQuestionResponse struct { ResponseID string `json:"id"` QuestionID string `json:"questionID"` UserID string `json:"userID"` Active bool `json:"active"` Response string `json:"response"` IsCorrect bool `json:"isCorrect"` }
SecurityQuestionResponse models the data that is expected from the security question response table
type ServiceIdentifier ¶
type ServiceIdentifier struct { ID string `json:"id"` IdentifierType string `json:"identifierType"` IdentifierValue string `json:"identifierValue"` ServiceID string `json:"serviceID"` }
ServiceIdentifier models the structure of facility's service identifiers
type ServiceRequest ¶
type ServiceRequest struct { ID string `json:"id"` RequestType string `json:"requestType"` Request string `json:"request"` Status string `json:"status"` Active bool `json:"active"` ClientID string `json:"clientID,omitempty"` StaffID string `json:"staffID,omitempty"` CreatedAt time.Time `json:"created"` InProgressAt *time.Time `json:"inProgressAt"` InProgressBy *string `json:"inProgressBy"` ResolvedAt *time.Time `json:"resolvedAt"` ResolvedBy *string `json:"resolvedBy"` ResolvedByName *string `string:"resolvedByName"` FacilityID string `json:"facilityID,omitempty"` ClientName *string `json:"clientName,omitempty"` StaffName *string `json:"staffName,omitempty"` Username *string `json:"username,omitempty"` StaffContact *string `json:"staffContact,omitempty"` ClientContact *string `json:"clientContact,omitempty"` CCCNumber *string `json:"cccNumber,omitempty"` ScreeningToolName string `json:"screeningToolName"` ScreeningToolScore string `json:"screeningToolScore"` ProgramID string `json:"programID,omitempty"` OrganisationID string `json:"organisationID,omitempty"` Meta map[string]interface{} `json:"meta"` CaregiverID string `json:"caregiverID"` CaregiverName *string `json:"caregiverName"` CaregiverContact *string `json:"caregiverContact"` // Facility-Registry Specific Services []FacilityService `json:"services"` }
ServiceRequest is a domain entity that represents a service request.
type ServiceRequestPage ¶
type ServiceRequestPage struct { Results []*ServiceRequest `json:"results"` Pagination Pagination `json:"pagination"` }
ServiceRequestPage is used to show a paginated object of the service request
type ServiceRequestsCount ¶
type ServiceRequestsCount struct { Total int `json:"total"` RequestsTypeCount []*RequestTypeCount `json:"requestsTypeCount"` }
ServiceRequestsCount ...
type ServiceRequestsCountResponse ¶
type ServiceRequestsCountResponse struct { ClientsServiceRequestCount *ServiceRequestsCount `json:"clientServiceRequestCount"` StaffServiceRequestCount *ServiceRequestsCount `json:"staffServiceRequestCount"` }
ServiceRequestsCountResponse returns both clients and staff service requests
type Session ¶
type Session struct { ID string ClientID string Username string Subject string ExpiresAt map[fosite.TokenType]time.Time // Default Extra map[string]interface{} UserID string User User }
func NewSession ¶
func (*Session) GetExpiresAt ¶
GetExpiresAt returns the expiration time of a token if set, or time.IsZero() if not.
session.GetExpiresAt(fosite.AccessToken)
func (*Session) GetExtraClaims ¶
func (*Session) GetSubject ¶
GetSubject returns the subject, if set. This is optional and only used during token introspection.
func (*Session) GetUsername ¶
GetUsername returns the username, if set. This is optional and only used during token introspection.
func (*Session) IDTokenClaims ¶
func (s *Session) IDTokenClaims() *jwt.IDTokenClaims
IDTokenClaims returns a pointer to claims which will be modified in-place by handlers. Session should store this pointer and return always the same pointer.
func (*Session) IDTokenHeaders ¶
IDTokenHeaders returns a pointer to header values which will be modified in-place by handlers. Session should store this pointer and return always the same pointer.
type SortParam ¶
type SortParam struct { Field enums.FilterSortDataType Direction enums.SortDataType }
SortParam includes the fields required for sorting the different types of fields
type StaffProfile ¶
type StaffProfile struct { ID *string `json:"id"` User *User `json:"user"` UserID string `json:"userID"` // foreign key to user Active bool `json:"active"` StaffNumber string `json:"staffNumber"` Facilities []*Facility `json:"facilities"` // TODO: needs at least one DefaultFacility *Facility `json:"defaultFacility"` OrganisationID string `json:"organisationID"` ProgramID string `json:"programID"` IsOrganisationAdmin bool `json:"isOrganisationAdmin"` Identifiers []*Identifier `json:"identifiers"` }
StaffProfile represents the staff profile model
type StaffRegistrationPayload ¶
type StaffRegistrationPayload struct { UserProfile User `json:"userProfile"` Phone Contact `json:"phone"` StaffIdentifier Identifier `json:"staffIdentifier"` Staff StaffProfile `json:"staff"` IsOrganisationAdmin bool `json:"isOrganisationAdmin"` }
StaffRegistrationPayload carries with it the staff registration details
type StaffResponse ¶
type StaffResponse struct { StaffProfile StaffProfile `json:"staffProfile"` Roles []*AuthorityRole `json:"roles"` Permissions []*AuthorityPermission `json:"permissions"` CommunityProfile CommunityProfile `json:"communityProfile"` }
type Submission ¶
type Submission struct { InstanceID string `json:"instanceID"` SubmitterID int `json:"submitterID"` DeviceID string `json:"deviceID"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` ReviewState string `json:"reviewState"` Submitter Submitter `json:"submitter"` }
Submission represents a survey's submission domain model
type Submitter ¶
type Submitter struct { ID int `json:"id"` Type string `json:"type"` DisplayName string `json:"displayName"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt time.Time `json:"deletedAt"` }
Submitter represents a survey's submitter domain model
type SurveyForm ¶
type SurveyForm struct { ProjectID int `json:"projectID"` XMLFormID string `json:"xmlFormID"` Name string `json:"name"` EnketoID string `json:"enketoID"` Version string `json:"version"` }
SurveyForm is contains the information about a survey form
type SurveyRespondent ¶
type SurveyRespondent struct { ID string `json:"id"` Name string `json:"name"` SubmittedAt time.Time `json:"submittedAt"` ProjectID int `json:"projectID"` SubmitterID int `json:"submitterID"` FormID string `json:"formID"` CaregiverID *string `json:"caregiverID"` }
SurveyRespondent represents a survey's respondent domain model
type SurveyRespondentPage ¶
type SurveyRespondentPage struct { SurveyRespondents []*SurveyRespondent `json:"surveyRespondents"` Pagination Pagination `json:"pagination"` }
SurveyRespondentPage represents a survey's respondent domain model
type SurveyResponse ¶
type SurveyResponse struct { Question string `json:"question"` QuestionType string `json:"questionType"` Answer []string `json:"answer"` }
SurveyResponse represents a single survey submission
type SurveyServiceRequestUser ¶
type SurveyServiceRequestUser struct { Name string `json:"name"` FormID string `json:"formID"` ProjectID int `json:"projectID"` SubmitterID int `json:"submitterID"` SurveyName string `json:"surveyName"` ServiceRequestID string `json:"serviceRequestID"` PhoneNumber string `json:"phoneNumber"` }
SurveyServiceRequestUser is the models for a user(client) who has a survey service request
type SurveyServiceRequestUserPage ¶
type SurveyServiceRequestUserPage struct { Users []*SurveyServiceRequestUser `json:"users"` Pagination Pagination `json:"pagination"` }
SurveyServiceRequestUserPage models the user's(client) survey service request page
type TermsOfService ¶
type TermsOfService struct { TermsID int `json:"termsID"` Text *string `json:"text"` Flavour feedlib.Flavour `json:"flavour"` ValidFrom time.Time `json:"validFrom"` ValidTo time.Time `json:"validTo"` }
TermsOfService contains the struct field to hold the required display data for the terms of service.
type UpdateFacilityPayload ¶
type UpdateFacilityPayload struct { FacilityID string `json:"facilityID"` FHIROrganisationID string `json:"fhirOrganisationID"` }
UpdateFacilityPayload is the payload for updating faacility(s) fhir organization ID
type UpdateServiceRequestsPayload ¶
type UpdateServiceRequestsPayload struct {
ServiceRequests []ServiceRequest `json:"serviceRequests" validate:"required"`
}
UpdateServiceRequestsPayload defined a list of service requests to synchronize MyCareHub with.
type User ¶
type User struct { ID *string `json:"id"` Username string `json:"userName"` Email *string `json:"email"` Name string `json:"name"` Gender enumutils.Gender `json:"gender"` Active bool `json:"active"` Contacts *Contact `json:"contacts"` PushTokens []string `json:"pushTokens"` // when a user logs in successfully, set this LastSuccessfulLogin *time.Time `json:"lastSuccessfulLogin"` // whenever there is a failed login (e.g bad PIN), set this // reset to null / blank when they succeed at logging in LastFailedLogin *time.Time `json:"lastFailedLogin"` // each time there is a failed login, **increment** this // set to zero after successful login FailedLoginCount int `json:"failedLoginCount"` // calculated each time there is a failed login NextAllowedLogin *time.Time `json:"nextAllowedLogin"` PinChangeRequired bool `json:"pinChangeRequired"` HasSetPin bool `json:"hasSetPin"` HasSetSecurityQuestion bool `json:"hasSetSecurityQuestions"` IsPhoneVerified bool `json:"isPhoneVerified"` TermsAccepted bool `json:"termsAccepted"` AcceptedTermsID int `json:"acceptedTermsID"` // foreign key to version of terms they accepted Suspended bool `json:"suspended"` Avatar string `json:"avatar"` Roles []*AuthorityRole `json:"roles"` Permissions []*AuthorityPermission `json:"permissions"` DateOfBirth *time.Time `json:"dateOfBirth"` FailedSecurityCount int `json:"failedSecurityCount"` PinUpdateRequired bool `json:"pinUpdateRequired"` HasSetNickname bool `json:"hasSetNickname"` CurrentOrganizationID string `json:"currentOrganizationID"` CurrentProgramID string `json:"currentProgramID"` CurrentUserType string `json:"currentUserType"` IsSuperuser bool `json:"isSuperuser"` }
User holds details that both the client and staff have in common
Client and Staff cannot exist without being a user
type UserPIN ¶
type UserPIN struct { UserID string `json:"userID"` HashedPIN string `json:"hashedPin"` ValidFrom time.Time `json:"validFrom"` ValidTo time.Time `json:"validTo"` IsValid bool `json:"isValid"` Salt string `json:"salt"` }
UserPIN is used to store users' PINs and their entire change history.
type UserSurvey ¶
type UserSurvey struct { ID string `json:"id"` Active bool `json:"active"` Created time.Time `json:"created"` Link string `json:"link"` Title string `json:"title"` Description string `json:"description"` HasSubmitted bool `json:"hasSubmitted"` UserID string `json:"userID"` Token string `json:"token"` ProjectID int `json:"projectID"` FormID string `json:"formID"` LinkID int `json:"linkID"` SubmittedAt time.Time `json:"submittedAt"` ProgramID string `json:"programID"` OrganisationID string `json:"organisationID"` }
UserSurvey represents a user's surveys domain model
type WellKnown ¶
type WellKnown struct {
MHomeserver MHomeserver `json:"m.homeserver"`
}
WellKnown represents the 'known server` to matrix`
type WorkStationDetails ¶
type WorkStationDetails struct { Notifications int `json:"notifications"` Surveys int `json:"surveys"` Articles int `json:"articles"` Messages int `json:"messages"` ServiceRequests int `json:"serviceRequests"` }
WorkStationDetails contains the details of specific items in a facility.
These include things like number of notification associated to that facility, client's surveys, service requests etc
Source Files ¶
- appointments.go
- authority.go
- booking.go
- caregiver.go
- category.go
- communities.go
- content.go
- facility.go
- feedback.go
- filter_and_sort.go
- health_diary.go
- healthdiary.go
- metrics.go
- notifications.go
- oauth.go
- oauth_client.go
- oauth_session.go
- organisation.go
- otp.go
- pagination.go
- program.go
- questionnaires.go
- security_questions.go
- servicerequest.go
- surveys.go
- terms.go
- user.go
- workstation_detail.go