working_notebooks

This commit is contained in:
adish-rmr 2026-01-02 19:17:57 +01:00
parent 133003344d
commit e3872cac5f
2 changed files with 74 additions and 4 deletions

72
debug.py Normal file
View file

@ -0,0 +1,72 @@
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 = '102-71-6'
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 = "&registrationStatuses=Active"
inactive = "&registrationStatuses=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()

View file

@ -32,16 +32,14 @@ def _(log):
@app.cell @app.cell
def _(): def _():
cas_problematici = [ cas_problematici = [
"25525-21-7", "513-85-9"
"113170-55-1",
"26172-55-4"
] ]
return (cas_problematici,) return (cas_problematici,)
@app.cell @app.cell
def _(cas_problematici): def _(cas_problematici):
cas_test = cas_problematici[2] cas_test = cas_problematici[0]
return (cas_test,) return (cas_test,)