First sketch for custom data threaded through item processing

Refs: #2334
This commit is contained in:
eikek
2023-11-12 15:48:10 +01:00
parent fe72fbee8a
commit 83ad2c5044
12 changed files with 50 additions and 19 deletions

View File

@ -75,6 +75,7 @@ object ItemAddonTask extends AddonTaskExtension {
givenMeta = proposals,
tags = tags.map(_.name).toList,
classifyProposals = MetaProposalList.empty,
classifyTags = Nil
classifyTags = Nil,
customData = None // can't retain this information from a final item. TODO
)
}

View File

@ -112,7 +112,8 @@ object CreateItem {
MetaProposalList.empty,
Nil,
MetaProposalList.empty,
Nil
Nil,
ctx.args.meta.customData
)
}
@ -175,7 +176,8 @@ object CreateItem {
MetaProposalList.empty,
Nil,
MetaProposalList.empty,
Nil
Nil,
ctx.args.meta.customData
)
)
}

View File

@ -46,7 +46,8 @@ case class ItemData(
tags: List[String],
// proposals obtained from the classifier
classifyProposals: MetaProposalList,
classifyTags: List[String]
classifyTags: List[String],
customData: Option[Json]
) {
/** sort by weight; order of equal weights is not important, just choose one others are
@ -121,6 +122,7 @@ object ItemData {
)
)
.asJson,
"customData" -> data.customData.asJson,
"tags" -> data.tags.asJson,
"assumedTags" -> data.classifyTags.asJson,
"assumedCorrOrg" -> data.finalProposals

View File

@ -101,7 +101,8 @@ object ReProcessItem {
MetaProposalList.empty,
Nil,
MetaProposalList.empty,
Nil
Nil,
None // cannot retain customData from an already existing item
)).getOrElseF(
Sync[F].raiseError(new Exception(s"Item not found: ${ctx.args.itemId.id}"))
)
@ -134,7 +135,8 @@ object ReProcessItem {
None,
None,
true,
None // attachOnly (not used when reprocessing attachments)
None, // attachOnly (not used when reprocessing attachments)
None // cannot retain customData from an already existing item
),
Nil
).pure[F]

View File

@ -328,6 +328,7 @@ object ScanMailboxTask {
args.tags.getOrElse(Nil),
args.language,
args.attachmentsOnly,
None,
None
)
data = OUpload.UploadData(