Git Product home page Git Product logo

Comments (3)

jrwdunham avatar jrwdunham commented on July 17, 2024

@ross-spencer you have to supply the XML attributes of the root <premis:event> element manually, made easier by using premisrw.PREMIS_META:

>>> premisrw.PREMIS_META
{'xsi:schema_location': 'info:lc/xmlns/premis-v2 http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd', 
 'version': '2.2'}

Then it should work:

>>> def generate_event_with_meta():
...     # Add some new EVENTS to our METS
...     return ('event',
...             premisrw.PREMIS_META,
...             ('event_identifier',
...                 ('event_identifier_type', "UUID"),
...                 ('event_identifier_value', uuid.uuid4())),
...             ('event_type', "AM CAMP DEMO"),
...             ('event_date_time', datetime.now().isoformat()),
...             ('event_detail', "Adding new PREMIS EVENTS"),
...             ('event_outcome_information',
...                 ('event_outcome', "SUCCESS"),
...                 ('event_outcome_detail',
...                     ('event_outcome_detail_note',
...                         "dag iedereen!"))),
...             ('linking_agent_identifier',
...                 ('linking_agent_identifier_type', "python script"),
...                 ('linking_agent_identifier_value', "1.0")))
>>> print(lxml.etree.tostring(premisrw.data_to_premis(generate_event_with_meta()), pretty_print=True).decode('utf8'))
<premis:event xmlns:premis="info:lc/xmlns/premis-v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:lc/xmlns/premis-v2 http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd" version="2.2">
  <premis:eventIdentifier>
    <premis:eventIdentifierType>UUID</premis:eventIdentifierType>
    <premis:eventIdentifierValue>1665f868-dff5-4e66-8a32-f38ad7582309</premis:eventIdentifierValue>
  </premis:eventIdentifier>
  <premis:eventType>AM CAMP DEMO</premis:eventType>
  <premis:eventDateTime>2018-04-09T11:53:15.846384</premis:eventDateTime>
  <premis:eventDetail>Adding new PREMIS EVENTS</premis:eventDetail>
  <premis:eventOutcomeInformation>
    <premis:eventOutcome>SUCCESS</premis:eventOutcome>
    <premis:eventOutcomeDetail>
      <premis:eventOutcomeDetailNote>dag iedereen!</premis:eventOutcomeDetailNote>
    </premis:eventOutcomeDetail>
  </premis:eventOutcomeInformation>
  <premis:linkingAgentIdentifier>
    <premis:linkingAgentIdentifierType>python script</premis:linkingAgentIdentifierType>
    <premis:linkingAgentIdentifierValue>1.0</premis:linkingAgentIdentifierValue>
  </premis:linkingAgentIdentifier>
</premis:event>

from mets-reader-writer.

jrwdunham avatar jrwdunham commented on July 17, 2024

@ross-spencer can we close this or is it still an issue?

from mets-reader-writer.

ross-spencer avatar ross-spencer commented on July 17, 2024

@jrwdunham I apologise. I didn't see your response above. I am happy that this isn't an issue based on that. I will get back to my work with metsrw closer to June before the camp in Baltimore. We can reopen this if need be but it sounds unlikely.

from mets-reader-writer.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.