-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathworkflow.yaml
295 lines (295 loc) · 14.4 KB
/
workflow.yaml
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
main:
steps:
- dedup_by_id:
type: kafka-worker
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: dedup_by_id
source_topic:
- factiva-articles:
avro_val_schema_file: factiva-article-value.avsc
worker:
postgres:
host: postgres
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
pass: ${POSTGRES_PASSWORD}
database: postgres
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- unique-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next: language_detector
- language_detector:
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: language_detector
source_topic:
- unique-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
worker:
huggingface_model: papluca/xlm-roberta-base-language-detection
default_language: UNKNOWN
destination_topic_map:
- english-articles: en
- foreign-articles: ar,bg,de,el,es,fr,hi,it,ja,nl,pl,ru,th,ur,vi,zh
- unknown-language-articles: UNKNOWN
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- english-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
- foreign-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
- unknown-language-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next:
- machine_translator
- dedup_by_content
- machine_translator:
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: machine_translator
source_topic:
- foreign-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
worker:
huggingface_model_map:
- ar: Helsinki-NLP/opus-mt-ar-en
- bg: Helsinki-NLP/opus-mt-bg-en
- de: Helsinki-NLP/opus-mt-de-en
- el: Helsinki-NLP/opus-mt-tc-big-el-en
- es: Helsinki-NLP/opus-mt-es-en
- fr: Helsinki-NLP/opus-mt-fr-en
- hi: Helsinki-NLP/opus-mt-hi-en
- it: Helsinki-NLP/opus-mt-it-en
- ja: Helsinki-NLP/opus-mt-ja-en
- nl: Helsinki-NLP/opus-mt-nl-en
- pl: Helsinki-NLP/opus-mt-pl-en
- ru: Helsinki-NLP/opus-mt-ru-en
- th: Helsinki-NLP/opus-mt-th-en
- ur: Helsinki-NLP/opus-mt-ur-en
- vi: Helsinki-NLP/opus-mt-vi-en
- zh: Helsinki-NLP/opus-mt-zh-en
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- english-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next: dedup_by_content
- dedup_by_content:
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: dedup_by_content
source_topic:
- english-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
worker:
postgres:
host: postgres
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
pass: ${POSTGRES_PASSWORD}
database: postgres
batch_size: 1000
gpu_device: cuda
huggingface_model: sentence-transformers/all-MiniLM-L6-v2
paragraph_similarity_threshold: 0.85
content_similarty_threshold: 0.85
number_of_threads: 4
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- unique-english-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next: off_topic_filterer
- off_topic_filterer:
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: off_topic_filterer
source_topic:
- unique-english-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
worker:
huggingface_model: facebook/bart-large-mnli
labels: disaster,disease,health,illness,medical,medicine,outbreak,arts,business,entertainment,environment,fashion,music,politics,science,sports,technology,trade,traffic,war,weather,world
candidates: disaster,disease,illness,outbreak,war
threshold: 0.85
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- filtered-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
- off-topic-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next: topic_categorizer
- topic_categorizer:
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: topic_categorizer
source_topic:
- filtered-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
worker:
package: craft
ner_models: bc5cdr,ncbi_disease
destination_topic_map:
- relevant-articles: DISEASE,CHEMICAL
optional_destination_topic_map:
- pending-review-articles: AMINO_ACID,ANATOMICAL_SYSTEM,ANATOMY,CANCER,CELL,CELL_LINE,CELL_TYPE,CELLULAR_COMPONENT,CHEMICAL,DEVELOPING_ANATOMICAL_STRUCTURE,DISEASE,DNA,GENE_OR_GENE_PRODUCT,IMMATERIAL_ANATOMICAL_ENTITY,MULTI-TISSUE_STRUCTURE,ORGAN,ORGANISM,ORGANISM_SUBDIVISION,ORGANISM_SUBSTANCE,PATHOLOGICAL_FORMATION,PROBLEM,PROTEIN,RNA,SIMPLE_CHEMICAL,SPECIES,TISSUE
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- relevant-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
- pending-review-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
- trashed-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next:
- geo_locator
- human_reviewer
- human_reviewer:
sink:
topic: pending-review-articles
connector: pending-review
postgres:
host: postgres
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
pass: ${POSTGRES_PASSWORD}
database: postgres
table: pending_review
pk_fields: doc_id
command: CREATE TABLE IF NOT EXISTS pending_review(doc_id TEXT PRIMARY KEY, folder TEXT, headline TEXT, lead_para TEXT[], tail_para TEXT[], lang_id TEXT, lang_name TEXT, labels TEXT, bio_ner TEXT, ner TEXT, summary_text TEXT, is_reviewed BOOLEAN DEFAULT FALSE);
source:
topic_prefix: review-
connector: review-complete
postgres:
host: postgres
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
pass: ${POSTGRES_PASSWORD}
database: postgres
table: status
pk_fields: doc_id
command: CREATE TABLE IF NOT EXISTS status(sequence_id SERIAL PRIMARY KEY, doc_id TEXT, is_relevant BOOLEAN);
next:
- stream_processor
- stream_processor:
source_streams:
- pending_review_articles:
topic: pending-review-articles
- review_status:
topic: review-status
join:
- reviewed_relevant_articles:
streams: pending_review_articles,pending_review_articles
fields: doc_id,folder,headline,lead_para,tail_para,lang_id,lang_name,labels,bio_ner,ner,summary_text
match_fields: doc_id
condition: rs.is_relevant = TRUE
topic: reviewed-relevant-articles
- reviewed_transhed_articles:
streams: pending_review_articles,pending_review_articles
fields: doc_id,folder,headline,lead_para,tail_para,lang_id,lang_name,labels,bio_ner,ner,summary_text
match_fields: doc_id
condition: rs.is_relevant = TRUE
topic: review-trashed-articles
next:
- geo_locator
- geo_locator:
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: geo_locator
source_topic:
- relevant-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
- reviewed-relevant-articles:
avro_key_schema_file: reviewed-relevant-article-key.avsc
avro_val_schema_file: reviewed-relevant-article-val.avsc
worker:
ner_tags: GPE,LOC
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- geo-located-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next:
- summarizer
- summarizer:
consumer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 1.0
auto_offset_reset: earliest
consumer_group_id: summarizer
source_topic:
- geo-located-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
worker:
huggingface_model: facebook/bart-large-cnn
length_limit: 1024
producer:
bootstrap_servers: broker:${BROKER_INTERNAL_PORT}
schema_registry: http://schema-registry:${SCHEMA_REGISTRY_PORT}
poll_time: 0.0
destination_topic:
- summarized-articles:
avro_key_schema_file: unique-article-key.avsc
avro_val_schema_file: unique-article-val.avsc
next: end