Closed tloubrieu-jpl closed 3 years ago
@eddiesarevalo validated that a xsl spreadsheet can be uploaded and parsed in the UI.
@eddiesarevalo will add in the ticket an example of the json created in the UI from the xslx document.
@tloubrieu-jpl @collinss-jpl Given this example excel sheet that has 2 sheets and 2 rows each: https://app.zenhub.com/files/236099103/fa871565-a5f3-40aa-92eb-8e0e01f8974e/download The UI parses out the contents to keep this JSON in memory. The keys can be changed to whatever the server is expecting. Also this is just an example. I don't know if people will submit multiple sheets but it is supported. The keys correspond to the title values in the excel sheet.
[{
"status": "Reserved",
"title": "Laboratory Shocked Feldspars Bundle",
"publication_date": 43901,
"product_type_specific": "PDS4 Collection",
"author_last_name": "Johnson",
"author_first_name": "J. R.",
"related_resource": "urn:nasa:pds:lab_shocked_feldspars"
}, {
"status": "Reserved",
"title": "Laboratory Shocked Feldspars Bundle2",
"publication_date": 43901,
"product_type_specific": "PDS4 Collection",
"author_last_name": "Johnson",
"author_first_name": "J. R.",
"related_resource": "urn:nasa:pds:lab_shocked_feldspars"
}, {
"status": "Reserved",
"title": "Laboratory Shocked Feldspars Bundle",
"publication_date": 43901,
"product_type_specific": "PDS4 Collection",
"author_last_name": "Johnson",
"author_first_name": "J. R.",
"related_resource": "urn:nasa:pds:lab_shocked_feldspars"
}, {
"status": "Reserved",
"title": "Laboratory Shocked Feldspars Bundle2",
"publication_date": 43901,
"product_type_specific": "PDS4 Collection",
"author_last_name": "Johnson",
"author_first_name": "J. R.",
"related_resource": "urn:nasa:pds:lab_shocked_feldspars"
}]
@eddiesarevalo This looks great, thanks for posting it. Had one small observation though, looks like publication_date
is getting parsed in a strange way? Not sure how 43901 maps to the "2020-03-11" or "3/11/2020" values from excel sheet you linked. Is there a decoding step that the API would need to perform to get the date back?
@collinss-jpl It might be converting it to hours since 1970. I wasn't sure what format you are expecting so I just left it alone but I can convert that number to any date string you think is good.
Ah yes @eddiesarevalo @collinss-jpl for pubication date we had this issue with the command line implementation, sometimes the xls spreadsheet use a specific type for date time and then it converts it to something, but sometimes, the column is just a string. The easiest way would be to ignore the xls typing and force to always send a string from the UI. The string is in format 'YYYY-MM-DD' which is the date part of the ISO8601 format.
@eddiesarevalo Just a heads up, I've started writing the schema for this JSON format into the openapi spec and in order to support multiple labels I needed to include a top-level "labels" key assigned to the list of dictionaries like so:
{
"labels": [
{
"status": "Reserved",
"title": "Laboratory Shocked Feldspars Bundle",
"publication_date": "2020-03-11",
"product_type_specific": "PDS4 Collection",
"author_last_name": "Johnson",
"author_first_name": "J. R.",
"related_resource": "urn:nasa:pds:lab_shocked_feldspars"
},
...
]
}
Does not include the API connection
Acceptance criteria: Given a xls spreadsheet of DOIs to be reserved (see format https://pds-engineering.jpl.nasa.gov/sites/default/files/DOI_reserve_template.xlsx) When I reserve using the 'reserve' form Then: the DOIs are provided with a reserved status And: I can re-use the DOI metadata to draft the DOI before publishing it (release).