xapi

An experimental F# implementation of the xAPI specification with a focus on type safety and immutability.


Project maintained by gowithfloat Hosted on GitHub Pages — Theme by mattgraham

Float.xAPI Build Status codecov Documentation Status license nuget

An experimental F# implementation of the xAPI specification with a focus on type safety and immutability. Wherever possible, we have strived to translate the xAPI specification directly to code, with requirements embedded as type checks.

Status

This library is currently in a pre-release state. Feedback is welcome but active development continues and this library should not be considered ready for production use. However, we hope that the existing code base will provide an indication of the implementation goals for this project.

C# Example

To craft a simple statement, you first need an actor:

var address = new MailAddress("example@gowithfloat.com");
var mailbox = new Mailbox(address);
var actor = new Agent(mailbox, "Example Learner");

A verb is a URI paired with a language map:

var id = new Uri("http://adlnet.gov/expapi/verbs/completed");
var definition = new LanguageMap(new LanguageTag(Language.English, Region.UnitedStates), "completed");
var verb = new Verb(id, definition);

An activity requires a definition and identifier; the definition needs a name, description, and type:

var name = LanguageMap.EnglishUS("Example Activity");
var description = LanguageMap.EnglishUS("An example activity.");
var theType = new Uri("http://adlnet.gov/expapi/activities/course");
var definition = new ActivityDefinition(name, description, theType);
var activityId = new Uri("http://www.example.com/example-activity");
var activity = new Activity(activityId, definition);

Combine the actor, verb, and activity into a statement:

var statement = new Statement(actor, verb, activity);

About

Existing implementations of the xAPI specification for .NET do not leverage the type system to ensure code will run safely. Furthermore, many implementations allow a high degree of mutability, leading to undesired and unpredictable behavior.

This library is an attempt to address these challenges and leverage functional programming paradigms to create a reusable xAPI implementation that is suitable for a variety of .NET runtimes such as ASP.NET and Xamarin, while leveraging the unique capabilities of the F# language to create safe and predictable code. Furthermore, future improvements to this library could use F* to create code with verified runtime behavior, or leverage compilers such as Fable to generate JavaScript variants of this library.

This implementation is influenced by the existing TinCan.NET and years of working with the xAPI specification.

Roadmap

Notes

License

All content in this repository is shared under an MIT license. See license.md for details.