-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
174 lines (166 loc) · 5.11 KB
/
Copy pathmain.py
File metadata and controls
174 lines (166 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
from argparse import ArgumentParser
from pathlib import Path
from biometric_extractor.config import PipelineConfig
from biometric_extractor.pipeline import ExtractionPipeline
def build_args():
parser = ArgumentParser(
description=(
"Extract biological outbreak information from URLs listed in "
"Excel into location-based outbreak records, where `location` "
"may be a single place or a semicolon-joined aggregated multi-"
"place scope, using local DeepSeek-V3 endpoint, with "
"standardized event_type classification labels."
)
)
parser.add_argument(
"--input",
type=str,
default=(
"C:/Users/imcas/Desktop/"
"Detailed_Biometric_Information_Extraction"
"/source_text_report_gvn.xlsx"
),
help=(
"Input Excel path (must include columns: data_source, "
"source_url)."
),
)
parser.add_argument(
"--output-excel",
type=str,
default=(
"C:/Users/imcas/Desktop/"
"Detailed_Biometric_Information_Extraction/out"
"/biometric_extracted_result.xlsx"
),
help=(
"Output Excel path for location-based outbreak records "
"with standardized event_type values and semicolon-joined "
"multi-place locations when counts are aggregated."
),
)
parser.add_argument(
"--output-csv",
type=str,
default=(
"C:/Users/imcas/Desktop/"
"Detailed_Biometric_Information_Extraction/out"
"/biometric_extracted_result.csv"
),
help=(
"Output CSV path for location-based outbreak records "
"with standardized event_type values and semicolon-joined "
"multi-place locations when counts are aggregated."
),
)
parser.add_argument(
"--log-file",
type=str,
default=(
"C:/Users/imcas/Desktop/"
"Detailed_Biometric_Information_Extraction/out/logs"
"/pipeline.log"
),
help="Log file path.",
)
parser.add_argument(
"--status-excel",
type=str,
default=(
"C:/Users/imcas/Desktop/"
"Detailed_Biometric_Information_Extraction/out"
"/extraction_runtime_status.xlsx"
),
help="Runtime status Excel path for concise frontend display records.",
)
parser.add_argument(
"--status-csv",
type=str,
default=(
"C:/Users/imcas/Desktop/"
"Detailed_Biometric_Information_Extraction/out"
"/extraction_runtime_status.csv"
),
help="Runtime status CSV path for concise frontend display records.",
)
parser.add_argument(
"--endpoint",
type=str,
default="http://159.226.80.101:1045/v1/chat/completions",
help="Local LLM endpoint.",
)
parser.add_argument(
"--model",
type=str,
default="DeepSeek-V3",
help="Model name.",
)
parser.add_argument(
"--timeout-seconds",
type=int,
default=600,
help="HTTP timeout (seconds) for web and LLM calls.",
)
parser.add_argument(
"--max-retries",
type=int,
default=3,
help="Retry count for LLM call failures.",
)
parser.add_argument(
"--max-chars-per-source",
type=int,
default=30000,
help="Max characters for body/table text sent to LLM.",
)
parser.add_argument(
"--request-interval-seconds",
type=float,
default=0.2,
help="Sleep interval between URL tasks to reduce burst load.",
)
parser.add_argument(
"--limit",
type=int,
default=0,
help="Process only first N URLs (0 means all).",
)
parser.add_argument(
"--record-data-type",
type=str,
default="",
help=(
"Override runtime status table data type, e.g. "
"unstructured/semi-structured/structured."
),
)
parser.add_argument(
"--record-access-method",
type=str,
default="",
help="Override runtime status table access method, e.g. crawl/API.",
)
return parser.parse_args()
def main() -> None:
args = build_args()
config = PipelineConfig(
input_excel=Path(args.input),
output_excel=Path(args.output_excel),
output_csv=Path(args.output_csv),
log_file=Path(args.log_file),
status_excel=Path(args.status_excel),
status_csv=Path(args.status_csv),
llm_endpoint=args.endpoint,
llm_model=args.model,
record_data_type=args.record_data_type,
record_access_method=args.record_access_method,
timeout_seconds=args.timeout_seconds,
max_chars_per_source=args.max_chars_per_source,
max_retries=args.max_retries,
request_interval_seconds=args.request_interval_seconds,
limit=args.limit,
)
pipeline = ExtractionPipeline(config)
pipeline.run()
if __name__ == "__main__":
main()