Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PerceivedRisk shouldn't affect "completeness" #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (r *Record) RiskFactorDateTime() (time.Time, error) {
// set, and that all risk factor scores are set
func (r *Record) IsRiskFactorsComplete() bool {
return r.RiskFactorDate != "" && r.ClinicalRisk != "" && r.FunctionalRisk != "" &&
r.PsychosocialRisk != "" && r.UtilizationRisk != "" && r.PerceivedRisk != ""
r.PsychosocialRisk != "" && r.UtilizationRisk != ""
}

// ToPie converts the record to the Intervention Engine pie format used for identifying risk components. The
Expand Down
50 changes: 25 additions & 25 deletions models/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,34 @@ func (suite *RecordSuite) TestLoadRecordsFromJSON() {
assert := suite.Assert()
assert.Len(suite.Records, 3)
assert.Equal(Record{
StudyID: float64(1),
EventName: "initial_arm_1",
RiskFactorDate: "2015-12-07",
ClinicalRisk: "3",
FunctionalRisk: "2",
PsychosocialRisk: "1",
UtilizationRisk: "3",
PerceivedRisk: "3",
StudyID: float64(1),
EventName: "initial_arm_1",
RiskFactorDate: "2015-12-07",
ClinicalRisk: "3",
FunctionalRisk: "2",
PsychosocialRisk: "1",
UtilizationRisk: "3",
PerceivedRisk: "3",
}, suite.Records[0])
assert.Equal(Record{
StudyID: float64(1),
EventName: "visit1_arm_1",
RiskFactorDate: "2016-04-01",
ClinicalRisk: "3",
FunctionalRisk: "2",
PsychosocialRisk: "1",
UtilizationRisk: "4",
PerceivedRisk: "4",
StudyID: float64(1),
EventName: "visit1_arm_1",
RiskFactorDate: "2016-04-01",
ClinicalRisk: "3",
FunctionalRisk: "2",
PsychosocialRisk: "1",
UtilizationRisk: "4",
PerceivedRisk: "4",
}, suite.Records[1])
assert.Equal(Record{
StudyID: "a",
EventName: "initial_arm_1",
RiskFactorDate: "2016-02-21",
ClinicalRisk: "1",
FunctionalRisk: "1",
PsychosocialRisk: "2",
UtilizationRisk: "1",
PerceivedRisk: "2",
StudyID: "a",
EventName: "initial_arm_1",
RiskFactorDate: "2016-02-21",
ClinicalRisk: "1",
FunctionalRisk: "1",
PsychosocialRisk: "2",
UtilizationRisk: "1",
PerceivedRisk: "2",
}, suite.Records[2])
}

Expand Down Expand Up @@ -110,7 +110,7 @@ func (suite *RecordSuite) TestIsRiskFactorsComplete() {

record = suite.Records[0]
record.PerceivedRisk = ""
assert.False(record.IsRiskFactorsComplete(), "Empty PerceivedRisk flag indicates NOT complete")
assert.True(record.IsRiskFactorsComplete(), "Empty PerceivedRisk flag should not affect completeness since risk score is now highest of the four factors.")
}

func (suite *RecordSuite) TestToPie() {
Expand Down