Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
There are a couple of changes....
The changes are largely split into three commits (apologies):
Update Tales
,Add Tests
andFix Tests
.Update Tales
has the logic for updating Tales that were already published and handles appending DataCite:IsDerivedFrom if the Tale was copied from a published Tale. A few updates to it were made inAdd Tests
.Add Tests
was the first pass at expanding the unit tests. Inside you'll see that the TALE and MANIFEST variables are in each file. TheFix Tests
commit largely moves these to__init__.py
.Misc
There are a few miscellaneous changes that range from marking some methods as
static
, rewording some of the exceptions, improving the docstrings and type annotating types from the dataone library for easier reading & IDE support.The styling changes in 8c3bbf9 are fairly trivial. The riskiest one is probably renaming the
zip
variable (shadows thezip
package) tozip_file
.Updating
A Tale is 'updated' when it's published a second time. If a Tale is published to DataONE, and then a copy is made and published-
datacite:IsDerivedFrom
pointing to the first Tale's doi is added to the resource map. The relevant code for this is hereWhen a Tale is published to DataONE two times, the previous system metadata is retrieved. A new system metadata document is made, but replaces values such as md5 and size from the copied one. This system metadata document is for the object that will be obsoleting the one in DataONE.
[_obsolete_object]()
just calls the DataONE python library's update method which takes care of the rest of the heavy lifting.Tests
I restructured the unit tests to match the src directory. I took the json from the
test_publish.py
and moved it into the__init__.py
file so that they can be used in other tests. You can also see that I have added structures for published tales, etc. Then I pulled the dataone logic oftest_publish.py
and moved it over intotest_dataone_publish.py
. I addedtest_dataone_metadata.py
to test some of the methods in themetadata.py
file but left out tests for the EML.Testing
_
Example:
I published a Tale here, copied it and republished here. In the new resource map found here, you can see that the datacite:IsDerivedFrom points to the DOI of the first package.
Find the resource map pid at the top of the file table on the dataset landing page, shown below.