72 lines
2.1 KiB
Python
72 lines
2.1 KiB
Python
import marimo
|
|
|
|
__generated_with = "0.16.5"
|
|
app = marimo.App(width="medium")
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
import marimo as mo
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
from pif_compiler.services.srv_echa import get_substance_index, get_dossier_info, search_substance, echa_flow
|
|
return get_dossier_info, get_substance_index, search_substance
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
cas = '63148-62-9'
|
|
return (cas,)
|
|
|
|
|
|
@app.cell
|
|
def _(cas, search_substance):
|
|
substance = search_substance(cas)
|
|
substance
|
|
return (substance,)
|
|
|
|
|
|
@app.cell
|
|
def _(get_dossier_info, substance):
|
|
substance_info = get_dossier_info(rmlId=substance['rmlId'])
|
|
substance_info
|
|
return (substance_info,)
|
|
|
|
|
|
@app.cell
|
|
def _(get_substance_index, substance_info):
|
|
get_substance_index(substance_info['assetExternalId'])
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(log):
|
|
import requests
|
|
|
|
BASE_SEARCH = "https://chem.echa.europa.eu/api-substance/v1/substance?pageIndex=1&pageSize=100&searchText="
|
|
BASE_DOSSIER = "https://chem.echa.europa.eu/api-dossier-list/v1/dossier?pageIndex=1&pageSize=100&rmlId="
|
|
SUBSTANCE_SUMMARY = "https://chem.echa.europa.eu/api-substance/v1/substance/" #+id
|
|
CLASSIFICATION_ID = "https://chem.echa.europa.eu/api-cnl-inventory/prominent/overview/classifications/harmonised/459160"
|
|
TOXICOLOGICAL_INFO = "https://chem.echa.europa.eu/html-pages-prod/e4c88c6e-06c7-4daa-b0fb-1a55459ac22f/documents/IUC5-5f55d8ec-7a71-4e2c-9955-8469ead9fe84_0035f3f8-7467-4944-9028-1db2e9c99565.html" # external + rootkey
|
|
REPEATED_DOSE = "https://chem.echa.europa.eu/html-pages-prod/e4c88c6e-06c7-4daa-b0fb-1a55459ac22f/documents/IUC5-82402b09-8d8f-495c-b673-95b205be60e0_0035f3f8-7467-4944-9028-1db2e9c99565.html"
|
|
|
|
active = "®istrationStatuses=Active"
|
|
inactive = "®istrationStatuses=Inactive"
|
|
legislation = "&legislation=REACH"
|
|
|
|
rmlId = '100.002.773'
|
|
|
|
url = BASE_DOSSIER + rmlId + active + legislation
|
|
response_dossier = requests.get(url)
|
|
if response_dossier.status_code != 200:
|
|
log.error(f"Network error: {response_dossier.status_code}")
|
|
response_dossier_json = response_dossier.json()
|
|
response_dossier_json
|
|
return
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|