Skip to main content
Tungsten

Tungsten

A material safety data sheet parser.

Installation

Tungsten is available on PyPi via pip. To install, run the following command:

pip install tungsten-sds

Usage Example

import json
from pathlib import Path

from tungsten import SigmaAldrichSdsParser, SdsQueryFieldName, \
    SigmaAldrichFieldMapper

sds_parser = SigmaAldrichSdsParser()
sds_path = Path("CERILLIAN_L-001.pdf")

# Convert PDF file to parsed data
with open(sds_path, "rb") as f:
    sds = sds_parser.parse_to_ghs_sds(f)

field_mapper = SigmaAldrichFieldMapper()

fields = [
    SdsQueryFieldName.PRODUCT_NAME,
    SdsQueryFieldName.PRODUCT_NUMBER,
    SdsQueryFieldName.CAS_NUMBER,
    SdsQueryFieldName.PRODUCT_BRAND,
    SdsQueryFieldName.RECOMMENDED_USE_AND_RESTRICTIONS,
    SdsQueryFieldName.SUPPLIER_ADDRESS,
    SdsQueryFieldName.SUPPLIER_TELEPHONE,
    SdsQueryFieldName.SUPPLIER_FAX,
    SdsQueryFieldName.EMERGENCY_TELEPHONE,
    SdsQueryFieldName.IDENTIFICATION_OTHER,
    SdsQueryFieldName.SUBSTANCE_CLASSIFICATION,
    SdsQueryFieldName.PICTOGRAM,
    SdsQueryFieldName.SIGNAL_WORD,
    SdsQueryFieldName.STATEMENTS,
    SdsQueryFieldName.HNOC_HAZARD,
]

# Serialize parsed data to JSON and dump to a file
with open(sds_path.stem + ".json", "w") as f:
    sds.dump(f)
    # Also print out mapped fields
    for field in fields:
        print(field.name, field_mapper.get_field(field, json.loads(sds.dumps())))

License

This work is licensed under MIT. Media assets in the assets directory are licensed under a Creative Commons Attribution-NoDerivatives 4.0 International Public License.

Notes

This library currently comes bundled with a new build of tabula-java, which is also licensed under MIT, to see the full license, see https://github.com/tabulapdf/tabula-java/blob/master/LICENSE.

Metadata

Release files for tungsten-sds 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tungsten-sds 0.8.0
File Size Uploaded Provenance Actions
tungsten_sds-0.8.0.tar.gz 12.4 MB Without provenance Details for tungsten_sds-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tungsten-sds 0.8.0
File Interpreter ABI Platform Actions
tungsten_sds-0.8.0-py3-none-any.whl Python 3 none any Details for tungsten_sds-0.8.0-py3-none-any.whl

Total release size: 24.7 MB

Release files / tungsten_sds-0.8.0.tar.gz

Download URL tungsten_sds-0.8.0.tar.gz
Size 12.4 MB
Tags Source
SHA-256 checksum
How to use checksums
65d3d11768036bbdb2a65a8a06cb5b08e81091b7b3a9ca35a670096d36f9345c
BLAKE2b-256 checksum
How to use checksums
8ef0d61b3a1af1838c479d060c5dc68a5bd20876f0fbfbee6db3742b518b97ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.2 Linux/5.15.0-1034-azure

Release files / tungsten_sds-0.8.0-py3-none-any.whl

Download URL tungsten_sds-0.8.0-py3-none-any.whl
Size 12.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
de1ec38287e0a315fda837f34fd125899428fcff4fe7125c1868fcb45fecfceb
BLAKE2b-256 checksum
How to use checksums
3bfafff50d3393a579d0f16fe612cc58bef1826d93a29ecdd53d900498256925
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.2 Linux/5.15.0-1034-azure

Security for tungsten-sds 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page