RalphTro / epcis-event-hash-generator

ALGORITHM and SOFTWARE PROTOTYPE to uniquely identify/validate the integrity of any EPCIS event through a common, syntax-agnostic approach based on hashing. Takes an EPCIS Document (formatted in either XML or JSON-LD) and returns the corresponding hash value(s).
MIT License
8 stars 4 forks source link

collect namespaces from json-ld context and removed readPoint and bizLocation correction logic #23

Closed dakbhavesh closed 3 years ago

dakbhavesh commented 3 years ago

Hi @RalphTro and @Echsecutor,

Attempting to integrate event hash generator in EPCIS 2.0 prototype. Was testing it through JSON-LD based events and found a couple of changes we may want to make in event parsing.

  1. Remove readPoint and bizLocation correction logic as both XML and JSON will have same structures
  2. Structure of @context is changed hence added logic to parse it and collect namespaces from it.

I am not seasoned python developer but can read and write basic logic ;)

Please review changes and see if they makes sense.

dakbhavesh commented 3 years ago

Update: Fixed test data and made context parsing logic more flexible as json-ld context can be be string, object or array.

RalphTro commented 3 years ago

THANKS A LOT for this, @dakbhavesh!