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

Commit

Permalink
Add competence profile data model (#76)
Browse files Browse the repository at this point in the history
* Initial proof of concept for competence profile data model

* Refactor competence profile return type

* Created endpoint with updated HboIDomain and Mockdata. Also created GraphQL endpoint for student data

* Cleanup records to seperate GraphQL folder

* Fix GraphQL records

---------

Co-authored-by: Jelle Maas <typiqally@gmail.com>
Co-authored-by: Sven Hansen <76601644+1SvenHansen@users.noreply.github.com>
  • Loading branch information
3 people committed May 26, 2023
1 parent 7cbd454 commit c607762
Show file tree
Hide file tree
Showing 24 changed files with 197 additions and 25 deletions.
6 changes: 6 additions & 0 deletions Epsilon.Abstractions/Model/CompetenceProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Epsilon.Abstractions.Model;

public record CompetenceProfile(
HboIDomain HboIDomain,
IEnumerable<CompetenceProfileOutcome> CompetenceProfileOutcomes
);
9 changes: 9 additions & 0 deletions Epsilon.Abstractions/Model/CompetenceProfileOutcome.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Epsilon.Abstractions.Model;

public record CompetenceProfileOutcome(
string ArchitectureLayer,
string Activity,
int MasteryLevel,
int Grade,
DateTime AssessedAt
);
38 changes: 38 additions & 0 deletions Epsilon.Abstractions/Model/HboIDomain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace Epsilon.Abstractions.Model;

public record HboIDomain(
IEnumerable<ArchitectureLayer> ArchitectureLayers,
IEnumerable<Activity> Activities,
IEnumerable<MasteryLevel> MasteryLevels
)
{
public static readonly HboIDomain HboIDomain2018 = new(
new[]
{
new ArchitectureLayer("Hardware Interfacing", "#8D9292"),
new ArchitectureLayer("Infrastructure", "#6EA7D4"),
new ArchitectureLayer("Organisational Processes", "#D16557"),
new ArchitectureLayer("User Interaction", "#E29C53"),
new ArchitectureLayer("Software", "#96B9C0")
},
new[]
{
new Activity("Manage & Control"),
new Activity("Analysis"),
new Activity("Advise"),
new Activity("Design"),
new Activity("Realisation")
},
new[]
{
new MasteryLevel(1, "#00B0F0"),
new MasteryLevel(2, "#00B050"),
new MasteryLevel(3, "#FFFC00"),
new MasteryLevel(4)
}
);
}

public record ArchitectureLayer(string Value, string? Color = null);
public record Activity(string Value, string? Color = null);
public record MasteryLevel(int Value, string? Color = null);
8 changes: 8 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/GraphQL/AssessmentRating.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record AssessmentRating(
[property: JsonPropertyName("points")] double? Points,
[property: JsonPropertyName("outcome")] Outcome? Outcome
);
8 changes: 8 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/GraphQL/Assignment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Assignment(
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("modules")] List<Module>? Modules
);
8 changes: 8 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/GraphQL/Course.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Course(
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("submissionsConnection")] SubmissionsConnection? SubmissionsConnection
);
7 changes: 7 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/GraphQL/Module.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Module(
[property: JsonPropertyName("name")] string Name
);
8 changes: 8 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/GraphQL/Node.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Node(
[property: JsonPropertyName("assignment")] Assignment? Assignment,
[property: JsonPropertyName("rubricAssessmentsConnection")] RubricAssessmentsConnection? RubricAssessmentsConnection
);
7 changes: 7 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/GraphQL/Outcome.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Outcome(
[property: JsonPropertyName("title")] string? Title
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record RubricAssessmentNode(
[property: JsonPropertyName("assessmentRatings")] List<AssessmentRating>? AssessmentRatings,
[property: JsonPropertyName("user")] User? User
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record RubricAssessmentsConnection(
[property: JsonPropertyName("nodes")] List<RubricAssessmentNode>? Nodes
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record SubmissionsConnection(
[property: JsonPropertyName("nodes")] List<Node>? Nodes
);
7 changes: 7 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/GraphQL/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record User(
[property: JsonPropertyName("name")] string Name
);
11 changes: 4 additions & 7 deletions Epsilon.Canvas.Abstractions/Model/GraphQl/AssessmentRating.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record AssessmentRating(
[property: JsonPropertyName("criterion")] Criterion? Criterion,
[property: JsonPropertyName("points")] double? Points
)
{
public bool IsMastery => Points >= Criterion?.MasteryPoints;
}
[property: JsonPropertyName("points")] double? Points,
[property: JsonPropertyName("outcome")] Outcome? Outcome
);
7 changes: 3 additions & 4 deletions Epsilon.Canvas.Abstractions/Model/GraphQl/Assignment.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Assignment(
[property: JsonPropertyName("name")] string? Name,
[property: JsonPropertyName("modules")] IEnumerable<Module>? Modules ,
[property: JsonPropertyName("rubric")] Rubric? Rubric
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("modules")] List<Module>? Modules
);
4 changes: 2 additions & 2 deletions Epsilon.Canvas.Abstractions/Model/GraphQl/Course.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Course(
[property: JsonPropertyName("name")] string? Name,
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("submissionsConnection")] SubmissionsConnection? SubmissionsConnection
);
2 changes: 1 addition & 1 deletion Epsilon.Canvas.Abstractions/Model/GraphQl/Module.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Module(
[property: JsonPropertyName("name")] string Name
Expand Down
5 changes: 2 additions & 3 deletions Epsilon.Canvas.Abstractions/Model/GraphQl/Outcome.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record Outcome(
[property: JsonPropertyName("_id")] int Id,
[property: JsonPropertyName("title")] string Title
[property: JsonPropertyName("title")] string? Title
);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record RubricAssessmentNode(
[property: JsonPropertyName("assessmentRatings")] IReadOnlyList<AssessmentRating?>? AssessmentRatings
[property: JsonPropertyName("assessmentRatings")] List<AssessmentRating>? AssessmentRatings,
[property: JsonPropertyName("user")] User? User
);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record RubricAssessmentsConnection(
[property: JsonPropertyName("nodes")] IEnumerable<RubricAssessmentNode>? Nodes
[property: JsonPropertyName("nodes")] List<RubricAssessmentNode>? Nodes
);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record SubmissionsConnection(
[property: JsonPropertyName("nodes")] IReadOnlyCollection<SubmissionsConnectionNode>? Nodes
[property: JsonPropertyName("nodes")] List<Node>? Nodes
);
4 changes: 2 additions & 2 deletions Epsilon.Canvas.Abstractions/Model/GraphQl/User.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model.GraphQl;
namespace Epsilon.Canvas.Abstractions.Model.GraphQL;

public record User(
[property: JsonPropertyName("name")] string? Name
[property: JsonPropertyName("name")] string Name
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
using Epsilon.Canvas.Abstractions.Model.GraphQL;

namespace Epsilon.Canvas.Abstractions.QueryResponse;

public record GetUserSubmissionOutcomes(
[property: JsonPropertyName("data")] GetUserSubmissionOutcomes.CourseData? Data
)
{
public record CourseData(
[property: JsonPropertyName("course")] Course? Course
);
};
35 changes: 35 additions & 0 deletions Epsilon.Canvas/QueryConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Epsilon.Canvas;

public static class QueryConstants
{
public const string GetUserSubmissionOutcomes = @"
query GetUserSubmissionOutcomes {
course(id: $courseId) {
name
submissionsConnection {
nodes {
assignment {
name
modules {
name
}
}
rubricAssessmentsConnection {
nodes {
assessmentRatings {
points
outcome {
title
}
}
user {
name
}
}
}
}
}
}
}
";
}

0 comments on commit c607762

Please sign in to comment.