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

Update by merge request #9

Open
flosse opened this issue Jul 17, 2023 · 11 comments · Fixed by #10
Open

Update by merge request #9

flosse opened this issue Jul 17, 2023 · 11 comments · Fixed by #10
Assignees
Labels
bug Something isn't working enhancement New feature or request
Projects

Comments

@flosse
Copy link
Contributor

flosse commented Jul 17, 2023

Original feature request by @wellemut:

Quite helpful would be a "merge" command: That would mean, that all fields which are empty in the update-file, stay like it is, and only given fields will be updated in the entry profile. Additional there are the following rules:

  • tags are never replaced but always attached (additionally added)
  • Also new descriptions will allways be added at the beginning, but dont replace existing description.

All other fields will overwrite the old entry, if given in the update file.

@flosse
Copy link
Contributor Author

flosse commented Jul 19, 2023

We could use a primitive syntax to modify fields like this:

  • ++ append
  • -- remove
  • == replace

All other fields, which should not be changed, (except the ID) have to be empty.

@wellemut wellemut added this to Beauftragt in HLNUG via automation Dec 7, 2023
@wellemut wellemut added the enhancement New feature or request label Dec 7, 2023
@wellemut wellemut self-assigned this Dec 7, 2023
@wellemut
Copy link
Member

wellemut commented Dec 8, 2023

grafik

Folgende idee: also commando nutzt du einfach die --patch option und bei den einzelnen feldern kannst du mit ++, -- oder == die sachen modifizieren

@wellemut
Copy link
Member

wellemut commented Dec 8, 2023

Hi @flosse
Also grundsätzlich funktioniert der update prozess.
Wenn ich die Download csv nehme und sie für das Update nutzen will, beschwert er sich, dass 2 spalten fehlen

  • created (das fehlt heist im download created_at)

  • ratings (heißt im download avg_rating)

  • Die anpassung der Spaltenüberschriften für das update ist eine schnelle sache, sollten wir aber vielleicht im script korrigieren.

  • Der --patch Befehl funktioniert gar nicht.
    Bei dem Befehl: https://api.ofdb.io/v0/ update --patch --report-file update-report.json "update.csv" kommt dieser Fehler:
    grafik

Wenn ich es wegmache, kann ich updaten, dann wird aber alles überschrieben.
grafik
Du siehst an den ++ dass ich eigentlich nur gewisse Felder überschreiben wollte.

@wellemut
Copy link
Member

wellemut commented Dec 8, 2023

Das script erstellt seit dem 2. import keine report.json, aber vielleicht auch nur, weil es keine fehler gibt.

@wellemut
Copy link
Member

wellemut commented Dec 8, 2023

Die Versionsnummer ist wirklich eine perfekte Kontrolle, dass man nur das katualisieren kann, was man kurz vorher runer geladen hat.
Leider werden aber sämtliche Custom-links einfach weggelöscht. So ist es natürlich echt gefährlich und jemand kann viel arbeit kamputt machen, indem er einfach was runterläd und direkt wieder hoch.

Wenn man gurndsätzlich einstellen könnte, dass wirklich nur die attribute überschrieben werden, wo auch ein wert hochgeladen wrid, könnte man das vielleicht umgehen.

@wellemut
Copy link
Member

wellemut commented Dec 8, 2023

Shit BUG! @flosse
Nachdem ich nun 500 Einträge upgedatet habe, fällt mir auf, dass die danach von der Karte verschwinden und tauchen auch nicht in der Seitenleiste auf!

Such mal nach Klingspor, da sollten eigentlich über 23 Dupletten angezeigt werden: https://www.kartevonmorgen.org/m/main?c=49.7600%2C9.9316&z=6.00&search=Klingspor+

Das Backend findet sogar noch alles: https://openfairdb.org/search?q=Klingspor+
(auch im neuen https://ofdb.io/)

Aber auf der _Karte ist nichts mehr! Warum?

@wellemut
Copy link
Member

wellemut commented Dec 8, 2023

Ahh, ich habs. Das problem ist das Feld categories mit den IDs 77b3c33a92554bcf8e8c2c86cedd6f6f und 2cd00bebec0c48ba9db761da48678134
stattdessen muss ich offenbar die Tags commercial oder non-profit nutzen

HLNUG automation moved this from Beauftragt to Done Jan 25, 2024
@wellemut wellemut reopened this Feb 1, 2024
HLNUG automation moved this from Done to In progress Feb 1, 2024
@wellemut
Copy link
Member

wellemut commented Feb 1, 2024

@wellemut
Copy link
Member

wellemut commented Feb 8, 2024

@flosse schreibt:

FYI: Ich habe heute nochmal nen mini update für's CLI gemacht, weil bei mir mit 500 CSV Einträgen es ein Netzwerkfehler gab. Jetzt werden immer nur 50 Einträge auf einmal abgerufen.
Naja, auf jeden Fall war deine Patch CSV schon fast richtig. Nur die Titel der Einträge waren ohne Operation deklariert. Also wenn du den Titel verändern willst, einfach ein '=' davor setzen, also "=Neuer Titel" oder das Feld ganz leer lassen, dann heißt es "mach nix"

Leider immernoch die Fehlermeldung:

>ofdb --api-url https://api.ofdb.io/v0/ update --patch --report-file update-refill-report.json update-patch.csv
 INFO  ofdb > Update entries from file (CSV): update-patch.csv
 INFO  ofdb_cli::csv > Read entries form CSV
Error: Patch updates are currently not supported for JSON files

ich versuche das gerade über folgende csv:

und in der Hilfe steht auch json und csv als mögliche formate...

>ofdb update --patch --help
Update entries

Usage: ofdb --api-url <API> update [OPTIONS] <FILE>

Arguments:
  <FILE>  JSON or CSV file with entries

Options:
      --report-file <REPORT_FILE>  File with the update report [default: update-report.json]
      --patch                      use (non-standard) diff syntax to update fields
  -h, --help                       Print help

Ich habe heute den ofdb-cli aktualisiert geupdatet. das hat nicht geholfen.

@wellemut
Copy link
Member

Auch nach dem letzten Update der Quckfixes 1971fd7
kommen folgende Fehlermeldungen:

n= current Version number on kvm

Wenn die Version-Numer im csv = n+1 kommt:

>ofdb --api-url https://api.ofdb.io/v0/ update --patch --report-file update-refill-report.json update-patch.csv
 INFO  ofdb > Update entries from file (CSV): update-patch.csv
 INFO  ofdb_cli::csv > Read entries form CSV
 INFO  ofdb_cli::csv > Read current state of all 4 entries
 WARN  ofdb          > Could not update 'Brücker Mühle': The version of the object is invalid
 WARN  ofdb          > Could not update 'Hof Fleckenbühl': The version of the object is invalid
 WARN  ofdb          > Could not update 'Retro Supply Gießen': The version of the object is invalid
 WARN  ofdb          > Could not update 'ida - Ideen Die Anstecken': The version of the object is invalid

Mit Versionnumber = n kommt

ofdb --api-url https://api.ofdb.io/v0/ update --patch --report-file update-refill-report.json update-patch.csv
 INFO  ofdb > Update entries from file (CSV): update-patch.csv
 INFO  ofdb_cli::csv > Read entries form CSV
 INFO  ofdb_cli::csv > Read current state of all 4 entries
 WARN  ofdb          > 4 csv records contain errors

Und im Jason-report steht dann: error | "Invalid patch request: Invalid entry version"

grafik

Gibt es da vielleicht ein Widerspruch im Script?

Ich denke richtig wäre, dass man die Version number manuell hoch setzt in der csv: n+1

Aktuelles testfile
update-patch.csv

@wellemut wellemut added the bug Something isn't working label Feb 10, 2024
@wellemut
Copy link
Member

wellemut commented Jun 6, 2024

Markus will correct it, that the script will upcount version number by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: 🏗 In progress
HLNUG
In progress
Development

Successfully merging a pull request may close this issue.

2 participants