OpenRefine / OpenRefine/OpenRefine
Records mode include keys that do not match the active facet
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12k
- Forks
- 2.2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 27
Description
While aggregating data (by faceting, sorting along a key column, and blanking it down), records mode shows more keys that it should, by including keys belonging to non-faceted rows. This seems to be related to the original order of the rows on the faceted column.
To Reproduce
Steps to reproduce the behavior:
- Import the data from this URL: https://www.data.gouv.fr/fr/datasets/r/fda33536-a0e0-4cad-b1bf-b88d2a7586e6
- Facet by "rentree_scolaire" (schoolyear) and only include "2021-2022"
- Sort by "code_du_departement" (permanently)
- Blank down the "code_du_departement" column and move it in first position
- Switch to records mode
Current Results
Whereas in rows mode, only 101 rows (out of 30,395 matching rows) contain a key in the "code_du_departement" column and the rest are blank, records mode shows 510 records, with multiple records (4-7) with the same key but different (and seemingly random) "rentree_scolaire" values.
Expected Behavior
I expect to see 101 records, containing all schools for the given departement and faceted schoolyear.
Possible explanation
Sorting the data not only by "code_du_departement", but by "rentree_scolaire" and THEN "code_du_departement" fixes the issue. So it seems that the "Blank down" feature only blanks cells matching the facet, but that the records mode uses the entire table (and not just matching rows) to generate records, resulting in records with keys that do not match the facet (but only displaying matching rows within each record, except for the one used as key). I hope this is clear.
This seems very counterintuitive and prone to errors, since using GREL expressions on matching records could result in aggregating non-faceted data. Is this behavior by design?
Thank you for your help.
Versions
- Operating System: MacOS 12.4, Ubuntu 22.04
- Browser Version: Firefox 107.0.1
- OpenRefine: OpenRefine 3.7.4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in OpenRefine 3.7.4 using the linked dataset, the rentree_scolaire facet, permanent sorting, blank-down, and records mode. Compare records mode with rows mode and verify that only the 101 facet-matching department keys produce records; the payload names no files or tests to inspect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100