Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

923 add support for categories for software #946

Conversation

fembau
Copy link
Contributor

@fembau fembau commented Jul 20, 2023

add support for categories for software

Addresses #923 :)

This is a first functional prototype. This branch also includes some pre-defined categories for testing.

Some intro

  • categories are organized in a hierarchical structure (tree)
  • naming:
    • a category is a leaf in the category tree
    • a parent category is a tree node with sub-categories
    • a top-level category is a tree node with no parent
    • a list of categories traversing the category tree from the top-level category down to a leaf is the category path of the leaf
    • the visual representation of a category path could be p.ex.
      top-level cat / sub-cat / category
  • software/projects could be related to multiply categories
    • side effect: because categories are the tree leafs, categories could be re-structured without harming the association to software/projects
    • POV topics are related to research fields (see list of pre-defined categories), thus the origin structure would be:
      POV phase / research field / topic
      ➜ design decision: for now the middle level is left out:
      POF phase / topic

Version 1

  • Minimal functionality (!)
  • maintainer:
    • .. is able to manage categories for a software:
      • categories = research fields and POF topics
      • start with really simple UI: add/remove button, list of (all) categories
  • admin:
    • no admin interface for categories yet. Data for pre-defined categories is injected by an extra migration file during deployment
  • user view of a software:
    • add a new headline "Categories" (+icon) in the right lane above "Keywords"
    • ...and a (sorted) list of category paths, p.ex. like this (see example):
      • Research fields | Energy
      • POF IV | Energy System Design
    • show long name on mouse-over an item in a category path

TODOs

Testing

  • add backend test?! how?
  • add frontend test?!

Usability / Features

  • find good representation of category paths
    • p.ex. how should we abbreviate some of these long category names?
    • design
    • interaction (p.ex. show long name on hover)
  • add category: do not show already added categories in the offered list

Code structure

  • the API calling functions have a lot of copy&paste code. Let's create some generic helper functions for API calls

Changes proposed in this pull request:

How to test:

PR Checklist:

  • Increase version numbers in docker-compose.yml
  • Link to a GitHub issue
  • Update documentation
  • Tests

@fembau fembau linked an issue Jul 20, 2023 that may be closed by this pull request
@fembau fembau force-pushed the 923-add-support-for-categories-for-software-and-projects branch from 8ba02cf to 769ed58 Compare July 20, 2023 12:23
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enables Array.entries()

@fembau fembau force-pushed the 923-add-support-for-categories-for-software-and-projects branch from 2d1a55b to e70c755 Compare July 20, 2023 12:32
Copy link
Collaborator

@ewan-escience ewan-escience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are a few things I noticed when looking at the database files:

  • there is no row level security for category, which means that any logged in user can create, edit and delete categories
  • there is no check that the categories cannot form a cycle (e.g. cat1 has parent cat2, cat2 has parent cat1)
  • please add the corresponding sanitise functions to category
  • is_published = TRUE can be shortened to is_published in a where clause
  • some keywords are not capitalised, e.g. references, as

We can furthermore add tests to the backend_tests module to test if all functions and checks work as intended, let me know if you need help with that.

@jmaassen
Copy link
Member

jmaassen commented Jul 25, 2023

Some comments from the UI perspective:

  • The design of the categories is now quite different from the keywords directly below:

Screenshot 2023-07-25 at 08-11-04 Edit software Research Software Directory

I think it would be better to use the same design approach: rounded boxed and an "(x)" for deletion instead of a delete button? And maybe a "type to search" option?

  • When adding a category, the top entry is "click to add more categories" which implies clicking it will allow you to define a new category (which isn't the case).

  • The list of categories becomes quite unwieldy when you have many categories of deeply nested ones. Would an approach similar to Research Domains in projects work?

Screenshot 2023-07-25 at 08-12-59 Edit project Research Software Directory

  • When adding multiple categories with the same root, the full path is always shown in each box:

Screenshot 2023-07-25 at 08-24-31 Software Country innovative Chromium

for research domains in projects we use a slightly different approach:

Screenshot 2023-07-25 at 08-15-25 Project Administrator District Koruna

In this case, LS is the parent of both LS3 and LS6 and grand parent of LS3_14. The full path isn't shown for the last three. Would a similar approach work for categories? This may depend on the rules there are to select one? On difference I see is that for Research Domains, one is also allowed to select a top level or mid level one, not just a leaf one.

categories should be read-only until we have an admin interface
@ctwhome
Copy link
Contributor

ctwhome commented Jul 25, 2023

A small comment on the functionality. When the user is not able to add categories (I believe that is because of privileges) there is still a message saying "add categories", but it is not possible to manually add any. It gives the illusion that new categories can be created, but no.
image
image

Also, maybe is wise to use muy components instead of native HTML select to keep design consistency and functionality as Jason mentioned.

@ctwhome
Copy link
Contributor

ctwhome commented Jul 25, 2023

In terms of design I think is oke, the whole information page has become too full of features that in my opinion needs an aesthetic redesign to keep the form inputs more organized.

@fembau fembau changed the title 923 add support for categories for software and projects 923 add support for categories for software Aug 1, 2023
@fembau fembau force-pushed the 923-add-support-for-categories-for-software-and-projects branch from 8f2b28e to 944f195 Compare August 1, 2023 08:59
@fembau fembau force-pushed the 923-add-support-for-categories-for-software-and-projects branch from 944f195 to ac67358 Compare August 1, 2023 09:12
@ctwhome
Copy link
Contributor

ctwhome commented Sep 4, 2023

After a meeting between @fembau and me, we came up with a way to display categories that will make it easier for users and developers. We designed a single component that can be used in both view mode and admin mode. This will save time and effort, and make the user experience better.

Our design assumes that the organization has a list of categories already. We don't have a design for this list yet, but that's not part of this PR.

image

@fembau
Copy link
Contributor Author

fembau commented Sep 5, 2023

As discussed with @ewan-escience we put the metadata of categories, like color, icon, etc. into the same database table. Most metadata columns would be empty. Other options we talked about: put metadata into extra table (to save space); add a column of type json to store metadata.

@jmaassen jmaassen mentioned this pull request Sep 5, 2023
4 tasks
@fembau fembau force-pushed the 923-add-support-for-categories-for-software-and-projects branch from 69f5d0d to 92b7603 Compare September 7, 2023 09:26
@sonarcloud
Copy link

sonarcloud bot commented Sep 7, 2023

[rsd-database] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Sep 7, 2023

[rsd-frontend] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

57.1% 57.1% Coverage
0.0% 0.0% Duplication

@fembau
Copy link
Contributor Author

fembau commented Sep 15, 2023

closing in favor of #984

@fembau fembau closed this Sep 15, 2023
@fembau fembau deleted the 923-add-support-for-categories-for-software-and-projects branch November 6, 2023 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for categories for software and projects.
6 participants