ActiveAnno

Web-based responsive document annotation tool

View the Project on GitHub MaxMello/ActiveAnno

activeannoservice / document / DocumentDAO

DocumentDAO

class DocumentDAO

This DAO provides all methods to interact with the document collection. It hides the collection and controls access to it via the public methods.

Constructors

Name Summary
<init> This DAO provides all methods to interact with the document collection. It hides the collection and controls access to it via the public methods.DocumentDAO(database: CoroutineDatabase)

Functions

Name Summary
aggregateOptionsForSubFilterForAnnotation suspend fun aggregateOptionsForSubFilterForAnnotation(project: Project, userIdentifier: UserIdentifier): Map<String, List<SubFilterOption>>
aggregateOptionsForSubFilterForCuration suspend fun aggregateOptionsForSubFilterForCuration(project: Project, userIdentifier: UserIdentifier): Map<String, List<SubFilterOption>>
aggregateValuesForProjectAndAnnotation Get unique list of values for a project and annotation over all existing annotations.suspend fun aggregateValuesForProjectAndAnnotation(projectID: String, annotationID: String): List<String>
bulkReplace suspend fun bulkReplace(documents: List<Document>): BulkWriteResult
byId suspend fun byId(id: String): Document
byIdOrNull suspend fun byIdOrNull(id: String): Document?
countAll suspend fun countAll(): Long
countForAnnotation Count number of annotations required by the user given its userIdentifier and a list of projects.suspend fun countForAnnotation(projects: List<Project>, userIdentifier: UserIdentifier, includeMissingProjectAnnotationData: Boolean = true): Long
countForCuration Count number of curations required given a list of projects and a userIdentifier.suspend fun countForCuration(projects: List<Project>, userIdentifier: UserIdentifier): Long
createSparseIndexes suspend fun createSparseIndexes(indexes: List<BsonDocument>): Unit
deleteById suspend fun deleteById(id: String): DeleteResult
dropIndexes suspend fun dropIndexes(indexes: List<BsonDocument>): Unit
findFailedWebHookDocuments Get all documents with failed webhook tries for resend purposes given a projectIDsuspend fun findFailedWebHookDocuments(projectID: String): List<Document>
findForAnnotation Encapsulates the query for getting new documents to annotate. Will use the projects filterCondition, will optionally exclude some documents, and only return documents that are required for annotation and not already annotated by the usersuspend fun findForAnnotation(project: Project, userIdentifier: UserIdentifier, limit: Int = 10, ignoreDocuments: List<String> = listOf(), subFilter: Map<String, String> = mapOf(), dateRange: List<Long?>? = null, includeMissingProjectAnnotationData: Boolean = true): List<Document>
findForCuration Encapsulates the query for getting new documents to curate. Will use the projects filterCondition, will optionally exclude some documents, and only return documents that are required for curation. If a curator is also an annotator, and the curator annotated a document, the curator will not be able to curate the document.suspend fun findForCuration(project: Project, userIdentifier: UserIdentifier, limit: Int = 10, ignoreDocuments: List<String> = listOf(), subFilter: Map<String, String> = mapOf(), dateRange: List<Long?>? = null): List<Document>
findForExport Get all documents for an export for a projectID with options to also include unfinished documents, limit it to a list of documentIDs and/or only return documents newer than a timestamp. If unfinished documents are included, the annotation timestamp will be used, else the finalizedAnnotation timestamp.suspend fun findForExport(projectID: String, includeUnfinished: Boolean, documentIDs: List<String>, timestamp: Long?): List<Document>
findForFilter suspend fun findForFilter(filter: FilterCondition): List<Document>
findForProject Given a project, find all documents for that project.suspend fun findForProject(project: Project): List<Document>
findForProjectAndMissingGeneratedAnnotationData suspend fun findForProjectAndMissingGeneratedAnnotationData(project: Project, limit: Int = Int.MAX_VALUE): List<Document>
findForProjectAndMissingProjectAnnotationData suspend fun findForProjectAndMissingProjectAnnotationData(project: Project, limit: Int = 10): List<Document>
findForRestrictedProject Given a projectID, find all documents that are restricted to that project.suspend fun findForRestrictedProject(projectID: String): List<Document>
findForSearch Find documents for a given project and an optional additional searchFiltersuspend fun findForSearch(project: Project, searchFilter: FilterCondition?): List<Document>
getAll suspend fun getAll(batchSize: Int = 10_000): List<Document>
getAllIndexes suspend fun getAllIndexes(): List<BsonDocument>
insert Given the originalDocument, create a new document entry into the database. Provide restrictedProjectID optionally (only used in one-off project context)suspend fun insert(json: ObjectNode, restrictedProjectID: String? = null): String
insertMany Given an json array of originalDocuments, create new document entries into the database. Provide restrictedProjectID optionally (only used in one-off project context)suspend fun insertMany(json: ArrayNode, restrictedProjectID: String? = null): List<String>
save suspend fun save(document: Document): UpdateResult?
update suspend fun update(id: String, document: Document): UpdateResult
updateAndValidate suspend fun updateAndValidate(id: String, document: Document): Boolean