repository

package
v0.0.0-...-9fc93d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServicesTable   = "Services"
	RequestsTable   = "Requests"
	CitiesTable     = "Cities"
	UsersTable      = "Users"
	FeedbackTable   = "Feedback"
	OnboardingTable = "OnboardingRequests"
)

Names of Open311 tables in dynamoDB

View Source
const (
	RequestOpen       = "open"       // request has been reported
	RequestAccepted   = "accepted"   // city worker has accepted responsibility to fix issue
	RequestInProgress = "inProgress" // request is actively being worked
	RequestClosed     = "closed"     // request has been resolved
)

constants to define Open311 Request status strings

View Source
const AwsRegion = endpoints.UsEast1RegionID // "us-east-1" -  US East (N. Virginia).

AwsRegion is the AWS Standard region in which the dynamo tables are created

Variables

This section is empty.

Functions

func IsValidServiceCode

func IsValidServiceCode(ServiceCode string) bool

Types

type AccountIDNotFoundErr

type AccountIDNotFoundErr struct {
	// contains filtered or unexported fields
}

func (*AccountIDNotFoundErr) Error

func (e *AccountIDNotFoundErr) Error() string

type AttributeValue

type AttributeValue struct {
	Key  string `json:"key"`
	Name string `json:"name"`
}

Possible value for ServiceAttribute that defines lists

type AuditEntry

type AuditEntry struct {
	ChangeNote string `json:"change_note"` // Text describing the change that was made to the Request
	AccountID  string `json:"account_id"`  // Unique ID for the user account of the person updating the request
	Timestamp  string `json:"timestamp"`   // RFC3339 formatted timestamp
}

type City

type City struct {
	CityName string `json:"city_name"`
	Endpoint string `json:"endpoint"`
}

func GetCities

func GetCities() ([]City, error)

func GetCity

func GetCity(id string) (City, error)

type CityNotFoundErr

type CityNotFoundErr struct {
	// contains filtered or unexported fields
}

func (*CityNotFoundErr) Error

func (e *CityNotFoundErr) Error() string

type Feedback

type Feedback struct {
	ID          string `json:"id"`
	AccountID   string `json:"account_id"`
	RequestID   string `json:"request_id"`
	Type        string `json:"type"`
	Description string `json:"description"`
}

type FeedbackResponse

type FeedbackResponse struct {
	ID string `json:"id"`
}

func AddFeedback

func AddFeedback(feedback Feedback) (FeedbackResponse, error)

type Media

type Media struct {
	MediaURL  string `json:"media_url"` // A URL to media associated with the request, eg an image.
	Timestamp string `json:"timestamp"` // RFC3339 formatted timestamp
}

type OnboardingRequest

