story/HOP-63#49
Conversation
…dge cases, incorported metadata field in resources abstract model and added it in website and pdf resources
|
Can one of the admins verify this patch? |
jdamerow
left a comment
There was a problem hiding this comment.
I think there is a misunderstanding, the metadata fields should be part of the zip import csv file. Although it might not be a bad idea to also allow uploading a separate csv without files.
jdamerow
left a comment
There was a problem hiding this comment.
also, please resolve merge conflicts
| _PARTIAL_DATE_RE = re.compile(r"^(\d{4})(?:-(\d{1,2})(?:-(\d{1,2}))?)?$") | ||
|
|
||
|
|
||
| def parse_partial_date(value): |
There was a problem hiding this comment.
I don't think you need to do this by hand. The ISO date standard covers incomplete dates like year month or just year I believe, so my guess is Python's standard date library will be able to handle it. And you could probably just store the iso date as a string in the db (maybe with an extra date column to be able to sort by year).
There was a problem hiding this comment.
at this point we don't have any dates stored yet, so this migration isn't necessary
| import io | ||
|
|
||
|
|
||
| def normalize_partial_date(value): |
There was a problem hiding this comment.
this should probably be "validate_date" or something like that, since it doesn't normalize anything. Just checks if the value is a valid date.
Guidelines for Pull Requests
If you haven't yet read our code review guidelines, please do so, You can find them here.
Please confirm the following by adding an x for each item (turn
[ ]into[x]).Please provide a brief description of your ticket
We need to add more metadata fields to Resources
Description
those should be part of the Resource class so they are applicable to all.
There will be more, but we’ll start with:
Date Published - this should probably be an ISO date as it can be anything from year, to month year, to day month year. Or unknown, in which case we’ll just set it to null.
The following three fields will be a controlled list, but the available options would come from the csv import. So I think we want to have another module for each of these and then create objects as rows are imported.
Document Type
Document Author Institution
Institution Type
We’ll have some more metadata fields but I’m waiting to hear back on what exactly those are and how they look like.
We also want to add the metadata to the MCP server but here I think we want to add them as json to make the MCP agnostic to the types of documents stored.
HOP-63
Anything else the reviewer needs to know?
Does this Pull request depend on any other?