Gregory Dubois-Felsmann has requested that we look into writing butler metadata to datasets. The specific request was to include the dataset type since if a file is renamed there is no way for someone who downloads a FITS file from the portal to really know what it came from.
Without provenance the metadata available to Datastore is a DatasetRef (uuid, run, dataId, datasetType). Formatters currently only have access to the dataId so the API for formatters would have to change to get the other information.
The next issue is to work out how to get the Butler items into the file. We should start with the specific problem of FITS files and Exposure.writeFits. The simplest approach is to add some HIERARCH BUTLER headers directly into the existing metadata and call writeFits. Jim Bosch is a bit worried that this changes the actual Exposure and if someone does butler.put from a notebook they might not expect their object to have changed. The alternative is to allow Exposure.writeFits to take extra metadata that will be added on write only.