innovationOUtside / nb_extension_empinken

Jupyter notebook extension for background colouring selected cells
MIT License
1 stars 0 forks source link

Restructure metadata elements or maybe even tags #2

Open psychemedia opened 4 years ago

psychemedia commented 4 years ago

The extension in its current form uses boolean metadata elements (activity, commentate and student) to identify cells that are coloured using the extension. The toolbar buttons are used to toggle the state from true to false (though it may be cleaner to just have the true state and delete the attribute when we disable it.

The metadata elements are all at the top metadata level, but it might be cleaner to put them into metadata.empinken, thus encapsulating attributes in the empinken namespace.

An alternative approach would be to specify tags within the metadata; this would allow editing the cells via the tags editor as well as the buttons.

My current thinking is that at least the the blue button should toggle an activity tag, the yellow a reflection tag, and the pink a feedback tag. These would mark cells as being part of activity (though the feedback might be applied by a tutor outside of an activity).

The rationale for trying to group cells in an activity is to try to find a way to map between OU-XML and a tagged cell format. In the OU-XML state, we would have an activity block containing various activity related elements.

The activity tag would help identify cells as being associated with an activity, which could be respected by an OU-XML2nb conversion, but would not in and of themselves support the reverse nb2OU-XML conversion. For that, we need to find some ways to group cells; we could do that by setting the same id-tag (activity-NNNN) or metadata element (metadata.activity.activityId) for cells associated with a particular activity. Using the rubber band or other means to select multiple cells and then click a button to assign these cells to the same (unique) activity group would be one way of achieving this. (This would most easily be done within metadata rather than the tagspace).

The nb_extension_tagstyler extension demonstrates how we can apply class attributes based on tags, using attributes already associated with CSS styles to colour cells based on cell tag. It would perhaps make sense to use tags in the empinken extension to add class attributes to trigger style, and extension specific metadata to group items within logical activity group.

The activity metadata might include things like:

psychemedia commented 3 years ago

The commit https://github.com/innovationOUtside/nb_extension_empinken/commit/9280b2248e86b7dfe63fcef0924987f0f52833c6 explores using a tag rather than a straightforward metadata tag to identify empinkened cells; tags currently have the form style_TYPE (e.g. style_activity).

The commit seeks to be able to handle legacy empinken metadata and automatically update it/replace it with the new tag convention.