04-20-2020 06:16 AM
Hello guys,
I'm trying to create my own AI model by
https://docs.alfresco.com/intelligence/concepts/custom-config-textract.html
I followed the documentation and checked it several times, created a custom AI content model, model context, property mapping, updated the share-config-custom.xml and digital worspace json file. No error in logs.
Unfortunately, the digital workspace does not display custom metadata. I must have missed something. Could you give me some advice?
I want to extract text from pdf invoices using AWS textract. I've started default recognition (e.g AI Text Lines, AI Dates aspects working) and try to add a custom model.
1) My custom model
<?xml version="1.0" encoding="UTF-8"?>
<model name="my:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>Custom Content Model for Artificial Intelligence extension</description>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<import uri="http://www.alfresco.org/model/site/1.0" prefix="st" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
<import uri="http://www.alfresco.org/model/ai/1.0" prefix="ai"/>
</imports>
<namespaces>
<namespace uri="http://mymodel.org" prefix="my" />
</namespaces>
<aspects>
<aspect name="my:invoice">
<title>Invoice Info</title>
<parent>ai:textract</parent>
<properties>
<property name="my:varsymbol">
<title>Variabilni symbol</title>
<type>d:text</type>
<multiple>true</multiple>
<index enabled="true" />
</property>
<property name="my:splatnost">
<title>Datum splatnosti</title>
<type>d:text</type>
<multiple>true</multiple>
<index enabled="true" />
</property>
<property name="my:ico">
<title>ICO</title>
<type>d:text</type>
<multiple>true</multiple>
<index enabled="true" />
</property>
<property name="my:dic">
<title>DIC</title>
<type>d:text</type>
<multiple>true</multiple>
<index enabled="true" />
</property>
</properties>
</aspect>
</aspects>
</model>2) AI property mapping
{
"keyValueMapping":[
{
"aiTextract":[
{
"key":"Variabilni symbol:",
"aspect":"my:invoice",
"property":"my:varsymbol"
},
{
"key":"Datum splatnosti:",
"aspect":"my:invoice",
"property":"my:splatnost"
},
{
"key":"ICO:",
"aspect":"my:invoice",
"property":"my:ico"
},
{
"key":"DIC:",
"aspect":"my:invoice",
"property":"my:dic"
}
]
}
]
}3) Update app.extension.json for digital workspace
"content-metadata-presets": [
{
"id": "app.content.metadata.custom",
"custom": [
{
"id": "ai.metadata.features",
"title": "AI Data",
"items": [
{
"id": "ai:products",
"aspect": "ai:products",
"properties": "*"
},
{
"id": "ai:dates",
"aspect": "ai:dates",
"properties": "*"
},
...
{
"id": "my:invoice",
"aspect": "my:invoice",
"properties": "*"
}
...
]
},3) Update share-config-custom.xml
<?xml version="1.0" encoding="UTF-8"?>
<alfresco-config>
<config evaluator="string-compare" condition="DocumentLibrary">
<!-- Aspects that a user can see -->
<aspects>
<visible>
<aspect name="my:invoice"/>
</visible>
</aspects>
</config>
</alfresco-config>4) add rule and aspect to folder
And this is the result:
Explore our Alfresco products with the links below. Use labels to filter content by product module.