Data Deletion


Introduction

Deleting xAPI data may tricky for many reasons.

First, from the xAPI spec point of view, statements are not supposed to be deleted from the LRS. The main reason comes from the distributed nature of xAPI data. If 2 LRSs are synced and if you remove statements from the source LRS, the secondary LRS will never be informed. That's why xAPI introduced the capability to void statements. Voiding statements can be propagated to a secondary LRS.

Then, deleting statements can be hard because of the massive volume of data. Let's say you want to delete a TRAX LRS store with millions of statements, you can't just drop the statements table because there may be data from other stores. So TRAX LRS will have to delete only data from a given store, including its relations with other tables like activities, agents, verbs and so on... This may be a very long task.

Deleting a store

You can delete a store from the UI or with the following command.

php artisan stores:delete
Option Example of value Description
--owner 1 Internal ID of the LRS store

When you delete the store from the UI, it's a soft delete, which means that the store is marked as deleted, but related data is not immediately deleted from the database.

The following command will remove soft deleted data, so you should run it on a regular basis with a CRON job.

php artisan stores:cleanup

Removing data from a store

Removing all the xAPI data

You can remove all the xAPI data of a store from the Settings > Delete Data page, after applying some filters. This will also include xAPI vocabulary and logs.

If the number of statements is too high, the application will reject the demand and display an appropriated message, recommending to use the console with the following command.

php artisan stores:clear
Option Example of value Description
--owner 1 Internal ID of the LRS store

Removing only the statements

You can remove the statements of a store from the Settings > Delete Data page, after applying some filters.

If the number of statements is too high, the application will reject the demand and display an appropriated message, recommending to use the console with the following command.

php artisan statements:clear

Both commands support the following option.

Option Example of value Description
--owner 1 Internal ID of the LRS store
--entity 1 Internal ID of an entity
--client 1 Internal ID of a client
--access 1 Internal ID of an access

Removing other specific xAPI data

You can remove other xAPI data from a store with the following commands.

php artisan agents:clear
php artisan activities:clear
php artisan agent-profiles:clear
php artisan activity-profiles:clear
Option Example of value Description
--owner 1 Internal ID of the LRS store

Maximum number of deletable statements

The maximum number of statements that can be deleted from the UI is 10000 by default. You can change it in your .env file.

MAX_DELETABLE_STATEMENTS=10000