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

Add facets to each page #53

Merged
merged 4 commits into from
Mar 28, 2023
Merged

Add facets to each page #53

merged 4 commits into from
Mar 28, 2023

Conversation

anitacaron
Copy link
Collaborator

@anitacaron anitacaron commented Mar 24, 2023

Related to #51

At the moment it's returning mapping_justification and predicate_id that are part of the mapping model.

The mapping_set_title is part of the mapping set and need extra work to get them.

Facets object shows the list of values for each facet and the total number in total items:

"facets": {
    "mapping_justification": {
      "https://w3id.org/semapv/LexicalMatching": 185,
      "https://w3id.org/semapv/LogicalReasoning": 115,
      "https://w3id.org/semapv/ManualMappingCuration": 1092,
      "https://w3id.org/semapv/UnspecifiedMatching": 6740
    },
    "predicate": {
      "http://www.w3.org/2004/02/skos/core#closeMatch": 347,
      "http://www.w3.org/2004/02/skos/core#exactMatch": 665,
      "http://www.w3.org/2004/02/skos/core#narrowMatch": 155,
      "http://www.w3.org/2002/07/owl#equivalentClass": 6740,
      "http://www.w3.org/2004/02/skos/core#relatedMatch": 105,
      "http://www.w3.org/2004/02/skos/core#broadMatch": 120
    }
  }

@anitacaron anitacaron self-assigned this Mar 25, 2023
@anitacaron
Copy link
Collaborator Author

@serjoshua, is this what you expect?

src/models.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@pkalita-lbl pkalita-lbl left a comment

Choose a reason for hiding this comment

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

This looks generally fine to me. Although if you find yourself doing a lot iterator grouping, counting, filtering, etc you might want to check out https://toolz.readthedocs.io/en/latest/index.html. For example your _create_facets could use https://toolz.readthedocs.io/en/latest/api.html#toolz.recipes.countby

@anitacaron
Copy link
Collaborator Author

Thank you, @pkalita-lbl. I'll try to use this countby method.

@serjoshua
Copy link
Collaborator

Looks good to me. Thanks!

@anitacaron anitacaron merged commit 25f8695 into dev Mar 28, 2023
@anitacaron anitacaron deleted the anitacaron/issue51 branch March 28, 2023 16:57
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.

4 participants