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

Refactor CSV / XSLX exports to have 1 export format (and code) instead of 3 #6424

Open
Tracked by #6429
stephanegigandet opened this issue Feb 17, 2022 · 3 comments
Open
Tracked by #6429
Labels
CSV exports export ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it.

Comments

@stephanegigandet
Copy link
Contributor

stephanegigandet commented Feb 17, 2022

Is your feature request related to a problem? Please describe.

We currently have 3 different CSV exports, each with different fields, and with different code:

  1. the full database CSV export, generated nightly with scripts/export_database.pl
  2. the on demand CSV / XLSX export, available through the search form (code in lib/ProductOpener/Display.pm search_and_export_products()
  3. the CSV export used internally to export and import data from the producers platform to the public platform (code in lib/ProductOpener/Export.pm, called from the producers platform, and also availble from export_csv.pl)

Describe the solution you'd like

Gradually converge to 1 common format and 1 single code base (Export.pm).

Desirable features:

  • let producers download an export of their data on the producers platform, make some changes to it, and reimport it
  • clear separation between columns that contain primary data (e.g. ingredients text, nutrition values, Nutri-Score computed by the producer) vs derived data (canonical ingredients from ingredients_tags, Nutri-Score computed by OFF, Eco-Score details). e.g. maybe prefix the column name with off: off:ingredients_tags

Additional context

Related issues:

@stephanegigandet stephanegigandet added ✨ Feature Features or enhancements to Open Food Facts server export CSV exports labels Feb 17, 2022
@stephanegigandet
Copy link
Contributor Author

My plan is to first start to make the on demand search export on the website use the code from Export.pm. The search export is requested manually, so it's probably not a big issue if we change which columns are included and their names.

Once we have something that we are happy with, we can look into replacing the full database CSV export, probably in a new location, so that we don't break things.

@alexgarel
Copy link
Member

Convergence of exports is a real big plus.

When refactoring, I think it would be great to separate processing into map like structure, from rendering to xls.

My only small concern is that for communication between producer and public platform, I would go away from the csv/xls format… because it seems to me that in introduces some tweaks that are not useful.

stephanegigandet added a commit that referenced this issue Mar 4, 2022
* new misc facet values for Eco-Score missing packaging warning

* more ecoscore missing data facets

* update tests

* refactor on demand csv/xlsx export on website - wip

* export off derived fields

* export Eco-Score data

* prefix off computed fields by off:, add _tags fields

* fix filehandle

* add tests for CSV exports #6424

* Update labeler.yml

* start mongodb

* update tests

* remove condition on hardcoded domain name

* feat: add missing_key_data flag to ecoscore

* export more ecoscore fields

* fix tests

* Update lib/ProductOpener/Export.pm

Co-authored-by: Alex Garel <alex@garel.org>

* Update t/export.t

Co-authored-by: Alex Garel <alex@garel.org>

* suggestions from code review

* create Test.pm module

* create Test.pm module

Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
Co-authored-by: Alex Garel <alex@garel.org>
@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity.

@github-actions github-actions bot added the ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it. label Jun 28, 2022
@teolemon teolemon moved this to To discuss and validate in 🍊 Open Food Facts Server issues Apr 23, 2024
@teolemon teolemon removed the ✨ Feature Features or enhancements to Open Food Facts server label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSV exports export ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it.
Projects
Status: To discuss and validate
Development

No branches or pull requests

3 participants