-
Notifications
You must be signed in to change notification settings - Fork 2
Components
Components are the building blocks of Epsilon, which are used to make elements such as the performance dashboard and competence document.
The competence document and performance dashboard makes use of a diverse set of components, mainly defined by the FHICT organization within Open Learning. Due to the fact that these names are a little confusing, it is nice to define them here and give short description to prevent confusion.
- Persona page: Contains information about a students' persona and allows them to express themselves in their own way.
- Context: Contains information about in which context the student is currently working.
- Competence profile: A matrix containing each architectural layer and activity, with each cell being the level the student has shown competence in.
- Projects: A list of projects the student is working in or has worked on, including a short description.
- KPI table: A table with all of the KPI's a student has proved during a specific term, columns are named as KPI, Assignment, and Grade.
- KPI matrix: A matrix showing the KPI's categorized under assignments or projects (configurable), with each KPI containing a status whether the KPI is awaiting grade, inapplicable, insufficient or mastered.
- FeedPulse: A list of the FeedPulse checkpoints made during a specific term.
- Reflection: A reflection for a specific section of the term such as sprint or mid-term, which contains personal learning experiences and allows the student to express their feelings about the term and reflect on it.
Each component in the application has its own distinct set of data models and fetching mechanisms. These mechanisms are employed to retrieve the required data and convert it into the corresponding return model and export formats. By functioning independently of other components, this approach establishes a modular and scalable architecture, allowing for effortless extension of components for the competence document and performance dashboard.
Components are plain and simple data models that encapsulate all the necessary information to represent a specific component on our front-end systems such as the Single-Page Application (SPA), and Word generator.
Below are two examples of what data models can contain:
public record CompetenceProfile(
IHboIDomain HboIDomain,
IEnumerable<ProfessionalTaskResult> ProfessionalTaskOutcomes,
IEnumerable<ProfessionalSkillResult> ProfessionalSkillOutcomes
);public record PersonaPage(
string PersonaHtml
);To retrieve the necessary data for the component's data model, you need to create a component fetcher class by inheriting the CompetenceComponentFetcher class with the specified data model created earlier. Here's an example:
public class PersonaPageComponentFetcher : CompetenceComponentFetcher<PersonaPage> { }The fetcher class can now override the Fetch method to make use of all the services within Epsilon to retrieve the required data. Here's an example:
public class PersonaPageComponentFetcher : CompetenceComponentFetcher<PersonaPage>
{
private readonly IPageHttpService _pageHttpService;
private readonly IFileHttpService _fileHttpService;
private readonly CanvasSettings _canvasSettings;
public PersonaPageComponentFetcher(
IPageHttpService pageHttpService,
IFileHttpService fileHttpService,
IOptions<CanvasSettings> canvasSettings
)
{
_pageHttpService = pageHttpService;
_fileHttpService = fileHttpService;
_canvasSettings = canvasSettings.Value;
}
public override async Task<PersonaPage> Fetch()
{
var courseId = _canvasSettings.CourseId;
var personaHtml = await _pageHttpService.GetPageByName(courseId, "front_page");
var updatedPersonaHtml = await GetPersonaHtmlDocument(personaHtml);
var personaPage = new PersonaPage(updatedPersonaHtml.Text);
return personaPage;
}
}To meet the required export format transformations, your data model needs to implement the IWordCompetenceComponent interface with a method that extends a Word document with the corresponding component itself. Here's an example of how the PersonaPage data model accomplishes this:
public record PersonaPage(string PersonaHtml) : IWordCompetenceComponent
{
public void AddToWordDocument(MainDocumentPart mainDocumentPart)
{
var personaHtmlBuffer = Encoding.UTF8.GetPreamble().Concat(Encoding.UTF8.GetBytes($"<html>{PersonaHtml}</html>")).ToArray();
using var personaHtmlStream = new MemoryStream(personaHtmlBuffer);
var formatImportPart = mainDocumentPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.Html);
formatImportPart.FeedData(personaHtmlStream);
mainDocumentPart.Document.AppendChild(new Body(
new AltChunk
{
Id = mainDocumentPart.GetIdOfPart(formatImportPart),
}
));
}
}Epsilon is licensed under the terms of GPL v3. See LICENSE for details.