ontology-development-kit icon indicating copy to clipboard operation
ontology-development-kit copied to clipboard

Add a simple system for table diffing to ODK

Open matentzn opened this issue 1 year ago • 0 comments

Daff is an amazing framework for diffing tables: https://github.com/paulfitz/daff

pip install daff
daff --input-format tsv m1.sssom.tsv m2.ols.sssom.tsv > diff.tsv
daff render  --input-format tsv diff.tsv > diff.html   

Gives us a nicely rendered diff of the table, e.g

image

We can then use pandoc to generate GitHub flavoured markdown:

pandoc -s diff.html -o diff.md -t gfm 

While colouring cell content directly is not supported in GitHub flavoured markdown, we could inject emojis into the changed cells by using replace in the --> character:

This generates a table like

@@ subject_id subject_label predicate_id object_id mapping_justification ...
... ... ... ... ... ... ...
ZFA:0000012 central nervous system oio:hasDbXref TAO:0000012 semapv:UnspecifiedMatching ...
ZFA:0000013 cranial ganglion oio:hasDbXref TAO:0000013:warning:→:warning: semapv:UnspecifiedMatching ...
ZFA:0000014 dorsal aorta oio:hasDbXref TAO:0000014 semapv:UnspecifiedMatching ...
... ... ... ... ... ... ...
ZFA:0000019 epiphysis oio:hasDbXref TAO:0000019 semapv:UnspecifiedMatching ...
ZFA:0000020 extraembryonic structure:warning:→:warning:extrembryonic structure oio:hasDbXref TAO:0000020 semapv:UnspecifiedMatching ...
ZFA:0000020 extraembryonic structure oio:hasDbXref CARO:0000042 semapv:UnspecifiedMatching ...
... ... ... ... ... ... ...

matentzn avatar Apr 08 '23 13:04 matentzn