pkiraly/metadata-qa-api

Relationship between categories in fields and groups

Opened this issue · 5 comments

atiro commented

I was looking to implement the support for the yaml config loading up fields groups but I've got a bit confused between categories in field groups and categories in fields. I don't think they have any connection, if I'm reading the code right ?

That works for me in one way as I would like to be able to say "if any field in this group exists, the category completeness is 1" so I can handle that entirely with a category in a field group, but ideally I would have also liked to be able to say something like "treat just these 3 fields as a group" within a set of 10 fields which would need to be a combination of both, I don't think that's possible though?

@atiro Maybe I am not clearly understand your request, but I think your requirement can be expressed. Let's see this schema:

fields:
  - name: title
  - name: description
  - name: image
    categories: [optional]
  - name: link
  - name: license
groups:
  - fields: [title, description]
    categories: [mandatory]
  - fields: [link, license]
    categories: [optional]

There are in total 2 categories. One (optional) is bound to a field and a field group, the other (mandatory) is bound to a field group. I guess that is what you need.

  • "if any field in this group exists, the category completeness is 1" -- if either title or description exists mandatory will be 1:
title description score of mandatory category
0 0 0
1 0 1
1 1 1
0 1 1
  • if a group is not the only part of a category, then the situation is more complex:
image link license score of optional category
0 0 0 0
1 0 0 0.5
1 1 0 1
1 1 1 1
0 1 0 0.5
0 0 1 0.5
0 1 1 0.5
atiro commented

Hi @pkiraly I think I follow that, but now I wonder if have got the whole use of categories wrong! I have been using it to group fields together with conceptual names, e.g.

    - name: artistMakerPerson
      categories:
          - PRODUCTION
    - name: artistMakerOrganisation
      categories:
          - PRODUCTION
    - name: artistMakerPeople
      categories:
          - PRODUCTION
    - name: placesOfOrigin
      categories:
          - PRODUCTION

which works with categories scoring at the field level, but do categories have to be one of the enum types such as OPTIONAL, MANDATORY ? (which then works as I would like and as you illustrate in the second table) or can they be configured by the schema ?

Hi @atiro , they can be any string as of #59, but there is a basic enum list.

atiro commented

I think @mielvds but happy to be proved wrong, that that's only for categories at the field level (as they are now handled as Strings rather than Category as per #59). But FieldGroup is still using the Category class so restricted to the enum.

Will experiment a bit to see if that can be changed to a String as well to handle any category name, although this may be against @pkiraly plans!

atiro commented

OK have added PR #73 which I think enables this, but it's very much hacked in! I'm not sure what happens if you set the same category name at both the field level or the fieldgroup level, I suspect it's going to clash.