Unable to get Extracted Date field value in the standard/Converted format in a Custom Model

Niranjan Mahtole 41 Reputation points
2022-10-31T08:54:13.867+00:00

Hi Team,

I have created a custom model in which I have a created a date field. While I am testing the trained model the value of the date field is not getting extracted in a standard format. Please find below extraction response/result.

"fields": {
"document_date": {
"type": "date",
"content": "04-OCT -2021",
"boundingRegions": [
{
"pageNumber": 2,
"polygon": [
5.325,
8.26,
6.96,
8.26,
6.96,
8.49,
5.325,
8.49
]
}
],
"confidence": 0.98,
"spans": [
{
"offset": 3686,
"length": 12
}
]
}
}

The Above response shows only content value got extracted. However the Date is not converted into a standard format.

Thanks & Regards,
Niranjan M.

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
2,122 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 18,676 Reputation points Moderator
    2022-11-05T06:44:32.32+00:00

    Hi @Niranjan Mahtole ,

    Thank you for bringing this to our notice.
    In order for the date conversion to work, 3 things are required from Form Recognizer Studio (FRS):

    1. Specify the Sub Type to “Date
    2. Specify the Field Format to one of the values: “dmy”, “mdy”, “ymd” in fields.json file. This specifies the
      year/month/day order. Without this info, Form Recognizer does not know how to interpret the
      year/month/day value. (The functionality as of today is very limited)
    3. The extracted date string must exactly match the year/month/day order as specified in the Field Format. If it
      does not match, no conversation will happen.
      o For example, if the user specifies "dmy", and the date string is "13-11-20", it will be converted to "2020- 11-13".
      o However, if the "dmy" is still specified, but the date string is "11-15-20", the conversation won’t happen, as “15” is not a valid month.

    The date conversion is supported natively by Form Recognizer 3.0 API. Here is the workaround:

    • Start labeling as usual in Form Recognizer Studio (FRS), and specify the date fields as “Date” in FRS.
      257320-image.png
    • Go to blob storage of the training files, there is a file called fields.json generated by FRS in the previous step.
      List item
    • Download the fields.json and open it in an editor or Right click on file and click edit to make changes without downloading.
    • Look for all nodes with “fieldType”:”date” in the “fields” section in fields.json.
    • All matching nodes should have this additional value: “fieldFormat”:”not-specified”.
      List item
    • Change “not-specified” value to one of the value: “dmy”, “mdy”, “ymd”
      List item
    • Save and upload the fields.json back to the same folder in the blob storage.
    • Train the model as usual
    • The created model should now be able to convert the date strings if the extracted date string is valid, as mentioned in the item #3 above.
    • Here is an example of the conversion. Note that the converted value will be in the “valueDate”.
      List item

    Please let me know if you have more questions about this.

    I hope this helps.

    Regards,
    Vasavi
    If an answer is helpful, please click on ![130616-image.png or upvote ![130671-image.png which might help other community members reading this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.