Is it possible to access provenance through the artifact API


I think the title pretty much sums it up. I'd like to view an artifacts provenance through the artifact API in whatever format it available, though JSON would be the bees knees. I'm guessing this is not currently possible, however it would not be the first time I missed something.

Thanks for all of the work on QIIME2!


Hi @John_Chase, welcome back! :qiime2:

That's a great question! Your guess is correct - you will not be able to view an Artifact's provenance through the Artifact API. Currently, the only interface that supports viewing or accessing provenance data is q2view.

Hope this helps! Feel free to reach back out if you have any additional questions!



Hey @John_Chase,
I'm working on tools for provenance parsing and replay, and am curious about your use cases. Unfortunately, this probably won't help you in the short term, but if you or others would benefit from some new functionality in the long run, I can try to work it in.



Would also be interested in this. One possible use case I can think of is programmatically generating a flowchart through NetworkX or something similar. This could be a nice way to customize the visualization of an Artifact's history. NX I think also can be serialized into JSON so that might be nice.


Thanks for the input, @gibsramen! NX is already being used under the hood, and giving folks access to the provenance graph should be an easy win. I believe you're right about JSON serialization, and tooling also exists for handing NX graphs to Cytoscape for plotting.


Thanks @ChrisKeefe and @lizgehret! I will be interested in learning more about what you are doing at some point.

I'm working on tools for provenance parsing and replay, and am curious about your use cases.

We are developing an application that would allow users to the view the provenance of an artifact, similar to how q2-view does it, but would like to be able to interact with the provenance a bit more.

Our current solution which is based on code that @jakereps wrote awhile back is similar to:

    provenance_file = artifact._archiver.provenance_dir / "action/action.yaml"
    with as fh:
       text =
        # replace custom qiime definitions that fail with yaml loader
        # text = text.replace("!cite", "")
        provenance = yaml.safe_load(text)

Not perfect, but perhaps someone will find it helpful


Neat! Good luck, and sorry we don't have anything ready-made for ya.

I can let you (and @gibsramen ) know when there's an alpha. It would be nice to get some :brain: s looking at this thing! :smiley: