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

Relationship between categories in fields and groups #71

Open
atiro opened this issue Jul 5, 2021 · 5 comments
Open

Relationship between categories in fields and groups #71

atiro opened this issue Jul 5, 2021 · 5 comments

Comments

@atiro
Copy link
Contributor

atiro commented Jul 5, 2021

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?

@pkiraly
Copy link
Owner

pkiraly commented Jul 5, 2021

@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
Copy link
Contributor Author

atiro commented Jul 5, 2021

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 ?

@mielvds
Copy link
Contributor

mielvds commented Jul 6, 2021

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

@atiro
Copy link
Contributor Author

atiro commented Jul 6, 2021

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
Copy link
Contributor Author

atiro commented Jul 6, 2021

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.

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

No branches or pull requests

3 participants