Hello, I am trying to develop a custom DB that will allow prodigy to send and receive annotated data to a service (rather than a DB like Postgres or SQLite). I looked at the documentation referring to peewee but it would be very helpful if there's a tutorial or example to develop this integration with my back end service.
Hi! We don't have a tutorial specifically for your use case (and it's often difficult because every use case is so different). Under the hood, Prodigy expects the Database
object to be a class that exposes the following methods that are called as part of the lifecycle: https://prodi.gy/docs/api-database#init Not all methods have to do something – for instance, in your case, your reconnect
method may do nothing, and your add_dataset
and add_examples
methods would make requests to your server.
Another potentially simpler alternative: the update
callback of a recipe is called whenever new answers are received from the web app. So if your goal is mostly to send the collected annotations to your service, you could just do this in the update
callback. Then you could either disable Prodigy's default database, or keep a simple SQLite database as a backup, just in case.