Using the library

For developers who read safety data sheets from a Python program. Whoever only runs the command needs none of this and reads Using the command line instead.

Page

What it covers

Getting started

installing the package and reading a first file

A reading and its parts

what read_sheet returns, for a sheet and for any other file; a reading as JSON

Messages and catalogs

warnings, errors and findings as codes; sentences in a language of your choice

Judging a sheet

findings, the classification, whether the product needs a sheet

Statements and pictograms

the label’s statements with the regulation’s wording; pictograms from H codes

Keeping texts

storing the text of a PDF, reading from it again, and the two stage versions

Which sheet is the current one

choosing among several sheets of one product

Embedded data

the eSDScom file some PDFs carry

The JSON schema

the description of a record, shipped in the package

What is promised

which names, codes and shapes you can build on

Asking a language model, comparing two runs and the report for people (sdb-reader ask, diff and show) are features of the command line: the package exports no names for them, and the modules behind them can change without notice. They are described in Asking a language model, Comparing two runs and Showing sheets as a report.

How it works describes the path of a file through the library. The reference lists every exported name with its signature and description, made from the descriptions in the code.

The Python examples on these pages are run by the test suite. They build on one another in the order of the table: path, reading and sheet are made in Getting started and used on the pages after it. Which sheet is the current one stands on its own.