Commit 622775c1 authored by Theis's avatar Theis
Browse files

Fixed a compliance bug and the UI only shows positive compliance

parent 6e2754b4
Pipeline #111457 passed with stage
in 4 minutes and 35 seconds
......@@ -147,9 +147,8 @@ app.post("/home/:ssn", async (req, res) => {
//Result from ML model for both cases
var citizenCompleteTrainingPrediction = await getCompleteTrainingPrediction(inputForCompleteTrainingPrediction);
var citizenAlarmPrediction = await getAlarmPrediction(inputForAlarmPrediction);
convertDataSizeToKb("Combined datasize from both the ML Model and Database in Kb: ", { citizenData, citizenCompleteTrainingPrediction, citizenAlarmPrediction });
convertDataSizeToKb("Combined datasize from both the ML Model and Database in Kb: ", { citizenData, citizenCompleteTrainingPrediction, citizenAlarmPrediction });
res.json({ citizenData, citizenCompleteTrainingPrediction, citizenAlarmPrediction });
await deleteVariable([
......
export class Compliance {
compliance: number;
constructor(compliance: number) {
this.compliance = compliance;
}
getCompliance() {
return this.compliance;
}
}
export class Month {
private $_aids: number
private $_homehelp: any
private $_date: Date
constructor(aids: number, homehelp: any, date: Date) {
this.$_aids = aids;
this.$_homehelp = homehelp;
this.$_date = date
}
get date(): Date {
return this.$_date;
}
set date(value: Date) {
this.$_date = value;
}
set aids(value: number) {
this.$_aids = value;
}
set homehelp(value: any) {
this.$_homehelp = value;
}
getNumberOfAids(): number {
return this.$_aids
}
getAverageHoursOfHomehelp(): number {
return this.$_homehelp
}
}
import {Month} from "@/model/Month";
export class Quarter {
private $_year: number;
private $_quarter: number;
private $_month1: Month
private $_month2: Month
private $_month3: Month
constructor(year: number, quarter: number, month1: Month, month2: Month, month3: Month) {
this.$_year = year;
this.$_quarter = quarter;
this.$_month1 = month1;
this.$_month2 = month2;
this.$_month3 = month3;
}
get month1(): Month {
return this.$_month1;
}
get month2(): Month {
return this.$_month2;
}
get month3(): Month {
return this.$_month3;
}
get year(): number {
return this.$_year;
}
get quarter(): number {
return this.$_quarter;
}
get quarterName(): string {
return 'Q'+this.$_quarter.toString() + ' ' + this.$_year
}
getNumberOfActiveAids(): number {
return Math.max(this.$_month1.getNumberOfAids(), this.$_month2.getNumberOfAids(), this.$_month3.getNumberOfAids())
}
getNumberOfHomehelpHours(): number {
const totalHours = this.$_month1.getAverageHoursOfHomehelp() + this.$_month2.getAverageHoursOfHomehelp() +this.$_month3.getAverageHoursOfHomehelp()
return totalHours/3
}
getAverageHoursOfHomehelp(): number {
return this.$_month1.getAverageHoursOfHomehelp() + this.$_month2.getAverageHoursOfHomehelp() + this.$_month3.getAverageHoursOfHomehelp()
}
}
......@@ -23,7 +23,7 @@ class DataService {
store.dispatch("probabilityAlarm", [citizenInformation.data.citizenAlarmPrediction.EventTimes, citizenInformation.data.citizenAlarmPrediction.SurvivalProbs]);
store.dispatch("probabilityExplanationComplete", citizenInformation.data.citizenCompleteTrainingPrediction.CompleteArguments);
store.dispatch("probabilityExplanationAlarm", citizenInformation.data.citizenAlarmPrediction.AlarmArguments);
store.dispatch("compliance", citizenInformation.data.citizenCompleteTrainingPrediction.ComplianceProb);
store.dispatch("compliance", citizenInformation.data.citizenCompleteTrainingPrediction.Compliance);
return true;
}
}
......
import {Module} from "vuex";
import {Compliance} from "@/model/Compliance";
const complianceStore: Module<any,any> = {
state: {
......@@ -7,7 +6,7 @@ const complianceStore: Module<any,any> = {
},
mutations: {
SET_COMPLIANCE(state, value) {
state.compliance = new Compliance(value)
state.compliance = value
},
},
actions: {
......@@ -16,7 +15,7 @@ const complianceStore: Module<any,any> = {
},
},
getters: {
compliance: state => state.compliance,
get_compliance: state => state.compliance,
}
}
......
......@@ -6,15 +6,13 @@
<v-card class="pa-2" outlined rounded="15px" elevation="5">
<probability :probability="this.$store.getters.probability_complete" text="Sandsynlighed for at gennemføre træning" />
<div class="compliance">
<v-chip color="#E2E2E2">
Træningsparat
<div v-if="getCompliance == 1">
<div v-if="this.$store.getters.get_compliance == 1">
<v-chip color="#E2E2E2">
Træningsparat
<v-icon right color="#53D000">mdi-thumb-up</v-icon>
</div>
<div v-else>
<v-icon right color="#FF2402">mdi-thumb-down</v-icon>
</div>
</v-chip>
</v-chip>
</div>
<div v-else />
</div>
<explainer />
</v-card>
......@@ -38,11 +36,6 @@ import AidTabs from "@/components/AidTabs.vue";
export default Vue.extend({
name: "TrainingCompletion",
data: () => ({}),
methods: {
getCompliance(): any {
return this.$store.getters.compliance();
},
},
components: {
Probability,
Explainer,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment