Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Add decaying average calculations (#80)
Browse files Browse the repository at this point in the history
* initial version of the decaying average functionality

* Added Professional development

* Rename namespace to correspond with coding guidelines

* Separate records into different files

* Rename Value to Name to correspond with domain

* Rename Value to Level to correspond with domain

* Add professional skills to domain

* Add short name to architectural layer and professional skills

* Rename properties in competence profile random data filler

* Rename CompetenceProfileOutcome to ProfessionalTaskOutcome

* Add Professional skill outcome to competence profile

* Use singular name

* Use id references instead of name values

* Use type keyword

* re-adding decaying average files and logic

* Add submissions from all courses from student to competence profile transformation

* Fix merge issues

* Add task and skill outcomes to competence profile return type

* Fetch terms from canvas

* Remove redundant imports

* Change default application url

* Prevent browser from launching on every restart

* Cleanup code

* Add filter enrolment term function

* Add terms to competence profile

* Remove unused terms function

* Added filter on professional outcomes and sorting

* Removed unused things

* V0.1

* Defining colors for elements

* Remove obsolete styling

* Update pnpm lock file

* Add Vue router

* Resolve ESLint warnings

* Add authorization view and controller

* Use controller templating for route

* A lot of stuff

* A lot of stuff

* Working

* Set it all to vue 3 supported format

* Fix import path

* Add CORS policy

* Realtime user data

* Add terms to competence profile

* Cleanup code and improve competence profile converter

* Filter on PostedAt value

* initial version of the decaying average functionality

* re-adding decaying average files and logic

* Decaying average calculation functionality supporting both ArchitectureLayer and Skill outcomes

* Decaying average calculation functional per layer per activity and skills are independent of layers

---------

Co-authored-by: jan.fojtik <jan.fojtik@indicia.nl>
Co-authored-by: Tara <tarawillink@gmail.com>
Co-authored-by: Jelle Maas <typiqally@gmail.com>
Co-authored-by: Sven <svenroermond@hotmail.com>
Co-authored-by: Neal Geilen <info@nealgeilen.nl>
  • Loading branch information
6 people committed May 26, 2023
1 parent 2fb0033 commit 718afa4
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ namespace Epsilon.Abstractions.Component;

public interface ICompetenceProfileConverter
{
public CompetenceProfile ConvertFrom(GetAllUserCoursesSubmissionOutcomes getAllUserCoursesSubmissionOutcomes, IEnumerable<EnrollmentTerm> terms);
public CompetenceProfile ConvertFrom(GetAllUserCoursesSubmissionOutcomes getAllUserCoursesSubmissionOutcomes,IHboIDomain domain, IEnumerable<EnrollmentTerm> terms);
}
4 changes: 3 additions & 1 deletion Epsilon.Abstractions/Model/CompetenceProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ public record CompetenceProfile(
IHboIDomain HboIDomain,
IEnumerable<ProfessionalTaskResult> ProfessionalTaskOutcomes,
IEnumerable<ProfessionalSkillResult> ProfessionalSkillOutcomes,
IEnumerable<EnrollmentTerm> Terms
IEnumerable<EnrollmentTerm> Terms,
IEnumerable<DecayingAveragePerLayer> DecayingAveragesPerTask,
IEnumerable<DecayingAveragePerSkill> DecayingAveragesPerSkill
);
18 changes: 17 additions & 1 deletion Epsilon.Canvas.Abstractions/Model/OutcomeResultCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,20 @@ public record OutcomeResultCollection(
[property: JsonPropertyName("outcome_results")]
IEnumerable<OutcomeResult> OutcomeResults,
[property: JsonPropertyName("linked")] OutcomeResultCollectionLink? Links
);
)
{
public double GetDecayingAverage()
{
var decayingAverage = 0.0;

foreach(var grade in OutcomeResults)
{
if (grade.Score != null)
{
decayingAverage = decayingAverage * 0.35 + grade.Score.Value * 0.65;
}
}

return decayingAverage;
}
}
48 changes: 40 additions & 8 deletions Epsilon/Component/Converters/CompetenceProfileConverter.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
using Epsilon.Abstractions.Component;
using Epsilon.Abstractions.Model;
using Epsilon.Canvas.Abstractions.Model;
using Epsilon.Canvas.Abstractions.Model.GraphQl;
using Epsilon.Canvas.Abstractions.QueryResponse;

namespace Epsilon.Component.Converters;

public class CompetenceProfileConverter : ICompetenceProfileConverter
{
public CompetenceProfile ConvertFrom(GetAllUserCoursesSubmissionOutcomes getAllUserCoursesSubmissionOutcomes, IEnumerable<EnrollmentTerm> enrollmentTerms)
public IEnumerable<DecayingAveragePerLayer> GetDecayingAverageTasks(IHboIDomain domain, IEnumerable<ProfessionalTaskResult> taskResults)
{
return domain.ArchitectureLayers.Select(layer => new DecayingAveragePerLayer(layer.Id,
domain.Activities.Select(activity =>
{
var decayingAverage = taskResults
.Where(task => task.ArchitectureLayer == layer.Id && task.Activity == activity.Id)
.Aggregate<ProfessionalTaskResult, double>(0,
(current, outcome) => current * 0.35 + outcome.Grade * 0.65);

return new DecayingAveragePerActivity(activity.Id, decayingAverage);
})));
}

public IEnumerable<DecayingAveragePerSkill> GetDecayingAverageSkills(IHboIDomain domain, IEnumerable<ProfessionalSkillResult> skillResults)
{
return domain.ProfessionalSkills.Select(skill =>
{
var decayingAverage = skillResults.Where(outcome => outcome.Skill == skill.Id)
.Aggregate<ProfessionalSkillResult, double>(0,
(current, outcome) => current * 0.35 + outcome.Grade * 0.65);

return new DecayingAveragePerSkill(skill.Id, decayingAverage);
});
}

public CompetenceProfile ConvertFrom(GetAllUserCoursesSubmissionOutcomes getAllUserCoursesSubmissionOutcomes,
IHboIDomain domain, IEnumerable<EnrollmentTerm> enrollmentTerms)
{
var taskResults = new List<ProfessionalTaskResult>();
var professionalResults = new List<ProfessionalSkillResult>();
Expand All @@ -20,7 +48,8 @@ public CompetenceProfile ConvertFrom(GetAllUserCoursesSubmissionOutcomes getAllU

foreach (var assessmentRating in assessmentRatings)
{
foreach (var (points, outcome) in assessmentRating.AssessmentRatings.Where(static ar => ar is { Points: not null, Outcome: not null } && ar.Points >= ar.Outcome.MasteryPoints))
foreach (var (points, outcome) in assessmentRating.AssessmentRatings.Where(static ar =>
ar is {Points: not null, Outcome: not null} && ar.Points >= ar.Outcome.MasteryPoints))
{
if (FhictConstants.ProfessionalTasks.TryGetValue(outcome!.Id, out var professionalTask))
{
Expand Down Expand Up @@ -51,18 +80,21 @@ public CompetenceProfile ConvertFrom(GetAllUserCoursesSubmissionOutcomes getAllU
}

var filteredTerms = enrollmentTerms
.Where(static term => term is { StartAt: not null, EndAt: not null })
.Where(term => taskResults.Any(taskOutcome => taskOutcome.AssessedAt >= term.StartAt && taskOutcome.AssessedAt <= term.EndAt)
|| professionalResults.Any(skillOutcome => skillOutcome.AssessedAt > term.StartAt && skillOutcome.AssessedAt < term.EndAt))
.Where(static term => term is {StartAt: not null, EndAt: not null})
.Where(term => taskResults.Any(taskOutcome =>
taskOutcome.AssessedAt >= term.StartAt && taskOutcome.AssessedAt <= term.EndAt)
|| professionalResults.Any(skillOutcome =>
skillOutcome.AssessedAt > term.StartAt && skillOutcome.AssessedAt < term.EndAt))
.Distinct()
.OrderBy(static term => term.StartAt);


return new CompetenceProfile(
new HboIDomain2018(),
domain,
taskResults,
professionalResults,
filteredTerms
filteredTerms,
GetDecayingAverageTasks(domain, taskResults),
GetDecayingAverageSkills(domain, professionalResults)
);
}
}

0 comments on commit 718afa4

Please sign in to comment.