Hi! I don't remember anyone sharing an example with MongoDB, but you might find this thread helpful for some more general tips for implementing a custom Database
class:
Ultimately, your Database
class just needs to provide the same methods as Prodigy's built in Database
class (you can find the API specs in your PRODIGY_README.html
). How you structure things internally and how you communicate with MongoDB is up to you. For instance, the Database.get_dataset
method takes the string name of a dataset and should return a list of dictionaries of the annotations in the given set. That's all Prodigy cares about – so if you can construct a query that gets you that data, everything should work as expected.
The source of the database models is also included with Prodigy, so you can take a look at it for some inspiration.