models

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	StudyID   interface{} `json:"study_id"`
	EventName string      `json:"redcap_event_name"`

	RiskFactorDate   string `json:"rf_date"`
	ClinicalRisk     string `json:"rf_cmc_risk_cat"`
	FunctionalRisk   string `json:"rf_func_risk_cat"`
	PsychosocialRisk string `json:"rf_sb_risk_cat"`
	UtilizationRisk  string `json:"rf_util_risk_cat"`
	PerceivedRisk    string `json:"rf_risk_predicted"`
}

Record represents the key info from a REDCap record in the risk stratification project

func (*Record) IsRiskFactorsComplete

func (r *Record) IsRiskFactorsComplete() bool

IsRiskFactorsComplete checks that the risk factors form was marked as complete, that a valid risk factor date was set, and that all risk factor scores are set

func (*Record) RiskFactorDateTime

func (r *Record) RiskFactorDateTime() (time.Time, error)

RiskFactorDateTime returns the parsed date/time for the risk factor form

func (*Record) StudyIDString

func (r *Record) StudyIDString() string

StudyIDString returns a string representation of the study ID (which could be a string or a number)

func (*Record) ToPie

func (r *Record) ToPie(patientURL string) (pie *plugin.Pie, err error)

ToPie converts the record to the Intervention Engine pie format used for identifying risk components. The corresponding patientURL must be passed in so the risk pie can be assiocated to the patient on the FHIR server. If the record doesn't have complete risk factors, it will result in an error.

func (*Record) ToRiskServiceCalculationResult

func (r *Record) ToRiskServiceCalculationResult(patientURL string) (result *plugin.RiskServiceCalculationResult, err error)

ToRiskServiceCalculationResult converts the record to a RiskServiceCalculationResult. The corresponding patientURL must be passed in so the risk pie can be assiocated to the patient on the FHIR server. If the record doesn't have complete risk factors, it will result in an error.

type Study

type Study struct {
	ID      string
	Records []Record
}

Study represents a single study / patient, containing all of the records making up the study

func (*Study) AddRecord

func (s *Study) AddRecord(r Record) error

AddRecord adds a record to the study, checking to ensure it has the same Study ID

func (*Study) ToRiskServiceCalculationResults

func (s *Study) ToRiskServiceCalculationResults(patientURL string) []plugin.RiskServiceCalculationResult

ToRiskServiceCalculationResults converts the records to RiskServiceCalculationResults and returns them sorted by the AsOf date. Note that the size of the resulting list may be smaller than the size of the record list since some records may represent incomplete risk factors. The corresponding patientURL must be passed in so the risk pie can be assiocated to the patient on the FHIR server.

type StudyMap

type StudyMap map[string]*Study

StudyMap is a simple map of studies indexed by the study ID, providing a few convenience functions

func (StudyMap) AddRecord

func (s StudyMap) AddRecord(r Record) error

AddRecord adds a record to the appropriate study in the map. If no corresponding study is found, adds a new study to the map.

func (StudyMap) AddRecords

func (s StudyMap) AddRecords(r []Record) error

AddRecords adds a set of records, ensuring each record is associated with its matching study. If no corresponding study is found for a given record, adds a new study to the map.

Jump to

Keyboard shortcuts

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