sdb-reader 0.9.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.
- sdb_reader/__init__.py +157 -0
- sdb_reader/ask.py +437 -0
- sdb_reader/ask_record.schema.json +388 -0
- sdb_reader/cli.py +1079 -0
- sdb_reader/clp_statements_de.json +997 -0
- sdb_reader/compliance.py +546 -0
- sdb_reader/current.py +134 -0
- sdb_reader/diff.py +520 -0
- sdb_reader/embedded.py +250 -0
- sdb_reader/extraction.py +506 -0
- sdb_reader/layout.py +894 -0
- sdb_reader/line_breaks.py +40 -0
- sdb_reader/messages.py +394 -0
- sdb_reader/messages_data/de.toml +146 -0
- sdb_reader/messages_data/en.toml +141 -0
- sdb_reader/model.py +321 -0
- sdb_reader/parser.py +4601 -0
- sdb_reader/pictograms.py +374 -0
- sdb_reader/presets.py +110 -0
- sdb_reader/presets.toml +23 -0
- sdb_reader/py.typed +0 -0
- sdb_reader/read_record.schema.json +792 -0
- sdb_reader/reading.py +94 -0
- sdb_reader/scan.py +265 -0
- sdb_reader/schema.py +96 -0
- sdb_reader/serialise.py +463 -0
- sdb_reader/show.py +370 -0
- sdb_reader/statements.py +1011 -0
- sdb_reader/verification.py +322 -0
- sdb_reader/versions.py +31 -0
- sdb_reader-0.9.0.dist-info/METADATA +117 -0
- sdb_reader-0.9.0.dist-info/RECORD +37 -0
- sdb_reader-0.9.0.dist-info/WHEEL +5 -0
- sdb_reader-0.9.0.dist-info/entry_points.txt +2 -0
- sdb_reader-0.9.0.dist-info/licenses/LICENSE +661 -0
- sdb_reader-0.9.0.dist-info/licenses/NOTICE +40 -0
- sdb_reader-0.9.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/foerdebaumarkt/sdb-reader/blob/main/src/sdb_reader/ask_record.schema.json",
|
|
4
|
+
"title": "One record of what `sdb-reader ask` prints",
|
|
5
|
+
"description": "The command prints a JSON array with one such record per file, or writes one a line with --output (SDW-26). A record says whether a model was asked about the file; where it was, how many sheets the file holds, what was sent, what the model answered, and the answer in the form `read` gives a sheet, so that `diff` can set the two beside each other. A file the request failed for is named on stderr and has no record.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"file",
|
|
10
|
+
"kind",
|
|
11
|
+
"asked"
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"file": {
|
|
15
|
+
"$ref": "#/$defs/file"
|
|
16
|
+
},
|
|
17
|
+
"kind": {
|
|
18
|
+
"enum": [
|
|
19
|
+
"safety-data-sheet",
|
|
20
|
+
"safety-information",
|
|
21
|
+
"safety-data-sheet-other-language",
|
|
22
|
+
"document"
|
|
23
|
+
],
|
|
24
|
+
"description": "What the file is, by the reader's verdict. A model is asked only about a safety-data-sheet: a German one."
|
|
25
|
+
},
|
|
26
|
+
"asked": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"description": "Whether a model was asked about the file."
|
|
29
|
+
},
|
|
30
|
+
"reason": {
|
|
31
|
+
"$ref": "#/$defs/message",
|
|
32
|
+
"description": "Why no model was asked. Only where asked is false."
|
|
33
|
+
},
|
|
34
|
+
"model": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "The model's name at the endpoint."
|
|
37
|
+
},
|
|
38
|
+
"sheet_count": {
|
|
39
|
+
"type": "integer",
|
|
40
|
+
"minimum": 1,
|
|
41
|
+
"description": "How many safety data sheets the file holds. Each is asked about with a request of its own."
|
|
42
|
+
},
|
|
43
|
+
"sent": {
|
|
44
|
+
"enum": [
|
|
45
|
+
"before-section-3",
|
|
46
|
+
"pages",
|
|
47
|
+
"sheet"
|
|
48
|
+
],
|
|
49
|
+
"description": "Which part of the file's text was sent: from its beginning up to the heading of section 3, or the first pages where no such heading was found. For a file with several sheets, or with a cover page in front of its sheet: before-section-3 where every sheet went up to its own heading of section 3, sheet where at least one went whole. A cover page is never sent."
|
|
50
|
+
},
|
|
51
|
+
"stage": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"description": "The reading stage the text sent comes from, as extraction_stage() names it."
|
|
54
|
+
},
|
|
55
|
+
"question": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"pattern": "^[0-9a-f]{12}$",
|
|
58
|
+
"description": "A fingerprint of the instructions, which are the same for every file. Answers with another fingerprint are answers to another question."
|
|
59
|
+
},
|
|
60
|
+
"preset": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "The preset the request's fields come from. Only where --preset named one."
|
|
63
|
+
},
|
|
64
|
+
"request": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"description": "The fields added to the request: those of the preset, with those of --request-json on top. Only where there were any."
|
|
67
|
+
},
|
|
68
|
+
"usage": {
|
|
69
|
+
"$ref": "#/$defs/usage",
|
|
70
|
+
"description": "What the requests cost in tokens, for a file with several sheets all of them together. Only where the endpoint says."
|
|
71
|
+
},
|
|
72
|
+
"reading": {
|
|
73
|
+
"$ref": "#/$defs/reading",
|
|
74
|
+
"description": "For a file with several sheets the sheets' readings united: the codes of all in the order they first appear, the statements one sheet after the other, each on its line, supplier and date of the first sheet."
|
|
75
|
+
},
|
|
76
|
+
"answer": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"description": "The model's answer as it gave it. Its keys are the model's; the instructions ask for supplier, hazard_statements, precautionary_statements, supplemental_phrases and revision_date. Only for a file that is one sheet; the answers about several sheets stand under parts."
|
|
79
|
+
},
|
|
80
|
+
"parts": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"minItems": 2,
|
|
83
|
+
"description": "Only for a file with several sheets: what was sent and answered for each, in the file's order.",
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"required": [
|
|
88
|
+
"sent",
|
|
89
|
+
"reading",
|
|
90
|
+
"answer"
|
|
91
|
+
],
|
|
92
|
+
"properties": {
|
|
93
|
+
"sent": {
|
|
94
|
+
"enum": [
|
|
95
|
+
"before-section-3",
|
|
96
|
+
"sheet"
|
|
97
|
+
],
|
|
98
|
+
"description": "The sheet's text up to its own heading of section 3, or the whole sheet where it has none."
|
|
99
|
+
},
|
|
100
|
+
"usage": {
|
|
101
|
+
"$ref": "#/$defs/usage",
|
|
102
|
+
"description": "What this sheet's request cost in tokens. Only where the endpoint says."
|
|
103
|
+
},
|
|
104
|
+
"reading": {
|
|
105
|
+
"$ref": "#/$defs/reading"
|
|
106
|
+
},
|
|
107
|
+
"answer": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"description": "The model's answer about this sheet as it gave it."
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"$defs": {
|
|
116
|
+
"file": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"required": [
|
|
120
|
+
"path",
|
|
121
|
+
"filename",
|
|
122
|
+
"size_bytes"
|
|
123
|
+
],
|
|
124
|
+
"properties": {
|
|
125
|
+
"path": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"description": "The file's absolute path."
|
|
128
|
+
},
|
|
129
|
+
"filename": {
|
|
130
|
+
"type": "string"
|
|
131
|
+
},
|
|
132
|
+
"size_bytes": {
|
|
133
|
+
"type": "integer",
|
|
134
|
+
"minimum": 0
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"message": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"additionalProperties": false,
|
|
141
|
+
"required": [
|
|
142
|
+
"code",
|
|
143
|
+
"params",
|
|
144
|
+
"message"
|
|
145
|
+
],
|
|
146
|
+
"properties": {
|
|
147
|
+
"code": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"description": "What is noted. The same in every language; the codes are those of `read`."
|
|
150
|
+
},
|
|
151
|
+
"params": {
|
|
152
|
+
"type": "object"
|
|
153
|
+
},
|
|
154
|
+
"message": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"description": "The sentence, from the message catalog of the language chosen."
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"reading": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"additionalProperties": false,
|
|
163
|
+
"required": [
|
|
164
|
+
"revision_date",
|
|
165
|
+
"revision_date_named",
|
|
166
|
+
"hazard_statements",
|
|
167
|
+
"contact_info"
|
|
168
|
+
],
|
|
169
|
+
"description": "The model's answer under the names a `read` record's sheet has, as far as a model is asked.",
|
|
170
|
+
"properties": {
|
|
171
|
+
"revision_date": {
|
|
172
|
+
"type": [
|
|
173
|
+
"string",
|
|
174
|
+
"null"
|
|
175
|
+
],
|
|
176
|
+
"format": "date",
|
|
177
|
+
"description": "The date of revision the model named, where the string it named stands in the text sent and is a date; null otherwise."
|
|
178
|
+
},
|
|
179
|
+
"revision_date_named": {
|
|
180
|
+
"type": [
|
|
181
|
+
"string",
|
|
182
|
+
"null"
|
|
183
|
+
],
|
|
184
|
+
"description": "The string the model named as the date of revision, whether or not it held up."
|
|
185
|
+
},
|
|
186
|
+
"hazard_statements": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"additionalProperties": false,
|
|
189
|
+
"required": [
|
|
190
|
+
"hazard_codes",
|
|
191
|
+
"precautionary_codes",
|
|
192
|
+
"supplemental_codes",
|
|
193
|
+
"hazard_text",
|
|
194
|
+
"precautionary_text",
|
|
195
|
+
"supplemental_text"
|
|
196
|
+
],
|
|
197
|
+
"properties": {
|
|
198
|
+
"hazard_codes": {
|
|
199
|
+
"type": "array",
|
|
200
|
+
"items": {
|
|
201
|
+
"type": "string"
|
|
202
|
+
},
|
|
203
|
+
"description": "The codes of the H statements in the model's order; a joined code is one entry."
|
|
204
|
+
},
|
|
205
|
+
"precautionary_codes": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"items": {
|
|
208
|
+
"type": "string"
|
|
209
|
+
},
|
|
210
|
+
"description": "The codes of the P statements; a joined code is one entry."
|
|
211
|
+
},
|
|
212
|
+
"supplemental_codes": {
|
|
213
|
+
"type": "array",
|
|
214
|
+
"items": {
|
|
215
|
+
"type": "string"
|
|
216
|
+
},
|
|
217
|
+
"description": "The codes of the EUH statements, also of one the model listed among the H statements."
|
|
218
|
+
},
|
|
219
|
+
"hazard_text": {
|
|
220
|
+
"type": [
|
|
221
|
+
"string",
|
|
222
|
+
"null"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"precautionary_text": {
|
|
226
|
+
"type": [
|
|
227
|
+
"string",
|
|
228
|
+
"null"
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
"supplemental_text": {
|
|
232
|
+
"type": [
|
|
233
|
+
"string",
|
|
234
|
+
"null"
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"contact_info": {
|
|
240
|
+
"type": "object",
|
|
241
|
+
"additionalProperties": false,
|
|
242
|
+
"required": [
|
|
243
|
+
"supplier_name",
|
|
244
|
+
"supplier_address",
|
|
245
|
+
"supplier_phone",
|
|
246
|
+
"supplier_email",
|
|
247
|
+
"supplier_website"
|
|
248
|
+
],
|
|
249
|
+
"properties": {
|
|
250
|
+
"supplier_name": {
|
|
251
|
+
"type": [
|
|
252
|
+
"string",
|
|
253
|
+
"null"
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"supplier_address": {
|
|
257
|
+
"type": [
|
|
258
|
+
"string",
|
|
259
|
+
"null"
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
"supplier_phone": {
|
|
263
|
+
"type": [
|
|
264
|
+
"string",
|
|
265
|
+
"null"
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
"supplier_email": {
|
|
269
|
+
"type": [
|
|
270
|
+
"string",
|
|
271
|
+
"null"
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
"supplier_website": {
|
|
275
|
+
"type": [
|
|
276
|
+
"string",
|
|
277
|
+
"null"
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"usage": {
|
|
285
|
+
"type": "object",
|
|
286
|
+
"additionalProperties": false,
|
|
287
|
+
"required": [
|
|
288
|
+
"prompt_tokens",
|
|
289
|
+
"completion_tokens"
|
|
290
|
+
],
|
|
291
|
+
"properties": {
|
|
292
|
+
"prompt_tokens": {
|
|
293
|
+
"type": [
|
|
294
|
+
"integer",
|
|
295
|
+
"null"
|
|
296
|
+
],
|
|
297
|
+
"minimum": 0
|
|
298
|
+
},
|
|
299
|
+
"completion_tokens": {
|
|
300
|
+
"type": [
|
|
301
|
+
"integer",
|
|
302
|
+
"null"
|
|
303
|
+
],
|
|
304
|
+
"minimum": 0
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"allOf": [
|
|
310
|
+
{
|
|
311
|
+
"if": {
|
|
312
|
+
"properties": {
|
|
313
|
+
"asked": {
|
|
314
|
+
"const": true
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
"required": [
|
|
318
|
+
"asked"
|
|
319
|
+
]
|
|
320
|
+
},
|
|
321
|
+
"then": {
|
|
322
|
+
"required": [
|
|
323
|
+
"model",
|
|
324
|
+
"sheet_count",
|
|
325
|
+
"sent",
|
|
326
|
+
"stage",
|
|
327
|
+
"question",
|
|
328
|
+
"reading"
|
|
329
|
+
],
|
|
330
|
+
"not": {
|
|
331
|
+
"required": [
|
|
332
|
+
"reason"
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
"oneOf": [
|
|
336
|
+
{
|
|
337
|
+
"properties": {
|
|
338
|
+
"sheet_count": {
|
|
339
|
+
"const": 1
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"required": [
|
|
343
|
+
"answer"
|
|
344
|
+
],
|
|
345
|
+
"not": {
|
|
346
|
+
"required": [
|
|
347
|
+
"parts"
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"properties": {
|
|
353
|
+
"sheet_count": {
|
|
354
|
+
"minimum": 2
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
"required": [
|
|
358
|
+
"parts"
|
|
359
|
+
],
|
|
360
|
+
"not": {
|
|
361
|
+
"required": [
|
|
362
|
+
"answer"
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
},
|
|
368
|
+
"else": {
|
|
369
|
+
"required": [
|
|
370
|
+
"reason"
|
|
371
|
+
],
|
|
372
|
+
"properties": {
|
|
373
|
+
"model": false,
|
|
374
|
+
"sent": false,
|
|
375
|
+
"stage": false,
|
|
376
|
+
"question": false,
|
|
377
|
+
"request": false,
|
|
378
|
+
"usage": false,
|
|
379
|
+
"reading": false,
|
|
380
|
+
"answer": false,
|
|
381
|
+
"sheet_count": false,
|
|
382
|
+
"preset": false,
|
|
383
|
+
"parts": false
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
]
|
|
388
|
+
}
|