VForWaTer / metacatalog

Modular metadata management platform for environmental data.
https://vforwater.github.io/metacatalog
GNU General Public License v3.0
3 stars 1 forks source link

Add UUID to persons #106

Closed mmaelicke closed 3 years ago

mmaelicke commented 3 years ago

models.Person should also integrage the uuid logic

mmaelicke commented 3 years ago

@AlexDo1 if you want to get a bit more into Databases and data models, this one would be a perfect issue to take over. It's not very complicated, short and the needed implementation is already there for other data models (entry.py, keyword.py). Nothing that has to happen immediately, but if you like so, just assign yourself to this issue and kick me out.

AlexDo1 commented 3 years ago

I will try to do that. I´m not sure if I can assign the issue to myself, do I have the required permission to do that?

Do I understand correctly that the UUID is created and assigned in the Entry class? The Keyword class itself is not creating a UUID, it "gets" this info when using the Entry class? And the Person class should "behave" like the Keyword class (create the UUID column and so on)?

mmaelicke commented 3 years ago

Yeah, of course, I should have been more clear on that. The UUID in the Keyword class is external. We did not create those, that are the 'official' GCMD uuids. For Entry and EntryGroup I implemented a logic to create new uuids, if they are not set externally. These other datamodels are 'hosted' within metacatalog, and thus create new uuids. So ,yeah, the implementation is basically this line: https://github.com/VForWaTer/metacatalog/blob/b264f373cd132c76323dc6e2fff55e96035d3299/metacatalog/models/entry.py#L162

But we also need to update the API, like here: https://github.com/VForWaTer/metacatalog/blob/b264f373cd132c76323dc6e2fff55e96035d3299/metacatalog/api/find.py#L441 or here: https://github.com/VForWaTer/metacatalog/blob/b264f373cd132c76323dc6e2fff55e96035d3299/metacatalog/api/add.py#L282

There is also a special API endpoint for cross-model UUID searches: https://github.com/VForWaTer/metacatalog/blob/b264f373cd132c76323dc6e2fff55e96035d3299/metacatalog/api/catalog.py#L12

That would be implementation side. On the test side, there is this function: https://github.com/VForWaTer/metacatalog/blob/b264f373cd132c76323dc6e2fff55e96035d3299/metacatalog/test/test_api_add_find.py#L215

that could add one or call to find_uuid to find a person by uuid. (We will have to update all the test cases anyway)

You go for implementation and I go for tests?

AlexDo1 commented 3 years ago

Should I always add something like this (with the current version of metacatalog) when I change something in the code?

https://github.com/VForWaTer/metacatalog/blob/b264f373cd132c76323dc6e2fff55e96035d3299/metacatalog/api/find.py#L82-L85

mmaelicke commented 3 years ago

Would be great. The current version is always in the VERSION file. You then increment the patch version by one + 0.0.1