Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement safety endpoint #5

Open
kjappelbaum opened this issue Jul 15, 2024 · 1 comment
Open

implement safety endpoint #5

kjappelbaum opened this issue Jul 15, 2024 · 1 comment

Comments

@kjappelbaum
Copy link
Collaborator

to implement access to safety information from PubChem

@kjappelbaum
Copy link
Collaborator Author

For GHS

import re
import pubchempy as pcp 
import requests

canon_smiles = get_canonical_smiles(input)
cid = pcp.get_compounds(smiles, "smiles")[0].cid
# regex GHS pictograms
regex_ghs = "GHS[0-9]{2}"
request_json = requests.get(
    f"https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/data/compound/{cid}/JSON/?response_type=display&heading=GHS%20Classification"
).json()
import regex as re
return str(re.findall(regex_ghs, request_json))
        ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant