Those flags are set by darktable, and hold some information about the image. If you hover over the flags, you’ll get some more information (first appears to be the star rating, there’s one that indicates a raw image, and what was used to load the image). The dots mean there’s no relevant value, or the value is “unknown”.
It’s clear those “flags” aren’t binary flags with just an “on” and an “off” state

On the “zo” and “za” question: excellent idea. I currently live in Belgium, which has three official languages, including Dutch, which I don’t speak: probably “zondag” and “zaterdag”. The next question, then, is how do I request darktable (and/or macOS) to use French or English as my default language rather than Dutch?
Indeed, “zondag” en “zaterdag”.
For the language: darktable’s “preferences” ==> “general” allows you to set the interface language. For macOS, I suppose there’s also a way to set such preferences, but that’s better asked from mac users…
Concerning the metadata: I understand you have not yet loaded all the images in darktable.
- For simple keywords with no ambiguity as to where in the future tree they should be: you can manipulate the tags after the images are loaded in darktable: create the tree you want, select the images with the current flat tag, apply the “tree tag” and remove the flat tag. No need to mess with scripts and the database directly. I’m not sure a script helps a lot here, as it cannot decide where in the tree the flat tag should go…
- If you have “ambigous” tags (like the “Milan” example), same basic idea, but you’ll have to manually select the images depending on where they have to go. Not something a script can do.
- If you have good backups, you can try to manipulate the xmp files, but then you’ll have to know which xml tag to use…
If lightroom can handle hierarchical keywords, you may be better off creating the trees there, as you are more familiar with that program.
Oh, and there’s an extra wrinkle with the tree for living organisms: there are always parts that are in flux (I’ve seen that with orchids, and with mushrooms). That means names can changes, and organisms can even be moved between families. Not too bad in itself (it’s fairly rare that species are split or combined with others, though that does happen), but it can complicate searching for the organism (esp. in paper documentation…). And the tree can get rather deep. So perhaps you don’t need to use all levels for tagging (which, for me, is meant to find images, not to give a full taxonomy)