Set external id to source item

Hello,

I’m writing a plugin to export elements to a repository and I’d like to insert the repository identifier in the source element.
What is the best way to do this?
Thanks in advance
Bruno

Hi Bruno!

Just to make sure I understand this correctly, you’re exporting the item to the repository and obtain an id. Then you’d like to store that id with the item that was exported, yes?

There’s no way, currently, for doing this in an export plugin. We’ve contemplated adding a more general ‘processing’ plugin hook which would be allowed to make changes to the item, but that’s something we have yet to implement. Maybe this is a good opportunity to get the ball rolling on this, if you’re interested let’s take this over to GitHub and decide on how to do this.

Hi !

Just to make sure I understand this correctly, you’re exporting the item to the repository and obtain an id. Then you’d like to store that id with the item that was exported, yes?

yes, that’s exactly the aim, so that any updates can be passed on to the item stored in the repository.

There’s no way, currently, for doing this in an export plugin. We’ve contemplated adding a more general ‘processing’ plugin hook which would be allowed to make changes to the item, but that’s something we have yet to implement. Maybe this is a good opportunity to get the ball rolling on this, if you’re interested let’s take this over to GitHub and decide on how to do this.

I need to find a workaround for now, but I’m interested in a simple mechanism…
Thanks in advance
Bruno

As a workaround, there are only two things that come to mind: either to add the value to the database directly using SQL or to dispatch an action to Tropy’s own command for adding metadata. The difficulty with both these approaches is that the plugin doesn’t know the item’s internal ids and so it’s difficult to know which item you’re actually dealing with. I think we’d have to address this by supplying additional context to the plugin or by adding the ‘processing’ hook for plugins: the idea there would be that the plugin can return data for each processed item. This could include metadata and notes for example and Tropy would then add these to the item after processing. I think this would be the best approach and we could add it relatively quickly if you’d be willing to work with a Beta version.

I think we’d have to address this by supplying additional context to the plugin or by adding the ‘processing’ hook for plugins: the idea there would be that the plugin can return data for each processed item. This could include metadata and notes for example and Tropy would then add these to the item after processing. I think this would be the best approach and we could add it relatively quickly if you’d be willing to work with a Beta version.

Sounds great! Yes, I’d be interested in testing this feature in a Beta version.
Thanks a lot !