type OnboardingRequest struct {
	ID        string `json:"id"`
	City      string `json:"city"`
	State     string `json:"state"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
	Feedback  string `json:"feedback"`
}

type OnboardingResponse

type OnboardingResponse struct {
	ID string `json:"id "`
}

func AddOnboardingRequest

func AddOnboardingRequest(request OnboardingRequest, accountID string) (OnboardingResponse, error)

type Request

type Request struct {
	ServiceRequestID  string           `json:"service_request_id"` // The unique ID of the service request created.
	Status            string           `json:"status"`             // The current status of the service request.
	StatusNotes       string           `json:"status_notes"`       // Explanation of why status was changed to current state or more details on current status than conveyed with status alone.
	ServiceName       string           `json:"service_name"`       // The human readable name of the service request type
	ServiceCode       string           `json:"service_code"`       // The unique identifier for the service request type
	Description       string           `json:"description"`        // A full description of the request or report submitted.
	AgencyResponsible string           `json:"agency_responsible"` // The agency responsible for fulfilling or otherwise addressing the service request.
	ServiceNotice     string           `json:"service_notice"`     // Information about the action expected to fulfill the request or otherwise address the information reported.
	RequestedDateTime string           `json:"requested_datetime"` // The date and time (RFC3339) when the service request was made.
	UpdatedDateTime   string           `json:"update_datetime"`    // The date and time (RFC3339) when the service request was last modified. For requests with status=closed, this will be the date the request was closed.
	ExpectedDateTime  string           `json:"expected_datetime"`  // The date and time (RFC3339) when the service request can be expected to be fulfilled. This may be based on a service-specific service level agreement.
	Address           string           `json:"address"`            // Human readable address or description of location.
	AddressID         string           `json:"address_id"`         // The internal address ID used by a jurisdictions master address repository or other addressing system.
	ZipCode           int32            `json:"zipcode"`            // The postal code for the location of the service request.
	Latitude          float32          `json:"lat"`                // latitude using the (WGS84) projection.
	Longitude         float32          `json:"lon"`                // longitude using the (WGS84) projection.
	MediaURL          string           `json:"media_url"`          // Media URL
	AuditLog          []AuditEntry     `json:"audit_log"`          // Slice of AuditEntry items - Log to keep track of all changes to a Request over time
	Values            []AttributeValue `json:"values"`             // Enables future expansion
}

Issues that have been reported as service requests. Location is submitted via lat/long or address

func GetRequest

func GetRequest(id string) (Request, error)

GetRequest takes a service_request_id, looks up that request in DynamoDB and returns the corresponding Open311 Request struct. If the service_request_id is not in the database, a RequestIdNotFoundErr error is set

func GetRequests

func GetRequests() ([]Request, error)

GetRequests returns slice of all Open311 Requests in DynamoBD Requests Table

type RequestIdNotFoundErr

type RequestIdNotFoundErr struct {
	// contains filtered or unexported fields
}

func (*RequestIdNotFoundErr) Error

func (e *RequestIdNotFoundErr) Error() string

type RequestResponse

type RequestResponse struct {
	ServiceRequestID string `json:"service_request_id"` // The unique ID of the service request created.
	ServiceNotice    string `json:"service_notice"`     // Information about the action expected to fulfill the request or otherwise address the information reported
	AccountID        string `json:"account_id"`         // Unique ID for the user account of the person submitting the request
}

func SubmitRequest

func SubmitRequest(request Request, accountID string) (RequestResponse, error)

SubmitRequest initializes a new Open311 request. This function generates a requestID, assigns the request creation time, initializes the request to 'open' sets the service name and group responsible to resolve and stores in DynamoDB requests table.

func UpdateRequest

func UpdateRequest(request Request, accountID string) (RequestResponse, error)

UpdateRequest takes an existing request and updates the DynamoDB with the new values after setting the 'UpdatedDateTime'

type Service

type Service struct {
	ServiceCode string   `json:"service_code"`
	ServiceName string   `json:"service_name"`
	Description string   `json:"description"`
	Metadata    bool     `json:"metadata"`
	Type        string   `json:"type"`
	Keywords    []string `json:"keywords"`
	Group       string   `json:"group"`
}

Service is an Open311 struct representing a service offered by a city

func GetService

func GetService(code string) (Service, error)

GetService takes a service code UUID, looks up that service in DynamoDB and returns the corresponding Open311 Service struct. If the requested service code is not in the database, a ServiceCodeNotFoundErr error is set

func GetServices

func GetServices() ([]Service, error)

GetServices provides a list of acceptable 311 service request types and their associated service codes. These request types can be unique to the city/jurisdiction.

type ServiceAttribute

type ServiceAttribute struct {
	Code                string           `json:"code"`
	DataType            string           `json:"datatype"`
	Variable            bool             `json:"variable"`
	Required            bool             `json:"required"`
	Order               int32            `json:"order"`
	Description         string           `json:"description"`
	DataTypeDescription string           `json:"datatype_description"`
	Values              []AttributeValue `json:"values"`
}

Single attribute extension for a service

type ServiceCodeNotFoundErr

type ServiceCodeNotFoundErr struct {
	// contains filtered or unexported fields
}

func (*ServiceCodeNotFoundErr) Error

func (e *ServiceCodeNotFoundErr) Error() string

type ServiceDefinition

type ServiceDefinition struct {
	ServiceCode string             `json:"service_code"`
	Attributes  []ServiceAttribute `json:"attributes"`
}

ServiceDefinition defines attributes associated with a service code. These attributes can be unique to the city/jurisdiction. These are necessary if the Service selected has metadata set as true from the GET Services response

type User

type User struct {
	AccountID         string   `json:"account_id"`            // Unique ID of Open311 User
	Groups            []string `json:"group_ids"`             // Slice of agencies or groups to which a user belongs
	SubmittedRequests []string `json:"submitted_request_ids"` // Slice of requests user has made
	WatchedRequests   []string `json:"watched_request_ids"`   // Slice of request user is watching
}

func GetUser

func GetUser(accountID string) (User, error)

GetUser takes a user's AccountID, looks up that user in DynamoDB and returns the corresponding User struct. If the requested AccountID is not in the database, an AccountIDNotFoundErr error is set

type UserIDAlreadyExistsErr

type UserIDAlreadyExistsErr struct {
	// contains filtered or unexported fields
}

func (*UserIDAlreadyExistsErr) Error

func (e *UserIDAlreadyExistsErr) Error() string

type UserResponse

type UserResponse struct {
	AccountID string `json:"account_id"` // Unique ID for the user account
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL