artefactual-sdps / preprocessing-sfa

preprocessing-sfa is an Enduro preprocessing workflow for SFA SIPs
1 stars 0 forks source link

Write premis.xml file only if validation succeeds #55

Closed djjuhasz closed 2 months ago

djjuhasz commented 2 months ago

Fixes #32.

Don't create the premis.xml file until after all validation activities have completed successfully. If validation is unsuccessful the premis.xml file is discarded with the rest of the working SIP, so any writes are lost anyway.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 87.05882% with 11 lines in your changes missing coverage. Please review.

Project coverage is 48.91%. Comparing base (1116d63) to head (1032bfd). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/workflow/preprocessing.go 85.33% 5 Missing and 6 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #55 +/- ## ========================================== + Coverage 48.20% 48.91% +0.71% ========================================== Files 26 26 Lines 1500 1468 -32 ========================================== - Hits 723 718 -5 + Misses 714 690 -24 + Partials 63 60 -3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

djjuhasz commented 2 months ago

This commit changes the format of the "Validate file format" PREMIS event slightly:

<premis:event>
    <premis:eventIdentifier>
      <premis:eventIdentifierType>UUID</premis:eventIdentifierType>
      <premis:eventIdentifierValue>ac70a209-7c4f-4c36-9774-1be1ce021a10</premis:eventIdentifierValue>
    </premis:eventIdentifier>
    <premis:eventType>validation</premis:eventType>
    <premis:eventDateTime>2024-09-06T23:19:21Z</premis:eventDateTime>
    <premis:eventDetailInformation>
      <premis:eventDetail>name=&quot;Validate file format&quot;</premis:eventDetail>
    </premis:eventDetailInformation>
    <premis:eventOutcomeInformation>
      <premis:eventOutcome>valid</premis:eventOutcome>
      <premis:eventOutcomeDetail>
        <premis:eventOutcomeDetailNote>Format allowed</premis:eventOutcomeDetailNote>
      </premis:eventOutcomeDetail>
    </premis:eventOutcomeInformation>
    <premis:linkingAgentIdentifier>
      <premis:linkingAgentIdentifierType valueURI="http://id.loc.gov/vocabulary/identifiers/local">url</premis:linkingAgentIdentifierType>
      <premis:linkingAgentIdentifierValue>https://github.com/artefactual-sdps/preprocessing-sfa</premis:linkingAgentIdentifierValue>
    </premis:linkingAgentIdentifier>
  </premis:event>

The <premis:eventDetail> value is now 'name="Validate file format"' where it used to be an empty string.

djjuhasz commented 2 months ago

Here's what the Enduro dashboard reports for a SIP missing the content directory: image