data-science-document-ai 1.45.2__tar.gz → 1.51.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/PKG-INFO +1 -1
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/pyproject.toml +1 -1
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/constants.py +2 -7
- data_science_document_ai-1.51.0/src/docai_processor_config.yaml +22 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/excel_processing.py +7 -17
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/llm.py +0 -29
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/pdf_processing.py +2 -14
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/postprocessing/postprocess_partner_invoice.py +17 -4
- data_science_document_ai-1.51.0/src/prompts/library/arrivalNotice/other/placeholders.json +70 -0
- data_science_document_ai-1.51.0/src/prompts/library/arrivalNotice/other/prompt.txt +40 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bundeskasse/other/placeholders.json +5 -5
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bundeskasse/other/prompt.txt +6 -4
- data_science_document_ai-1.51.0/src/prompts/library/customsAssessment/other/placeholders.json +70 -0
- data_science_document_ai-1.51.0/src/prompts/library/customsAssessment/other/prompt.txt +29 -0
- data_science_document_ai-1.51.0/src/prompts/library/deliveryOrder/other/placeholders.json +82 -0
- data_science_document_ai-1.51.0/src/prompts/library/deliveryOrder/other/prompt.txt +36 -0
- data_science_document_ai-1.51.0/src/prompts/library/draftMbl/other/placeholders.json +80 -0
- data_science_document_ai-1.51.0/src/prompts/library/draftMbl/other/prompt.txt +34 -0
- data_science_document_ai-1.51.0/src/prompts/library/finalMbL/other/placeholders.json +80 -0
- data_science_document_ai-1.51.0/src/prompts/library/finalMbL/other/prompt.txt +34 -0
- data_science_document_ai-1.51.0/src/prompts/library/preprocessing/carrier/placeholders.json +14 -0
- data_science_document_ai-1.51.0/src/prompts/library/shippingInstruction/other/placeholders.json +115 -0
- data_science_document_ai-1.51.0/src/prompts/library/shippingInstruction/other/prompt.txt +28 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/setup.py +9 -16
- data_science_document_ai-1.45.2/src/docai_processor_config.yaml +0 -64
- data_science_document_ai-1.45.2/src/prompts/library/customsAssessment/other/prompt.txt +0 -42
- data_science_document_ai-1.45.2/src/prompts/library/deliveryOrder/other/placeholders.json +0 -29
- data_science_document_ai-1.45.2/src/prompts/library/deliveryOrder/other/prompt.txt +0 -50
- data_science_document_ai-1.45.2/src/prompts/library/draftMbl/hapag-lloyd/prompt.txt +0 -45
- data_science_document_ai-1.45.2/src/prompts/library/draftMbl/maersk/prompt.txt +0 -19
- data_science_document_ai-1.45.2/src/prompts/library/draftMbl/other/placeholders.json +0 -80
- data_science_document_ai-1.45.2/src/prompts/library/draftMbl/other/prompt.txt +0 -44
- data_science_document_ai-1.45.2/src/prompts/library/finalMbL/hapag-lloyd/prompt.txt +0 -44
- data_science_document_ai-1.45.2/src/prompts/library/finalMbL/maersk/prompt.txt +0 -19
- data_science_document_ai-1.45.2/src/prompts/library/finalMbL/other/prompt.txt +0 -44
- data_science_document_ai-1.45.2/src/prompts/library/preprocessing/carrier/placeholders.json +0 -30
- data_science_document_ai-1.45.2/src/prompts/library/shippingInstruction/other/prompt.txt +0 -16
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/constants_sandbox.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/docai.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/io.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/log_setup.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/postprocessing/common.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/postprocessing/postprocess_booking_confirmation.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/postprocessing/postprocess_commercial_invoice.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/evergreen/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/evergreen/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/hapag-lloyd/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/hapag-lloyd/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/maersk/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/maersk/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/msc/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/msc/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/oocl/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/oocl/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/other/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/other/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/yangming/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/bookingConfirmation/yangming/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/commercialInvoice/other/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/commercialInvoice/other/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/customsInvoice/other/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/customsInvoice/other/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/packingList/other/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/packingList/other/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/partnerInvoice/other/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/partnerInvoice/other/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/postprocessing/port_code/placeholders.json +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/postprocessing/port_code/prompt_port_code.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/library/preprocessing/carrier/prompt.txt +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/prompts/prompt_library.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/tms.py +0 -0
- {data_science_document_ai-1.45.2 → data_science_document_ai-1.51.0}/src/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "data-science-document-ai"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.51.0"
|
|
4
4
|
description = "\"Document AI repo for data science\""
|
|
5
5
|
authors = ["Naomi Nguyen <naomi.nguyen@forto.com>", "Kumar Rajendrababu <kumar.rajendrababu@forto.com>", "Igor Tonko <igor.tonko@forto.com>", "Osman Demirel <osman.demirel@forto.com>"]
|
|
6
6
|
packages = [
|
|
@@ -53,13 +53,6 @@ project_parameters = {
|
|
|
53
53
|
"model_selector": {
|
|
54
54
|
"stable": {
|
|
55
55
|
"bookingConfirmation": 1,
|
|
56
|
-
"finalMbL": 0,
|
|
57
|
-
"draftMbl": 0,
|
|
58
|
-
"arrivalNotice": 0,
|
|
59
|
-
"shippingInstruction": 0,
|
|
60
|
-
"customsAssessment": 0,
|
|
61
|
-
"deliveryOrder": 0,
|
|
62
|
-
"partnerInvoice": 0,
|
|
63
56
|
},
|
|
64
57
|
"beta": {
|
|
65
58
|
"bookingConfirmation": 0,
|
|
@@ -87,8 +80,10 @@ project_parameters = {
|
|
|
87
80
|
# Key to combine the LLM results with the Doc Ai results
|
|
88
81
|
"key_to_combine": {
|
|
89
82
|
"bookingConfirmation": ["transportLegs"],
|
|
83
|
+
"arrivalNotice": ["containers"],
|
|
90
84
|
"finalMbL": ["containers"],
|
|
91
85
|
"draftMbl": ["containers"],
|
|
86
|
+
"deliveryOrder": ["Equipment", "TransportLeg"],
|
|
92
87
|
"customsAssessment": ["containers"],
|
|
93
88
|
"packingList": ["skuData"],
|
|
94
89
|
"commercialInvoice": ["skus"],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
models_project_id: "738250249861"
|
|
2
|
+
model_config:
|
|
3
|
+
stable:
|
|
4
|
+
bookingConfirmation:
|
|
5
|
+
- id: "dc3e714cd168aeaa"
|
|
6
|
+
details:
|
|
7
|
+
display_name: "doc_cap_bookingConfirmation"
|
|
8
|
+
author: "reet.kanjilal@forto.com"
|
|
9
|
+
created_date: ""
|
|
10
|
+
- id: "3c280b11bdb3ed89"
|
|
11
|
+
details:
|
|
12
|
+
display_name: "doc_cap_BC_mlg"
|
|
13
|
+
author: "igor.tonko@forto.com"
|
|
14
|
+
created_date: ""
|
|
15
|
+
|
|
16
|
+
beta:
|
|
17
|
+
bookingConfirmation:
|
|
18
|
+
- id: "3c280b11bdb3ed89"
|
|
19
|
+
details:
|
|
20
|
+
display_name: "doc_cap_BC_mlg"
|
|
21
|
+
author: "igor.tonko@forto.com"
|
|
22
|
+
created_date: ""
|
|
@@ -11,9 +11,8 @@ import asyncio
|
|
|
11
11
|
import numpy as np
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
|
-
from src.llm import prompt_excel_extraction
|
|
15
14
|
from src.prompts.prompt_library import prompt_library
|
|
16
|
-
from src.utils import estimate_page_count,
|
|
15
|
+
from src.utils import estimate_page_count, get_excel_sheets
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
async def extract_data_from_sheet(
|
|
@@ -29,11 +28,14 @@ async def extract_data_from_sheet(
|
|
|
29
28
|
)
|
|
30
29
|
|
|
31
30
|
# Prompt for the LLM JSON
|
|
32
|
-
|
|
31
|
+
prompt = prompt_library.library[doc_type]["other"]["prompt"]
|
|
32
|
+
|
|
33
|
+
# Join the worksheet content with the prompt
|
|
34
|
+
prompt = worksheet + "\n" + prompt
|
|
33
35
|
|
|
34
36
|
try:
|
|
35
37
|
result = await llm_client.get_unified_json_genai(
|
|
36
|
-
|
|
38
|
+
prompt,
|
|
37
39
|
response_schema=response_schema,
|
|
38
40
|
doc_type=doc_type,
|
|
39
41
|
)
|
|
@@ -67,19 +69,7 @@ async def extract_data_from_excel(
|
|
|
67
69
|
|
|
68
70
|
"""
|
|
69
71
|
# Generate the response structure
|
|
70
|
-
response_schema =
|
|
71
|
-
prompt_library.library[input_doc_type]["other"]["placeholders"]
|
|
72
|
-
if input_doc_type
|
|
73
|
-
in [
|
|
74
|
-
"partnerInvoice",
|
|
75
|
-
"customsInvoice",
|
|
76
|
-
"bundeskasse",
|
|
77
|
-
"commercialInvoice",
|
|
78
|
-
"packingList",
|
|
79
|
-
"bookingConfirmation",
|
|
80
|
-
]
|
|
81
|
-
else generate_schema_structure(params, input_doc_type)
|
|
82
|
-
)
|
|
72
|
+
response_schema = prompt_library.library[input_doc_type]["other"]["placeholders"]
|
|
83
73
|
|
|
84
74
|
# Load the Excel file and get ONLY the "visible" sheet names
|
|
85
75
|
sheets, workbook = get_excel_sheets(file_content, mime_type)
|
|
@@ -201,33 +201,4 @@ class LlmClient:
|
|
|
201
201
|
return response
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
def prompt_excel_extraction(excel_structured_text):
|
|
205
|
-
"""Write a prompt to extract data from Excel files.
|
|
206
|
-
|
|
207
|
-
Args:
|
|
208
|
-
excel_structured_text (str): The structured text of the Excel file.
|
|
209
|
-
|
|
210
|
-
Returns:
|
|
211
|
-
prompt str: The prompt for common json.
|
|
212
|
-
"""
|
|
213
|
-
prompt = f"""{excel_structured_text}
|
|
214
|
-
|
|
215
|
-
Task: Fill in the following dictionary from the information in the given in the above excel data.
|
|
216
|
-
|
|
217
|
-
Instructions:
|
|
218
|
-
- Do not change the keys of the following dictionary.
|
|
219
|
-
- The values should be filled in as per the schema provided below.
|
|
220
|
-
- If an entity contains a 'display_name', consider its properties as child data points in the below format.
|
|
221
|
-
{{'data-field': {{
|
|
222
|
-
'child-data-field': 'type -occurrence_type- description',
|
|
223
|
-
}}
|
|
224
|
-
}}
|
|
225
|
-
- The entity with 'display_name' can be extracted multiple times. Please pay attention to the occurrence_type.
|
|
226
|
-
- Ensure the schema reflects the hierarchical relationship.
|
|
227
|
-
- Use the data field description to understand the context of the data.
|
|
228
|
-
|
|
229
|
-
"""
|
|
230
|
-
return prompt
|
|
231
|
-
|
|
232
|
-
|
|
233
204
|
# pylint: enable=all
|
|
@@ -202,20 +202,8 @@ async def process_file_w_llm(params, file_content, input_doc_type, llm_client):
|
|
|
202
202
|
number_of_pages = get_pdf_page_count(file_content)
|
|
203
203
|
logger.info(f"processing {input_doc_type} with {number_of_pages} pages...")
|
|
204
204
|
|
|
205
|
-
# get the schema placeholder
|
|
206
|
-
response_schema =
|
|
207
|
-
prompt_library.library[input_doc_type]["other"]["placeholders"]
|
|
208
|
-
if input_doc_type
|
|
209
|
-
in [
|
|
210
|
-
"partnerInvoice",
|
|
211
|
-
"customsInvoice",
|
|
212
|
-
"bundeskasse",
|
|
213
|
-
"commercialInvoice",
|
|
214
|
-
"packingList",
|
|
215
|
-
"bookingConfirmation",
|
|
216
|
-
]
|
|
217
|
-
else generate_schema_structure(params, input_doc_type)
|
|
218
|
-
)
|
|
205
|
+
# get the schema placeholder
|
|
206
|
+
response_schema = prompt_library.library[input_doc_type]["other"]["placeholders"]
|
|
219
207
|
|
|
220
208
|
carrier = "other"
|
|
221
209
|
carrier_schema = (
|
|
@@ -103,9 +103,18 @@ def post_process_bundeskasse(aggregated_data):
|
|
|
103
103
|
)
|
|
104
104
|
|
|
105
105
|
# Check if the deferredDutyPayer is forto
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
KEYWORDS = {"de789147263644738", "forto", "009812"}
|
|
107
|
+
|
|
108
|
+
def is_forto_recipient(line_item: dict) -> bool:
|
|
109
|
+
values_to_check = [
|
|
110
|
+
line_item.get("deferredDutyPayer", {}).get("documentValue", ""),
|
|
111
|
+
line_item.get("vatId", {}).get("documentValue", ""),
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
combined = " ".join(values_to_check).lower()
|
|
115
|
+
return any(keyword in combined for keyword in KEYWORDS)
|
|
116
|
+
|
|
117
|
+
if is_forto_recipient(line_item):
|
|
109
118
|
is_recipient_forto = True
|
|
110
119
|
|
|
111
120
|
update_recipient_and_vendor(aggregated_data, is_recipient_forto)
|
|
@@ -229,8 +238,12 @@ async def process_line_items_batch(
|
|
|
229
238
|
[
|
|
230
239
|
item.update({"reverseChargeSentence": reverse_charge})
|
|
231
240
|
for item in line_items
|
|
232
|
-
if
|
|
241
|
+
if (
|
|
242
|
+
(item.get("itemCode") and item["itemCode"]["formattedValue"] != "CDU")
|
|
243
|
+
or not item.get("itemCode")
|
|
244
|
+
)
|
|
233
245
|
]
|
|
246
|
+
|
|
234
247
|
return line_items
|
|
235
248
|
|
|
236
249
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "OBJECT",
|
|
3
|
+
"properties": {
|
|
4
|
+
"bookingNumber": {
|
|
5
|
+
"type": "STRING",
|
|
6
|
+
"nullable": true,
|
|
7
|
+
"description": "The booking number associated with the Arrival Notice document. They are often referred to as 'Booking Number', 'Booking No.', 'Booking Ref.', 'Booking Reference', 'Booking ID', 'carrier's reference' or 'Order Ref'."
|
|
8
|
+
},
|
|
9
|
+
"destinationTerminal": {
|
|
10
|
+
"type": "STRING",
|
|
11
|
+
"nullable": true,
|
|
12
|
+
"description": "The terminal at the destination port where the container will be delivered."
|
|
13
|
+
},
|
|
14
|
+
"eta": {
|
|
15
|
+
"type": "STRING",
|
|
16
|
+
"nullable": true,
|
|
17
|
+
"description": "Estimated Time of Arrival (ETA) is the expected date when the shipment will arrive at its destination."
|
|
18
|
+
},
|
|
19
|
+
"mblNumber": {
|
|
20
|
+
"type": "STRING",
|
|
21
|
+
"nullable": true,
|
|
22
|
+
"description": "Bill of Lading number (B/L NO.), a document issued by the carrier."
|
|
23
|
+
},
|
|
24
|
+
"portOfDischarge": {
|
|
25
|
+
"type": "STRING",
|
|
26
|
+
"nullable": true,
|
|
27
|
+
"description": "The port where the goods are discharged from the vessel. This is the destination port for the shipment."
|
|
28
|
+
},
|
|
29
|
+
"vesselName": {
|
|
30
|
+
"type": "STRING",
|
|
31
|
+
"nullable": true,
|
|
32
|
+
"description": "The name of the vessel carrying the shipment."
|
|
33
|
+
},
|
|
34
|
+
"containers": {
|
|
35
|
+
"type": "ARRAY",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "OBJECT",
|
|
38
|
+
"properties": {
|
|
39
|
+
"containerNumber": {
|
|
40
|
+
"type": "STRING",
|
|
41
|
+
"nullable": true,
|
|
42
|
+
"description": "The unique identifier for each container. It always starts with 4 capital letters and followed by 7 digits. Example: TEMU7972458."
|
|
43
|
+
},
|
|
44
|
+
"containerType": {
|
|
45
|
+
"type": "STRING",
|
|
46
|
+
"nullable": true,
|
|
47
|
+
"description": "The size of the container associated with the containerNumber, such as 20ft, 40ft, 40HC, 20DC etc."
|
|
48
|
+
},
|
|
49
|
+
"grossWeight": {
|
|
50
|
+
"type": "STRING",
|
|
51
|
+
"nullable": true,
|
|
52
|
+
"description": "The gross weight of the container. Usually mentioned as G.W or GW or Gross Weight, etc.."
|
|
53
|
+
},
|
|
54
|
+
"measurements": {
|
|
55
|
+
"type": "STRING",
|
|
56
|
+
"nullable": true,
|
|
57
|
+
"description": "The volume of the container. Usually, it is measured in 'Cubic Meter (cbm)' or dimensions. But volume in 'cbm' is preferred."
|
|
58
|
+
},
|
|
59
|
+
"sealNumber": {
|
|
60
|
+
"type": "STRING",
|
|
61
|
+
"nullable": true,
|
|
62
|
+
"description": "The seal number associated with the container Number. But it is not same as the container number."
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"required": ["containerNumber", "containerType", "grossWeight"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": ["bookingNumber", "destinationTerminal", "eta", "portOfDischarge", "vesselName", "containers"]
|
|
70
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<PERSONA> You are an efficient document entity data extraction specialist working for a Freight Forwarding company. <PERSONA>
|
|
2
|
+
|
|
3
|
+
<TASK> Your task is to extract data from Arrival Notice documents as per the given response schema structure. <TASK>
|
|
4
|
+
|
|
5
|
+
<CONTEXT>
|
|
6
|
+
The Freight Forwarding company receives Arrival Notice from shipping lines.
|
|
7
|
+
These documents contain various details related to arrival of a shipment to the port of destination such as container numbers, estimated time of arrival, vessel details and containers information.
|
|
8
|
+
They may be written in different languages such as English, German, Italian and can appear in a variety of formats and layouts.
|
|
9
|
+
Your role is to accurately extract specific entities from these Arrival Notices to support efficient processing and accurate record-keeping.
|
|
10
|
+
<CONTEXT>
|
|
11
|
+
|
|
12
|
+
<INSTRUCTIONS>
|
|
13
|
+
- Populate fields as defined in the response schema.
|
|
14
|
+
- Multiple Containers entries may exist, capture all instances under "containers".
|
|
15
|
+
- Use the data field description to understand the context of the data.
|
|
16
|
+
|
|
17
|
+
- bookingNumbers:
|
|
18
|
+
- Booking numbers are unique identifiers for shipments. They are often referred to as "Booking Number", "Booking No.", "Booking Ref.", "Booking Reference", "Booking ID", "SACO-Pos.", "Order Ref", "Unsere Referenz", or "Unsere Position"
|
|
19
|
+
- If there is a unique_id that starts with "S" followed by 6 or 8 digits, it is a shipmentID, not a bookingNumber.
|
|
20
|
+
|
|
21
|
+
- destinationTerminal:
|
|
22
|
+
- Destination Terminal can also be referred to as "Destination Termina;", "Pickup Location", "Delivery Location", "Delivery Terminal", "Empfangsort", "Entladeort", or "Abladestelle".
|
|
23
|
+
|
|
24
|
+
- mblNumbers:
|
|
25
|
+
- Commonly known as "Bill of Lading Number", "BILL OF LADING NO.", "BL Number", "BL No.", "B/L No.", "BL-Nr.", "B/L", "HBL No.", or "M-AWB Nummer".
|
|
26
|
+
- Bill of Lading Number is known as mblNumber. Not a shipmentID even if it starts with "S".
|
|
27
|
+
- mblNumber from Hapag-Lloyd always starts with HLC.... (e.g., "HLCUTS12303AWNT3) and named as SEA WAYBILL or "SWB-NR.
|
|
28
|
+
|
|
29
|
+
- eta:
|
|
30
|
+
- Estimated Time of Arrival (ETA) is the expected date and time when the shipment will arrive at the destination port.
|
|
31
|
+
- It can be referred to as "ETA", "Estimated Arrival", "Voraussichtliche Ankunft", "Ankunftszeit", "Arrivo", "Due to arrive at Terminal"
|
|
32
|
+
|
|
33
|
+
- vesselName:
|
|
34
|
+
- Vessel Name is the name of the ship carrying the cargo. It can be referred to as "Vessel", "Ship Name", "Schiff", "Schiffsname", "Nave", or "Vessel/Flight No.".
|
|
35
|
+
|
|
36
|
+
- containers: Details of each container on the arrival notice. Make sure to extract each container information separately.
|
|
37
|
+
- containerNumber: Container Number consists of 4 capital letters followed by 7 digits (e.g., TEMU7972458, CAIU 7222892).
|
|
38
|
+
- sealNumber: Seal numbers are unique identifiers for shipping seals. They are usually mentioned as seal numbers in the document but they are definitely not container numbers.
|
|
39
|
+
|
|
40
|
+
<INSTRUCTIONS>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "OBJECT",
|
|
3
3
|
"properties": {
|
|
4
|
-
"
|
|
4
|
+
"grandTotal": {
|
|
5
5
|
"type": "STRING",
|
|
6
6
|
"nullable": true,
|
|
7
|
-
"description": "The
|
|
7
|
+
"description": "The overall total amount of the invoice. It can be found with the key words Gesamtabgabenbetrag, Gesamtbetrag, or Zu erstattender Abgabenbetrag"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
9
|
+
"currencyCode": {
|
|
10
10
|
"type": "STRING",
|
|
11
11
|
"nullable": true,
|
|
12
|
-
"description": "The
|
|
12
|
+
"description": "The currency in which the invoice is issued. Extract the currency associated with the grand total (grandTotal) amount. It is majorly mentioned as EUR, Euro or €."
|
|
13
13
|
},
|
|
14
14
|
"issueDate": {
|
|
15
15
|
"type": "STRING",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"deferredDutyPayer": {
|
|
55
55
|
"type": "STRING",
|
|
56
56
|
"nullable": true,
|
|
57
|
-
"description": "It can be identified under
|
|
57
|
+
"description": "It can be identified under 'Aufschubenhmer' for each line item"
|
|
58
58
|
},
|
|
59
59
|
"name": {
|
|
60
60
|
"type": "STRING",
|
|
@@ -13,6 +13,7 @@ Your role is to accurately extract specific entities from these Customs invoices
|
|
|
13
13
|
- Populate fields as defined in the response schema.
|
|
14
14
|
- Multiple line item entries may exist, capture all instances under "lineItem".
|
|
15
15
|
- Use the data field description to understand the context of the data.
|
|
16
|
+
- The amount and the currency is always in EUR both for grandTotal and line items.
|
|
16
17
|
|
|
17
18
|
- containerNumber:
|
|
18
19
|
- Container Number consists of 4 capital letters followed by 7 digits (e.g., TEMU7972458, CAIU7222892).
|
|
@@ -31,15 +32,16 @@ Your role is to accurately extract specific entities from these Customs invoices
|
|
|
31
32
|
- Credit Note Invoice Number is a unique identifier for the credit note, it starts with "ATS" only (e.g., ATS.....).
|
|
32
33
|
- NIZZA is not a credit note invoice number.
|
|
33
34
|
|
|
34
|
-
- grandTotal
|
|
35
|
+
- grandTotal:
|
|
36
|
+
- It can be found with the key words Gesamtabgabenbetrag, Gesamtbetragin. In credit notes, it can be found under "Zu erstattender Abgabenbetrag".
|
|
37
|
+
- grandTotal value is always or mostly mentioned in EUR currency as it is issued by German Customs.
|
|
35
38
|
|
|
36
39
|
- serviceDate can also be referred to as "Zollanmeldung" or "Eingangdatum" in the invoice.
|
|
37
40
|
- issueDate can also be referred to as "Einfuhrabgabenbescheid" in the invoice. issueDate and serviceDate can be same in some cases.
|
|
38
41
|
- vendor details can be "Hauptzollamt" details in the top portion of the invoice.
|
|
39
42
|
|
|
40
|
-
- lineItem:
|
|
41
|
-
-
|
|
42
|
-
- totalAmount in the Credit Note is the Differenzbetrag in the line items.
|
|
43
|
+
- lineItem: Each line item should be extracted only once. Give priority to the first occurrence of the line item details in the document.
|
|
44
|
+
- totalAmount in the Credit Note is the Differenzbetrag in the line items. The totalAmount value is always or mostly mentioned in EUR currency.
|
|
43
45
|
- deferredDutyPayer can be identified under "Aufschubenhmer" for each line item. It is a combination of number code and entity.
|
|
44
46
|
|
|
45
47
|
You can usually find all the information in the top 2 pages of the invoice.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "OBJECT",
|
|
3
|
+
"properties": {
|
|
4
|
+
"consignee": {
|
|
5
|
+
"type": "STRING",
|
|
6
|
+
"nullable": true,
|
|
7
|
+
"description": "The receiver or buyer of the goods. It can be find with the keywords like Importeur, Anmelder, Empfanger, Consignee, Buyer, Receiver, etc.."
|
|
8
|
+
},
|
|
9
|
+
"countryOfOrigin": {
|
|
10
|
+
"type": "STRING",
|
|
11
|
+
"nullable": true,
|
|
12
|
+
"description": "The country where the goods were manufactured or produced. It can be identified as Land van oorsprong, Ursprungsland in the document."
|
|
13
|
+
},
|
|
14
|
+
"MRN": {
|
|
15
|
+
"type": "STRING",
|
|
16
|
+
"nullable": true,
|
|
17
|
+
"description": "Movement Reference Number (MRN) is a unique identifier assigned to each customs declaration for goods being imported or exported within the European Union (EU). It is used to track and monitor the movement of goods across EU member states. It can be found with MRN, Reg. Nr., Reg. Kennzeigechen, etc.."
|
|
18
|
+
},
|
|
19
|
+
"shipper": {
|
|
20
|
+
"type": "STRING",
|
|
21
|
+
"nullable": true,
|
|
22
|
+
"description": "The seller or shipper of the goods. It is often indicated by the term Shipper, Speditore, Esportatore, Exporteur, Versender."
|
|
23
|
+
},
|
|
24
|
+
"totalValueOfGoods": {
|
|
25
|
+
"type": "STRING",
|
|
26
|
+
"nullable": true,
|
|
27
|
+
"description": "The total monetary value of the goods being shipped, usually declared for customs purposes. It can be found with Waarde, Warenwert, Factuurwaarde, Invoice Value, etc.."
|
|
28
|
+
},
|
|
29
|
+
"containers": {
|
|
30
|
+
"type": "ARRAY",
|
|
31
|
+
"items": {
|
|
32
|
+
"type": "OBJECT",
|
|
33
|
+
"properties": {
|
|
34
|
+
"containerNumber": {
|
|
35
|
+
"type": "STRING",
|
|
36
|
+
"nullable": true,
|
|
37
|
+
"description": "The unique identifier for each container. It always starts with 4 capital letters and followed by 7 digits. Example: TEMU7972458."
|
|
38
|
+
},
|
|
39
|
+
"goodsDescription": {
|
|
40
|
+
"type": "STRING",
|
|
41
|
+
"nullable": true,
|
|
42
|
+
"description": "A brief description of the goods contained within the container. It can be found with goods description, Bezeichnung, goederenomschrijving."
|
|
43
|
+
},
|
|
44
|
+
"grossWeight": {
|
|
45
|
+
"type": "STRING",
|
|
46
|
+
"nullable": true,
|
|
47
|
+
"description": "The gross weight of the container. Usually mentioned as G.W or GW, Bruto, or Gross Weight, etc.."
|
|
48
|
+
},
|
|
49
|
+
"nettWeight": {
|
|
50
|
+
"type": "STRING",
|
|
51
|
+
"nullable": true,
|
|
52
|
+
"description": "The net weight of the goods inside the container. Usually mentioned as N.W or NW, Net Weight, or Netto, Eigenmasse, etc.."
|
|
53
|
+
},
|
|
54
|
+
"packagingNumber": {
|
|
55
|
+
"type": "STRING",
|
|
56
|
+
"nullable": true,
|
|
57
|
+
"description": "The quantity of the goods. Usually, the quantity is in pallets, PLT, cartons, CTNS, pieces, PCS, packages, boxes, etc. Please prioritize the packaging types based on their size, as follows: Pallets (PLT) >> Cartons (CTNS) >> Pieces (PCS). Extract the Larger packaging types that will have a lower count."
|
|
58
|
+
},
|
|
59
|
+
"packagingType": {
|
|
60
|
+
"type": "STRING",
|
|
61
|
+
"nullable": true,
|
|
62
|
+
"description": "The packaging type is the unit of packagingNumber. Example; pallets, PLT, cartons, CTNS, pieces, PCS, packages, etc. Sometimes, the packaging type is available in the column name of the packagingNumber."
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"required": ["containerNumber", "goodsDescription", "grossWeight", "nettWeight", "packagingNumber", "packagingType"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": ["countryOfOrigin", "MRN", "totalValueOfGoods", "containers"]
|
|
70
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<PERSONA> You are an efficient document entity data extraction specialist working for a Freight Forwarding company. <PERSONA>
|
|
2
|
+
|
|
3
|
+
<TASK> Your task is to extract data from delivery order documents as per the given response schema structure. <TASK>
|
|
4
|
+
|
|
5
|
+
<CONTEXT>
|
|
6
|
+
The Freight Forwarding company receives Customs Assessment from customs partners.
|
|
7
|
+
These documents contain various details related to shipper, buyer, MRN, and container data such as container number, goods details at container level.
|
|
8
|
+
They may be written in different languages such as English, German, Vietnamese, Chinese, and other European languages, and can appear in a variety of formats and layouts.
|
|
9
|
+
Your role is to accurately extract specific entities from these Customs Assessment to support efficient processing and accurate record-keeping.
|
|
10
|
+
<CONTEXT>
|
|
11
|
+
|
|
12
|
+
<INSTRUCTIONS>
|
|
13
|
+
- Populate fields as defined in the response schema.
|
|
14
|
+
- Multiple containers entries may exist — capture all instances under "containers".
|
|
15
|
+
- Use the data field description to understand the context of the data.
|
|
16
|
+
|
|
17
|
+
- MRN: Movement Reference Number (MRN) is a unique identifier assigned to each customs declaration for goods being imported or exported within the European Union (EU). It is used to track and monitor the movement of goods across EU member states. It can be found with MRN, Reg. Nr., Reg. Kennzeigechen, etc..
|
|
18
|
+
|
|
19
|
+
- containers: Details of each container on the Customs Assessment. Make sure to extract each container information separately.
|
|
20
|
+
- containerNumber: Container Number consists of 4 capital letters followed by 7 digits (e.g., TEMU7972458, CAIU 7222892). It can be identified as container number, cntr. nos., containernummern, cont. nr.
|
|
21
|
+
- goodsDescription: Extract only the description of the goods for the "goodsDescription" but not other information like packing, marks, etc.
|
|
22
|
+
- packagingNumber:
|
|
23
|
+
- Prioritize the "Pallets/PLTS/Cartons/CTNS/Package" over "PCS" count to extract the data for the "packagingNumber".
|
|
24
|
+
- example: If the table has "17CTNS", "9PLTS", "850", "850PCS", prioritize "9PLTS"
|
|
25
|
+
- Do not extract the pack Quantity field such as "50PCS/CTN", "5PC/Box" (these represent quantity per carton, not total shipped quantity).
|
|
26
|
+
- packagingType:
|
|
27
|
+
- Extract the unit associated with the "packagingNumber" in the table to extract the "packagingType"
|
|
28
|
+
- Sometimes it can be found on the column name of the "packagingNumber" in the table to extract the "packagingType"
|
|
29
|
+
<INSTRUCTIONS>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "OBJECT",
|
|
3
|
+
"properties": {
|
|
4
|
+
"EmptyContainerDepot": {
|
|
5
|
+
"type": "STRING",
|
|
6
|
+
"nullable": true,
|
|
7
|
+
"description": "The depot where the empty container is returned."
|
|
8
|
+
},
|
|
9
|
+
"Equipment": {
|
|
10
|
+
"type": "ARRAY",
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "OBJECT",
|
|
13
|
+
"properties": {
|
|
14
|
+
"CargoGrossWeight": {
|
|
15
|
+
"type": "STRING",
|
|
16
|
+
"nullable": true,
|
|
17
|
+
"description": "The gross weight of the Cargo. Usually mentioned as G.W or GW or Gross Weight, etc.."},
|
|
18
|
+
"ContainerNumber": {
|
|
19
|
+
"type": "STRING",
|
|
20
|
+
"nullable": true,
|
|
21
|
+
"description": "The container number associated with the document. They MUST consist of 4 letters followed by 7 digits (e.g., 'CMAU1234567', 'BMOU 575538/3', 'XLXU 1277652'). It can be found in the document as 'Container No.', 'Container Number', 'Cont. No.', 'Cont Nr.', 'Seefrachtcontainer-Nr.', or 'Containernummer'."},
|
|
22
|
+
"ContainerType": {
|
|
23
|
+
"type": "STRING",
|
|
24
|
+
"nullable": true,
|
|
25
|
+
"description": "The size or Type of the container associated with the containerNumber, such as 20ft, 40ft, 40HC, 20DC etc."},
|
|
26
|
+
"EmptyReturnReference": {
|
|
27
|
+
"type": "STRING",
|
|
28
|
+
"nullable": true,
|
|
29
|
+
"description": "The reference number or code for the return of the empty container."},
|
|
30
|
+
"Pin": {
|
|
31
|
+
"type": "STRING",
|
|
32
|
+
"nullable": true,
|
|
33
|
+
"description": "The PIN code associated with the container, often used for security or access purposes."},
|
|
34
|
+
"TareWeight": {
|
|
35
|
+
"type": "STRING",
|
|
36
|
+
"nullable": true,
|
|
37
|
+
"description": "The weight of the empty container itself, without any cargo inside. Usually mentioned as T.W or TW or Tare Weight, etc.."}
|
|
38
|
+
},
|
|
39
|
+
"required": ["CargoGrossWeight", "ContainerNumber", "EmptyReturnReference", "Pin", "TareWeight"]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"pickUpTerminal": {
|
|
43
|
+
"type": "STRING",
|
|
44
|
+
"nullable": true,
|
|
45
|
+
"description": "The terminal where the container or cargo is picked up."
|
|
46
|
+
},
|
|
47
|
+
"TransportLeg": {
|
|
48
|
+
"type": "ARRAY",
|
|
49
|
+
"items": {
|
|
50
|
+
"type": "OBJECT",
|
|
51
|
+
"properties": {
|
|
52
|
+
"eta": {
|
|
53
|
+
"type": "STRING",
|
|
54
|
+
"nullable": true,
|
|
55
|
+
"description": "Estimated Time of Arrival (ETA) is the expected date when the shipment will arrive at its destination."},
|
|
56
|
+
"etd": {
|
|
57
|
+
"type": "STRING",
|
|
58
|
+
"nullable": true,
|
|
59
|
+
"description": "Estimated Time of Departure (ETD) is the expected date when the shipment will leave the origin port."},
|
|
60
|
+
"portOfDischarge": {
|
|
61
|
+
"type": "STRING",
|
|
62
|
+
"nullable": true,
|
|
63
|
+
"description": "The port where the goods are discharged from the vessel. This is the destination port for the shipment."},
|
|
64
|
+
"portOfLoading": {
|
|
65
|
+
"type": "STRING",
|
|
66
|
+
"nullable": true,
|
|
67
|
+
"description": "The origin port where the goods are loaded onto the vessel. Find information like 'Ladehafen' or 'Port of Loading' in the invoice."},
|
|
68
|
+
"vesselName": {
|
|
69
|
+
"type": "STRING",
|
|
70
|
+
"nullable": true,
|
|
71
|
+
"description": "The name of the vessel carrying the container or shipment"},
|
|
72
|
+
"voyage": {
|
|
73
|
+
"type": "STRING",
|
|
74
|
+
"nullable": true,
|
|
75
|
+
"description": "The unique voyage number or identifier assigned to a vessel’s specific journey. This typically corresponds to the scheduled sailing associated with the shipment and can often be found near vessel information on shipping documents. such as voyage, voy. no, voyage-no."}
|
|
76
|
+
},
|
|
77
|
+
"required": ["eta", "etd", "portOfDischarge", "portOfLoading", "vesselName", "voyage"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": ["Equipment", "TransportLeg"]
|
|
82
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<PERSONA> You are an efficient document entity data extraction specialist working for a Freight Forwarding company. <PERSONA>
|
|
2
|
+
|
|
3
|
+
<TASK> Your task is to extract data from Delivery Order documents as per the given response schema structure. <TASK>
|
|
4
|
+
|
|
5
|
+
<CONTEXT>
|
|
6
|
+
The Freight Forwarding company receives Delivery Order from Carrier (Shipping Lines) partners.
|
|
7
|
+
These documents contain various details related to shipments, equipment details, transport leg details, delivery / pickup details, vessel details, pick up terminal data.
|
|
8
|
+
They may be written in different languages such as English, German, Vietnamese, Chinese, and other European languages, and can appear in a variety of formats and layouts.
|
|
9
|
+
Your role is to accurately extract specific entities from these Delivery Orders to support efficient processing and accurate record-keeping.
|
|
10
|
+
<CONTEXT>
|
|
11
|
+
|
|
12
|
+
<INSTRUCTIONS>
|
|
13
|
+
- Populate fields as defined in the response schema.
|
|
14
|
+
- Multiple Equipment and TransportLeg entries may exist — capture all instances under "Equipment" and "TransportLeg".
|
|
15
|
+
- Use the data field description to understand the context of the data.
|
|
16
|
+
|
|
17
|
+
EmptyContainerDepot: Empty container depot address.
|
|
18
|
+
Equipment: Details of each Equipment on the Delivery Order. Make sure to extract each Equipment information separately.
|
|
19
|
+
CargoGrossWeight: Total weight of the cargo, including the tare weight of the container. Weight(incl. tare), Cargo Weight, Weight (KG)
|
|
20
|
+
ContainerNumber: Container Number consists of 4 capital letters followed by 7 digits (e.g., TEMU7972458, CAIU 7222892).
|
|
21
|
+
ContainerType: Type of the shipping container, usually related to it's size.
|
|
22
|
+
EmptyReturnReference: A reference code for empty container return. Find it as Drop off reference, turn-in reference in the document.
|
|
23
|
+
Pin: Container release reference or PIN code to pick up the container. Can be found as Release reference, pin
|
|
24
|
+
TareWeight: Weight of the empty container without cargo. It can be found as Tare weight, tare.
|
|
25
|
+
|
|
26
|
+
pickUpTerminal: The specific terminal for cargo pickup. It can also be found as pick up at depot, empty container depot, pickup depot, empty pickup location in the doc.
|
|
27
|
+
|
|
28
|
+
TransportLeg: Details of each TransportLeg on the Delivery Order. Make sure to extract each TransportLeg information separately.
|
|
29
|
+
eta: The estimated time of arrival for a specific leg.
|
|
30
|
+
etd: The estimated time of departure for a specific leg.
|
|
31
|
+
portOfDischarge: The port where cargo is unloaded.
|
|
32
|
+
portOfLoading: The port where cargo is loaded.
|
|
33
|
+
vesselName: The name of the vessel.
|
|
34
|
+
voyage: The journey or route code taken by the vessel. It is often identified as voyage, voy. no, voyage-no in the document.
|
|
35
|
+
|
|
36
|
+
<INSTRUCTIONS>
|