data-science-document-ai 1.56.1__py3-none-any.whl → 1.58.0__py3-none-any.whl
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.56.1.dist-info → data_science_document_ai-1.58.0.dist-info}/METADATA +1 -1
- {data_science_document_ai-1.56.1.dist-info → data_science_document_ai-1.58.0.dist-info}/RECORD +23 -23
- src/constants.py +8 -26
- src/docai_processor_config.yaml +0 -13
- src/pdf_processing.py +29 -27
- src/postprocessing/common.py +35 -0
- src/prompts/library/bookingConfirmation/evergreen/placeholders.json +135 -21
- src/prompts/library/bookingConfirmation/evergreen/prompt.txt +21 -17
- src/prompts/library/bookingConfirmation/hapag-lloyd/placeholders.json +136 -22
- src/prompts/library/bookingConfirmation/hapag-lloyd/prompt.txt +54 -58
- src/prompts/library/bookingConfirmation/maersk/placeholders.json +135 -21
- src/prompts/library/bookingConfirmation/maersk/prompt.txt +10 -1
- src/prompts/library/bookingConfirmation/msc/placeholders.json +135 -21
- src/prompts/library/bookingConfirmation/msc/prompt.txt +10 -1
- src/prompts/library/bookingConfirmation/oocl/placeholders.json +149 -21
- src/prompts/library/bookingConfirmation/oocl/prompt.txt +11 -3
- src/prompts/library/bookingConfirmation/other/placeholders.json +149 -21
- src/prompts/library/bookingConfirmation/other/prompt.txt +56 -57
- src/prompts/library/bookingConfirmation/yangming/placeholders.json +149 -21
- src/prompts/library/bookingConfirmation/yangming/prompt.txt +11 -1
- src/setup.py +11 -9
- src/utils.py +6 -2
- {data_science_document_ai-1.56.1.dist-info → data_science_document_ai-1.58.0.dist-info}/WHEEL +0 -0
{data_science_document_ai-1.56.1.dist-info → data_science_document_ai-1.58.0.dist-info}/RECORD
RENAMED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
src/constants.py,sha256=
|
|
1
|
+
src/constants.py,sha256=Mr5HcoMSFQlXY24shJ1EpNKtCBJP_Ai0LZj-0i3BVGk,2845
|
|
2
2
|
src/constants_sandbox.py,sha256=Iu6HdjCoNSmOX0AwoL9qUQkhq_ZnIN5U9e-Q2UfNuGc,547
|
|
3
3
|
src/docai.py,sha256=dHuR0ehVjUi1CnoNvdp_yxJtpU_HFXqAZ61ywdz7BEo,5655
|
|
4
|
-
src/docai_processor_config.yaml,sha256=
|
|
4
|
+
src/docai_processor_config.yaml,sha256=ZewXqbyiftzmVAaS08BoNp5trY6WXx3HMWDfPwmKfaI,256
|
|
5
5
|
src/excel_processing.py,sha256=TRgAzSHvL1WKbUgjHtpXL701bPhiWGH7kk3S6e1UPaA,3074
|
|
6
6
|
src/io.py,sha256=rYjXVLlriEacw1uNuPIYhg12bXNu48Qs9GYMY2YcVTE,5563
|
|
7
7
|
src/llm.py,sha256=a7UYA4ITUNjzct_2fHgM-bma_XWc28VC0FV71g9tnUI,7137
|
|
8
8
|
src/log_setup.py,sha256=RhHnpXqcl-ii4EJzRt47CF2R-Q3YPF68tepg_Kg7tkw,2895
|
|
9
|
-
src/pdf_processing.py,sha256=
|
|
10
|
-
src/postprocessing/common.py,sha256=
|
|
9
|
+
src/pdf_processing.py,sha256=Fx-Glb9niEUU3WUCrBZ02ZYV-E2vWoUM0ifN7-0A1Q4,19961
|
|
10
|
+
src/postprocessing/common.py,sha256=tyy97UBfcnSs8Oh5vVDp4D1qDRit32ri9IGqRlNZcaY,27254
|
|
11
11
|
src/postprocessing/postprocess_booking_confirmation.py,sha256=nK32eDiBNbauyQz0oCa9eraysku8aqzrcoRFoWVumDU,4827
|
|
12
12
|
src/postprocessing/postprocess_commercial_invoice.py,sha256=3I8ijluTZcOs_sMnFZxfkAPle0UFQ239EMuvZfDZVPg,1028
|
|
13
13
|
src/postprocessing/postprocess_partner_invoice.py,sha256=WuaTQK5D09dV_QNrh29ZoKX9IvQn2Ub-WnAMyRjCsvI,14240
|
|
14
14
|
src/prompts/library/arrivalNotice/other/placeholders.json,sha256=1vzly1amgyKt3jr2JJQbb24kNZsnI289iduvoUo5dJU,3061
|
|
15
15
|
src/prompts/library/arrivalNotice/other/prompt.txt,sha256=QNuU-BvMA8VbdupVNapad4O3WmCotH5cKNxImRMbKDk,2906
|
|
16
|
-
src/prompts/library/bookingConfirmation/evergreen/placeholders.json,sha256=
|
|
17
|
-
src/prompts/library/bookingConfirmation/evergreen/prompt.txt,sha256=
|
|
18
|
-
src/prompts/library/bookingConfirmation/hapag-lloyd/placeholders.json,sha256=
|
|
19
|
-
src/prompts/library/bookingConfirmation/hapag-lloyd/prompt.txt,sha256=
|
|
20
|
-
src/prompts/library/bookingConfirmation/maersk/placeholders.json,sha256=
|
|
21
|
-
src/prompts/library/bookingConfirmation/maersk/prompt.txt,sha256=
|
|
22
|
-
src/prompts/library/bookingConfirmation/msc/placeholders.json,sha256=
|
|
23
|
-
src/prompts/library/bookingConfirmation/msc/prompt.txt,sha256=
|
|
24
|
-
src/prompts/library/bookingConfirmation/oocl/placeholders.json,sha256=
|
|
25
|
-
src/prompts/library/bookingConfirmation/oocl/prompt.txt,sha256=
|
|
26
|
-
src/prompts/library/bookingConfirmation/other/placeholders.json,sha256=
|
|
27
|
-
src/prompts/library/bookingConfirmation/other/prompt.txt,sha256
|
|
28
|
-
src/prompts/library/bookingConfirmation/yangming/placeholders.json,sha256=
|
|
29
|
-
src/prompts/library/bookingConfirmation/yangming/prompt.txt,sha256=
|
|
16
|
+
src/prompts/library/bookingConfirmation/evergreen/placeholders.json,sha256=5efq6b--KGWeqGbvASZFTqXJgUEAvsC-0ljo-q0Lhew,5855
|
|
17
|
+
src/prompts/library/bookingConfirmation/evergreen/prompt.txt,sha256=OxNfXZaWppwsFMprthzJpOOr8ApQL4KYEmlu9fSUvxk,3485
|
|
18
|
+
src/prompts/library/bookingConfirmation/hapag-lloyd/placeholders.json,sha256=en83Em25e5PF2OAgFJC8w-MONVnketPZ3J_3zCjIVfE,5915
|
|
19
|
+
src/prompts/library/bookingConfirmation/hapag-lloyd/prompt.txt,sha256=bLHQgGR9e8X4UvFpiyd1OasD00XGvUMG6HSLQy4IgQ4,5157
|
|
20
|
+
src/prompts/library/bookingConfirmation/maersk/placeholders.json,sha256=5efq6b--KGWeqGbvASZFTqXJgUEAvsC-0ljo-q0Lhew,5855
|
|
21
|
+
src/prompts/library/bookingConfirmation/maersk/prompt.txt,sha256=S-C5cq8AkEoGKilCO0XiXLZXgZPwz9udQOTm557GG64,3984
|
|
22
|
+
src/prompts/library/bookingConfirmation/msc/placeholders.json,sha256=5efq6b--KGWeqGbvASZFTqXJgUEAvsC-0ljo-q0Lhew,5855
|
|
23
|
+
src/prompts/library/bookingConfirmation/msc/prompt.txt,sha256=bojE6BytnEoQfdXrQebaXYTToDF1Fbyn4YdIGMke2Jo,5463
|
|
24
|
+
src/prompts/library/bookingConfirmation/oocl/placeholders.json,sha256=LqjzD-8LkX9hAq3eOBMwit6tLrSLmVMUXTIyhBEaYxk,6037
|
|
25
|
+
src/prompts/library/bookingConfirmation/oocl/prompt.txt,sha256=pCsj2BNnP-_kwgUEDt8IehO-tyMv6qeD5nyIzXJL3c0,2925
|
|
26
|
+
src/prompts/library/bookingConfirmation/other/placeholders.json,sha256=LqjzD-8LkX9hAq3eOBMwit6tLrSLmVMUXTIyhBEaYxk,6037
|
|
27
|
+
src/prompts/library/bookingConfirmation/other/prompt.txt,sha256=-629upv9-ciO6eG3A0_2TTjy7iLlInMsmQfSwAukjLg,4919
|
|
28
|
+
src/prompts/library/bookingConfirmation/yangming/placeholders.json,sha256=LqjzD-8LkX9hAq3eOBMwit6tLrSLmVMUXTIyhBEaYxk,6037
|
|
29
|
+
src/prompts/library/bookingConfirmation/yangming/prompt.txt,sha256=gySDhfRdQHy3IIomOR3qwY49wlO63Xw73GUSPrEkkr4,3990
|
|
30
30
|
src/prompts/library/bundeskasse/other/placeholders.json,sha256=7xKzi_ypkIICO9nrEl45W9G7-h33uWVRVWnpg2b5lUg,4288
|
|
31
31
|
src/prompts/library/bundeskasse/other/prompt.txt,sha256=miNYoqRZEd6Z1LNisTahX1-tenzr5kEpRA6gvPH7NCw,3316
|
|
32
32
|
src/prompts/library/commercialInvoice/other/placeholders.json,sha256=zUK2mg9MnHiEQRYF6VgTiUiq68WGy5f7_4qL63CWyR0,4700
|
|
@@ -52,9 +52,9 @@ src/prompts/library/preprocessing/carrier/prompt.txt,sha256=NLvRZQCZ6aWC1yTr7Q93
|
|
|
52
52
|
src/prompts/library/shippingInstruction/other/placeholders.json,sha256=eK4AeMfORkGMWVYcqH7NjB56Zb4swHTvcQD5UQbTryg,6374
|
|
53
53
|
src/prompts/library/shippingInstruction/other/prompt.txt,sha256=CbrqlKMtB-sVY-8E460KP1KNmz169YVPMrH3-uEldPg,2135
|
|
54
54
|
src/prompts/prompt_library.py,sha256=VJWHeXN-s501C2GiidIIvQQuZdU6T1R27hE2dKBiI40,2555
|
|
55
|
-
src/setup.py,sha256=
|
|
55
|
+
src/setup.py,sha256=8-vZWjC8Iwa3xxdk3iR4412VCjtNtgzVqkXcFon7UBE,7309
|
|
56
56
|
src/tms.py,sha256=UXbIo1QE--hIX6NZi5Qyp2R_CP338syrY9pCTPrfgnE,1741
|
|
57
|
-
src/utils.py,sha256=
|
|
58
|
-
data_science_document_ai-1.
|
|
59
|
-
data_science_document_ai-1.
|
|
60
|
-
data_science_document_ai-1.
|
|
57
|
+
src/utils.py,sha256=8BpuJJLiJZntZAI86cQMNa-FGjl9jbOjlCWIG27mjJo,17418
|
|
58
|
+
data_science_document_ai-1.58.0.dist-info/METADATA,sha256=8MWt4KlixrpV8lQhKmFo5i1UZn02o16vMaR3uEe94Js,2152
|
|
59
|
+
data_science_document_ai-1.58.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
60
|
+
data_science_document_ai-1.58.0.dist-info/RECORD,,
|
src/constants.py
CHANGED
|
@@ -37,6 +37,8 @@ project_parameters = {
|
|
|
37
37
|
# models metadata (confidence),
|
|
38
38
|
"g_model_data_folder": "models",
|
|
39
39
|
"local_model_data_folder": "data",
|
|
40
|
+
"if_use_docai": False,
|
|
41
|
+
"if_use_llm": True, # Keep it always True
|
|
40
42
|
"released_doc_types": {
|
|
41
43
|
"bookingConfirmation",
|
|
42
44
|
"packingList",
|
|
@@ -51,16 +53,6 @@ project_parameters = {
|
|
|
51
53
|
"customsInvoice",
|
|
52
54
|
"bundeskasse",
|
|
53
55
|
},
|
|
54
|
-
"model_selector": {
|
|
55
|
-
"stable": {
|
|
56
|
-
"bookingConfirmation": 1,
|
|
57
|
-
},
|
|
58
|
-
"beta": {
|
|
59
|
-
"bookingConfirmation": 0,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
# this is the model selector for the model to be used from the model_config.yaml
|
|
63
|
-
# file based on the environment, 0 mean the first model in the list
|
|
64
56
|
# LLM model parameters
|
|
65
57
|
"gemini_params": {
|
|
66
58
|
"temperature": 0,
|
|
@@ -78,25 +70,15 @@ project_parameters = {
|
|
|
78
70
|
"seed": 42,
|
|
79
71
|
"model_id": "gemini-2.5-flash",
|
|
80
72
|
},
|
|
81
|
-
# Key to combine the LLM results with the Doc Ai results
|
|
82
|
-
"key_to_combine": {
|
|
83
|
-
"bookingConfirmation": ["transportLegs"],
|
|
84
|
-
"arrivalNotice": ["containers"],
|
|
85
|
-
"finalMbL": ["containers"],
|
|
86
|
-
"draftMbl": ["containers"],
|
|
87
|
-
"deliveryOrder": ["Equipment", "TransportLeg"],
|
|
88
|
-
"customsAssessment": ["containers"],
|
|
89
|
-
"packingList": ["skuData"],
|
|
90
|
-
"commercialInvoice": ["skus"],
|
|
91
|
-
"shippingInstruction": ["containers"],
|
|
92
|
-
"partnerInvoice": ["lineItem"],
|
|
93
|
-
"customsInvoice": ["lineItem"],
|
|
94
|
-
"bundeskasse": ["lineItem"],
|
|
95
|
-
},
|
|
96
73
|
}
|
|
97
74
|
|
|
98
75
|
# Hardcoded rules for data points formatting that can't be based on label name alone
|
|
99
76
|
formatting_rules = {
|
|
100
|
-
"bookingConfirmation": {
|
|
77
|
+
"bookingConfirmation": {
|
|
78
|
+
"pickUpDepotCode": "depot",
|
|
79
|
+
"dropOffDepotCode": "depot",
|
|
80
|
+
"gateInTerminalCode": "terminal",
|
|
81
|
+
"pickUpTerminalCode": "terminal",
|
|
82
|
+
},
|
|
101
83
|
"deliveryOrder": {"pickUpTerminal": "terminal", "EmptyContainerDepot": "depot"},
|
|
102
84
|
}
|
src/docai_processor_config.yaml
CHANGED
|
@@ -7,16 +7,3 @@ model_config:
|
|
|
7
7
|
display_name: "doc_cap_bookingConfirmation"
|
|
8
8
|
author: "reet.kanjilal@forto.com"
|
|
9
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: ""
|
src/pdf_processing.py
CHANGED
|
@@ -201,9 +201,6 @@ async def process_file_w_llm(params, file_content, input_doc_type, llm_client):
|
|
|
201
201
|
number_of_pages = get_pdf_page_count(file_content)
|
|
202
202
|
logger.info(f"processing {input_doc_type} with {number_of_pages} pages...")
|
|
203
203
|
|
|
204
|
-
# get the schema placeholder
|
|
205
|
-
response_schema = prompt_library.library[input_doc_type]["other"]["placeholders"]
|
|
206
|
-
|
|
207
204
|
carrier = "other"
|
|
208
205
|
carrier_schema = (
|
|
209
206
|
prompt_library.library.get("preprocessing", {})
|
|
@@ -240,6 +237,9 @@ async def process_file_w_llm(params, file_content, input_doc_type, llm_client):
|
|
|
240
237
|
# get the related prompt from predefined prompt library
|
|
241
238
|
prompt = prompt_library.library[input_doc_type][carrier]["prompt"]
|
|
242
239
|
|
|
240
|
+
# get the schema placeholder
|
|
241
|
+
response_schema = prompt_library.library[input_doc_type][carrier]["placeholders"]
|
|
242
|
+
|
|
243
243
|
# Add page-number extraction for moderately large docs
|
|
244
244
|
use_chunking = number_of_pages >= params["chunk_after"]
|
|
245
245
|
|
|
@@ -353,8 +353,7 @@ async def extract_data_from_pdf_w_llm(params, input_doc_type, file_content, llm_
|
|
|
353
353
|
# Add currency from the amount field
|
|
354
354
|
if input_doc_type in ["commercialInvoice"]:
|
|
355
355
|
result = postprocessing_commercial_invoice(result, params, input_doc_type)
|
|
356
|
-
|
|
357
|
-
result = postprocess_booking_confirmation(result)
|
|
356
|
+
|
|
358
357
|
return result, llm_client.model_id
|
|
359
358
|
|
|
360
359
|
|
|
@@ -373,13 +372,14 @@ def combine_llm_results_w_doc_ai(
|
|
|
373
372
|
Returns:
|
|
374
373
|
combined result
|
|
375
374
|
"""
|
|
376
|
-
result =
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
result = remove_none_values(llm)
|
|
376
|
+
|
|
377
|
+
docAi = doc_ai.copy()
|
|
378
|
+
if not docAi:
|
|
379
379
|
return result
|
|
380
380
|
|
|
381
381
|
# Merge top-level keys
|
|
382
|
-
result.update({k: v for k, v in
|
|
382
|
+
result.update({k: v for k, v in docAi.items() if k not in result})
|
|
383
383
|
|
|
384
384
|
if (
|
|
385
385
|
input_doc_type
|
|
@@ -387,28 +387,28 @@ def combine_llm_results_w_doc_ai(
|
|
|
387
387
|
and keys_to_combine
|
|
388
388
|
):
|
|
389
389
|
result.update(
|
|
390
|
-
{key:
|
|
390
|
+
{key: docAi.get(key) for key in keys_to_combine if key in docAi.keys()}
|
|
391
391
|
)
|
|
392
392
|
return result
|
|
393
393
|
|
|
394
394
|
# Handle specific key-based merging logic for multiple keys
|
|
395
395
|
if keys_to_combine:
|
|
396
396
|
for key in keys_to_combine:
|
|
397
|
-
if key in
|
|
397
|
+
if key in docAi.keys():
|
|
398
398
|
# Merge the list of dictionaries
|
|
399
|
-
# If the length of the
|
|
400
|
-
if len(
|
|
401
|
-
result[key] =
|
|
399
|
+
# If the length of the docAi list is less than the LLM result, replace with the docAi list
|
|
400
|
+
if len(docAi[key]) < len(result[key]):
|
|
401
|
+
result[key] = docAi[key]
|
|
402
402
|
else:
|
|
403
|
-
# If the length of the
|
|
403
|
+
# If the length of the docAi list is greater than or equal to the LLM result,
|
|
404
404
|
# add & merge the dictionaries
|
|
405
|
-
if isinstance(
|
|
406
|
-
for i in range(len(
|
|
405
|
+
if isinstance(docAi[key], list):
|
|
406
|
+
for i in range(len(docAi[key])):
|
|
407
407
|
if i == len(result[key]):
|
|
408
|
-
result[key].append(
|
|
408
|
+
result[key].append(docAi[key][i])
|
|
409
409
|
else:
|
|
410
|
-
for sub_key in
|
|
411
|
-
result[key][i][sub_key] =
|
|
410
|
+
for sub_key in docAi[key][i].keys():
|
|
411
|
+
result[key][i][sub_key] = docAi[key][i][sub_key]
|
|
412
412
|
return result
|
|
413
413
|
|
|
414
414
|
|
|
@@ -502,13 +502,15 @@ async def data_extraction_manual_flow(
|
|
|
502
502
|
page_count = None
|
|
503
503
|
# Validate the file type
|
|
504
504
|
if mime_type == "application/pdf":
|
|
505
|
+
if_use_docai = params["if_use_docai"]
|
|
506
|
+
|
|
505
507
|
# Enable Doc Ai only for certain document types.
|
|
506
|
-
if_use_docai
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
508
|
+
if params["if_use_docai"]:
|
|
509
|
+
if_use_docai = (
|
|
510
|
+
True
|
|
511
|
+
if meta.documentTypeCode in params["model_config"]["stable"]
|
|
512
|
+
else False
|
|
513
|
+
)
|
|
512
514
|
|
|
513
515
|
(
|
|
514
516
|
extracted_data,
|
|
@@ -520,7 +522,7 @@ async def data_extraction_manual_flow(
|
|
|
520
522
|
meta.documentTypeCode,
|
|
521
523
|
processor_client,
|
|
522
524
|
if_use_docai=if_use_docai,
|
|
523
|
-
if_use_llm=if_use_llm,
|
|
525
|
+
if_use_llm=params["if_use_llm"],
|
|
524
526
|
llm_client=llm_client,
|
|
525
527
|
isBetaTest=False,
|
|
526
528
|
)
|
src/postprocessing/common.py
CHANGED
|
@@ -723,10 +723,45 @@ async def format_all_entities(result, document_type_code, params, mime_type):
|
|
|
723
723
|
if document_type_code in ["partnerInvoice", "bundeskasse"]:
|
|
724
724
|
await process_partner_invoice(params, aggregated_data, document_type_code)
|
|
725
725
|
|
|
726
|
+
if document_type_code in ["bookingConfirmation"]:
|
|
727
|
+
aggregated_data["legalEntity"] = await get_legal_entity(
|
|
728
|
+
aggregated_data.get("carrierName", {}).get("documentValue", None),
|
|
729
|
+
aggregated_data.get("carrierAddress", {}).get("documentValue", None),
|
|
730
|
+
)
|
|
731
|
+
|
|
726
732
|
logger.info("Data Extraction completed successfully")
|
|
727
733
|
return aggregated_data
|
|
728
734
|
|
|
729
735
|
|
|
736
|
+
async def get_legal_entity(name, address):
|
|
737
|
+
"""Get legal entity mapping from TMS mappings.
|
|
738
|
+
|
|
739
|
+
Args:
|
|
740
|
+
name (str): The name of the legal entity. Mandatory.
|
|
741
|
+
address (str): The address of the legal entity. Optional for better matching.
|
|
742
|
+
|
|
743
|
+
Returns:
|
|
744
|
+
dict or None: The mapping result from TMS embeddings, or None if not found.
|
|
745
|
+
"""
|
|
746
|
+
# Name is mandatory for legal entity mapping
|
|
747
|
+
if not name:
|
|
748
|
+
return {"documentValue": None, "mappedValue": None}
|
|
749
|
+
|
|
750
|
+
# Build input safely
|
|
751
|
+
input_text = name if not address else f"{name} | {address}"
|
|
752
|
+
|
|
753
|
+
api_results = await get_tms_mappings(
|
|
754
|
+
input_list=[input_text],
|
|
755
|
+
embedding_type="legal_entities",
|
|
756
|
+
input_key="partnerNameAddress",
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
return {
|
|
760
|
+
"documentValue": None,
|
|
761
|
+
"formattedValue": api_results.get(input_text),
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
|
|
730
765
|
def add_text_without_space(text):
|
|
731
766
|
"""If the cleaned text is different from the original text, append it.
|
|
732
767
|
Useful for port names like QUINHON - Quinhon"""
|
|
@@ -1,32 +1,146 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "OBJECT",
|
|
3
3
|
"properties": {
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
"bookingNumber": {
|
|
5
|
+
"type": "STRING",
|
|
6
|
+
"nullable": true,
|
|
7
|
+
"description": "A unique identifier assigned to the shipment booking, used for tracking and reference. They are often referred to as 'Booking No.', 'Booking Reference', 'Our Reference', or 'Order Ref'."
|
|
8
|
+
},
|
|
9
|
+
"contractNumber": {
|
|
10
|
+
"type": "STRING",
|
|
11
|
+
"nullable": true,
|
|
12
|
+
"description": "It's a contract number between the carrier and Forto Logistics SE & Co KG."
|
|
13
|
+
},
|
|
14
|
+
"pickUpTerminalCode": {
|
|
15
|
+
"type": "STRING",
|
|
16
|
+
"nullable": true,
|
|
17
|
+
"description": "The specific terminal for cargo pickup during the import shipment."
|
|
18
|
+
},
|
|
19
|
+
"gateInTerminalCode": {
|
|
20
|
+
"type": "STRING",
|
|
21
|
+
"nullable": true,
|
|
22
|
+
"description": "The specific terminal where cargo is gated in especially Export terminal delivery address. E.g., Export terminal delivery address, Export terminal location, or Export terminal name."
|
|
23
|
+
},
|
|
24
|
+
"performaDate": {
|
|
25
|
+
"type": "STRING",
|
|
26
|
+
"nullable": true,
|
|
27
|
+
"description": "The date considered to apply the rates and charges specified in the booking confirmation"
|
|
28
|
+
},
|
|
29
|
+
"cyCutOff": {
|
|
30
|
+
"type": "STRING",
|
|
31
|
+
"nullable": true,
|
|
32
|
+
"description": "The datetime by which the cargo to be delivered to the Container Yard. It can be found with keys FCL delivery cut-off, FCL DG delivery cut-off, CY CUT OFF, CY Closing."
|
|
33
|
+
},
|
|
34
|
+
"gateInReference": {
|
|
35
|
+
"type": "STRING",
|
|
36
|
+
"nullable": true,
|
|
37
|
+
"description": "A reference code for cargo entering the terminal to drop the loaded cargo for Export. Sometimes it can be 'Our Reference'."
|
|
38
|
+
},
|
|
39
|
+
"mblNumber": {
|
|
40
|
+
"type": "STRING",
|
|
41
|
+
"nullable": true,
|
|
42
|
+
"description": "Bill of Lading number (B/L NO.), a document issued by the carrier."
|
|
43
|
+
},
|
|
44
|
+
"pickUpReference": {
|
|
45
|
+
"type": "STRING",
|
|
46
|
+
"nullable": true,
|
|
47
|
+
"description": "A reference code for cargo pickup during the import shipment. Sometimes it can be 'Our Reference'."
|
|
48
|
+
},
|
|
49
|
+
"siCutOff": {
|
|
50
|
+
"type": "STRING",
|
|
51
|
+
"nullable": true,
|
|
52
|
+
"description": "The deadline datetime for submitting the Shipping Instructions (SI) to the carrier. It can be found with keys Shipping Instruction Closing."
|
|
53
|
+
},
|
|
54
|
+
"vgmCutOff": {
|
|
55
|
+
"type": "STRING",
|
|
56
|
+
"nullable": true,
|
|
57
|
+
"description": "The deadline datetime for submitting the Verified Gross Mass (VGM) to the carrier. It can be found with keys VGM DEADLINE, VGM DUE, VGM CUT OFF."
|
|
58
|
+
},
|
|
59
|
+
"containers": {
|
|
60
|
+
"type": "ARRAY",
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "OBJECT",
|
|
63
|
+
"properties": {
|
|
64
|
+
"containerType": {
|
|
65
|
+
"type": "STRING",
|
|
66
|
+
"nullable": true,
|
|
67
|
+
"description": "The size / type of the container, such as 20ft, 40ft, 40HC, 20DC etc under Type/Size column."
|
|
68
|
+
},
|
|
69
|
+
"pickUpDepotCode": {
|
|
70
|
+
"type": "STRING",
|
|
71
|
+
"nullable": true,
|
|
72
|
+
"description": "The depot code where the empty container will be picked up. It is identified as Empty Pick Up Depot or Export Empty Pick Up Depot(s)."
|
|
73
|
+
},
|
|
74
|
+
"dropOffDepotCode": {
|
|
75
|
+
"type": "STRING",
|
|
76
|
+
"nullable": true,
|
|
77
|
+
"description": "The depot code where the empty container will be dropped off."
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": ["containerType", "pickupDepotCode", "dropoffDepotCode"]
|
|
82
|
+
},
|
|
14
83
|
"transportLegs": {
|
|
15
84
|
"type": "ARRAY",
|
|
16
85
|
"items": {
|
|
17
86
|
"type": "OBJECT",
|
|
18
87
|
"properties": {
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
88
|
+
"eta": {
|
|
89
|
+
"type": "STRING",
|
|
90
|
+
"nullable": true,
|
|
91
|
+
"description": "Estimated Time of Arrival (ETA) is the expected date when the shipment will arrive at its destination."
|
|
92
|
+
},
|
|
93
|
+
"etd": {
|
|
94
|
+
"type": "STRING",
|
|
95
|
+
"nullable": true,
|
|
96
|
+
"description": "Estimated Time of Departure (ETD) is the expected date when the shipment will leave the origin port."
|
|
97
|
+
},
|
|
98
|
+
"imoNumber": {
|
|
99
|
+
"type": "STRING",
|
|
100
|
+
"nullable": true,
|
|
101
|
+
"description": "The International Maritime Organization number for a specific leg. It can be found as IMO No, IMO number."
|
|
102
|
+
},
|
|
103
|
+
"portOfDischarge": {
|
|
104
|
+
"type": "STRING",
|
|
105
|
+
"nullable": true,
|
|
106
|
+
"description": "The port where the goods are discharged from the vessel. This is the destination port for the shipment. It can be found at POD, Port of Discharge, To, Discharge Port"
|
|
107
|
+
},
|
|
108
|
+
"portOfLoading": {
|
|
109
|
+
"type": "STRING",
|
|
110
|
+
"nullable": true,
|
|
111
|
+
"description": "The port where the goods are loaded onto the vessel. This is the origin port for the shipment. It can be found at POL, Port of Loading, From, Load Port"
|
|
112
|
+
},
|
|
113
|
+
"vesselName": {
|
|
114
|
+
"type": "STRING",
|
|
115
|
+
"nullable": true,
|
|
116
|
+
"description": "The name of the vessel carrying the shipment. It can be found at vessel, INTENDED VESSEL/VOYAGE"
|
|
117
|
+
},
|
|
118
|
+
"voyage": {
|
|
119
|
+
"type": "STRING",
|
|
120
|
+
"nullable": true,
|
|
121
|
+
"description": "The journey or route taken by the vessel for a specific leg. It can be found at Voy. no, INTENDED VESSEL/VOYAGE"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"required": [
|
|
126
|
+
"eta",
|
|
127
|
+
"etd",
|
|
128
|
+
"portOfDischarge",
|
|
129
|
+
"portOfLoading",
|
|
130
|
+
"vesselName",
|
|
131
|
+
"voyage"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"carrierAddress": {
|
|
135
|
+
"type": "STRING",
|
|
136
|
+
"nullable": true,
|
|
137
|
+
"description": "The address of the carrier who provides service and issued the document."
|
|
138
|
+
},
|
|
139
|
+
"carrierName": {
|
|
140
|
+
"type": "STRING",
|
|
141
|
+
"nullable": true,
|
|
142
|
+
"description": "The name of the carrier who issued the document e,g, Hapag-Lloyd."
|
|
29
143
|
}
|
|
30
144
|
},
|
|
31
|
-
"required": []
|
|
145
|
+
"required": ["bookingNumber", "transportLegs", "containers", "cyCutOff", "vgmCutOff", "siCutOff"]
|
|
32
146
|
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 Booking Confirmation documents as per the given response schema structure. <TASK>
|
|
4
|
+
|
|
5
|
+
<CONTEXT>
|
|
6
|
+
The Freight Forwarding company receives Booking Confirmation from EverGreen Carrier (Shipping Lines) partner.
|
|
7
|
+
These Booking Confirmations contain various details related to booking, container pick up and drop off depot details, vessel details, as well as other transport Legs 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 Booking Confirmations to support efficient processing and accurate record-keeping.
|
|
10
|
+
<CONTEXT>
|
|
11
|
+
|
|
4
12
|
"mblNumber": "Extract the value after the label 'BOOKING NO.'.",
|
|
5
13
|
"gateInReference": "Extract the value after the label 'BOOKING NO.'.",
|
|
6
14
|
"pickUpReference": "Extract the value after the label 'BOOKING NO.'.",
|
|
@@ -14,23 +22,19 @@ your task is to extract the text value of the following entities and page number
|
|
|
14
22
|
"portOfDischarge": "Extract the text after the label 'PORT OF DISCHARGING:' and before 'FINAL DESTINATION'.",
|
|
15
23
|
"pickUpTerminal": "Extract the text after the label 'EMPTY PICK UP AT:' removing any extra spaces or line breaks.",
|
|
16
24
|
"gateInTerminal": "Extract the text after the label 'FULL RETURN TO:' removing any extra spaces or line breaks.",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"portOfLoading": "For the first leg, use the extracted 'portOfLoading'.",
|
|
20
|
-
"portOfDischarge": "Extract the text after the label 'T/S PORT OF LOADING:'.",
|
|
21
|
-
"vesselName": "For the first leg, use the extracted 'vesselName'.",
|
|
22
|
-
"voyage": "Voyage is a code of numbers and letters sometimes separated by '-'. For the first leg, use the extracted 'voyage'.",
|
|
23
|
-
"eta": "Extract the date after the label 'ETA DATE' that appears within the section starting with 'FINAL DESTINATION:' and ending with 'T/S PORT OF LOADING:'.",
|
|
24
|
-
"etd": "Extract the date after the label 'ETD DATE' that appears within the section starting with 'PORT OF LOADING:' and ending with 'FINAL DESTINATION:'.",
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
"transportLegs":
|
|
27
|
+
"portOfLoading": "For the first leg, use the extracted 'portOfLoading'.",
|
|
28
|
+
"portOfDischarge": "Extract the text after the label 'T/S PORT OF LOADING:'.",
|
|
29
|
+
"vesselName": "For the first leg, use the extracted 'vesselName'.",
|
|
30
|
+
"voyage": "Voyage is a code of numbers and letters sometimes separated by '-'. For the first leg, use the extracted 'voyage'.",
|
|
31
|
+
"eta": "Extract the date after the label 'ETA DATE' that appears within the section starting with 'FINAL DESTINATION:' and ending with 'T/S PORT OF LOADING:'.",
|
|
32
|
+
"etd": "Extract the date after the label 'ETD DATE' that appears within the section starting with 'PORT OF LOADING:' and ending with 'FINAL DESTINATION:'.",
|
|
33
|
+
|
|
34
|
+
|
|
27
35
|
"portOfLoading": "For the second leg, use the 'portOfDischarge' from the previous leg.",
|
|
28
36
|
"portOfDischarge": "For the second leg, use the extracted 'portOfDischarge' from the main extraction.",
|
|
29
37
|
"vesselName": "Extract the text after the label 'EST. CONNECT VSL/VOY:' and before the hyphen and numbers.",
|
|
30
38
|
"voyage": "Voyage is a code of numbers and letters sometimes separated by '-'. Extract the code after the label 'EST. CONNECT VSL/VOY:' and after the vessel name.",
|
|
31
39
|
"eta": "Extract the date after the label 'ETA DATE' that is after the line that contains 'T/S PORT OF LOADING'",
|
|
32
40
|
"etd": "Extract the date after the label 'ETD DATE' that is related to the 'EST. CONNECT VSL/VOY:'. "
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
```
|