msds-library
A python library for working with MSDS files.
Installing
pip install msds-tdm
Usage
import msds_tdm
print(msds_tdm.current_date_and_time())
OR
from msds_tdm import current_date_and_time
print(current_date_and_time())
('04/01/2022', '20:53:02')
Functions
extract_text_from_PDF(pdf_path)
This function returns all text from a PDF as a string. It requires the path of the PDF in order to find the text. It raises ValueError if file is not a PDF.
Args:
pdf_path (str): path of the PDF file
Raises:
ValueError: If file is not of PDF format
Returns:
str: all text found in the PDF
find_issue_revision_date(pdf_text, date_type)
This function finds date of issue or revision in the MSDS PDF. It returns N/A if date doesn't exist. It requires text of the PDF and type of date.
Args:
pdf_text (str): text in the PDF
date_type (str): {'Issue', 'Revision'}
Type of date required from the PDF
Raises:
ValueError: When type of date requested is incorrect
Returns:
str: issue or revision date as MM/DD/YYYY
current_date_and_time()
Returns current date and time as a tuple
Returns:
tuple: Returns current date and time as a tuple
find_index_of_substring(pdf_text, input_string)
This function returns the start and end index of the input_string found in the string_from_MSDS
Args:
pdf_text (str): main string from where index is returned
input_string (str): string treated as a substring
Returns:
list: start and end index of input_string found
find_substring(pdf_text, substr_type)
Finds names of product, catalog number, hazard details, and signal word in pdf_text, based on the substr_type given.
Args:
pdf_text (str): text in the PDF
substr_type (str): {'CAS', 'Product, 'Hazard', 'Signal Text', 'Signal Word'}
keyword to find substring of
Raises:
ValueError: When `substr_type` given is not supported
Returns:
str: words pertaining to the given `substr_type`
find_signal_word(pdf_text)
Finds signal word from text in the pdf
Args:
pdf_text (str): text in the pdf
Returns:
str: returns Danger or Warning when a hazardous substance exists. Otherwise, it returns No labeling applicable
return_list_of_hazards_in_MSDS(pdf_text)
finds list of hazards in the pdf after comparing from an existing database
Returns:
list: a list of all hazards that match with hazards in the existing database.
analyze_sigma_aldrich_sheet(pdf_path)
returns a summary of data found in the pdf as a dictionary
Args:
pdf_path (str): file path of the PDF
Raises:
ValueError: When incorrect arguments are passed to the functions.
Returns:
dict: This dictionary contains summary of the hazard related data found in the MSDS PDF.
Contributors
Credits
- Terri Bui
- Stephen Ma
- Dr. Mark Daniel Ward
- The Data Mine - website
Metadata
Release files for msds-tdm 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msds-tdm-1.0.3.tar.gz | 18.9 kB | Without provenance | Details for msds-tdm-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msds_tdm-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for msds_tdm-1.0.3-py3-none-any.whl |
Total release size: 37.2 kB
Release files / msds-tdm-1.0.3.tar.gz
| Download URL | msds-tdm-1.0.3.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7cf519d81d559c64c57af71eb555c50e5c35671a99355b7dd14c1c7953b893c
|
|
BLAKE2b-256 checksum How to use checksums |
9b6472153bc45ae22260f382f21761e527e4e876acedef998b1f973ad89ef365
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.0
|
Release files / msds_tdm-1.0.3-py3-none-any.whl
| Download URL | msds_tdm-1.0.3-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9495a7b8ff23af7f7b1ad8ff74414a20284bf13921ab79a055b7dd3792f0875e
|
|
BLAKE2b-256 checksum How to use checksums |
6de26030d69012bdc829154b31ca0cf818eeb4c41592250199ca64bb408b0109
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.0
|
Security for msds-tdm 1.0.3
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.