fixed dossier full & lead, ricerca non va in errore se almeno uno dei tre dossier esiste
This commit is contained in:
parent
c30561bc89
commit
133003344d
1 changed files with 37 additions and 24 deletions
|
|
@ -64,13 +64,15 @@ def get_dossier_info(rmlId: str, type = active) -> dict:
|
||||||
if type == active:
|
if type == active:
|
||||||
return get_dossier_info(rmlId, inactive)
|
return get_dossier_info(rmlId, inactive)
|
||||||
return {}
|
return {}
|
||||||
|
for dossier in response_dossier_json['items']:
|
||||||
|
if dossier['reachDossierInfo']['dossierSubtype'] == "Article 10 - full" and dossier['reachDossierInfo']['registrationRole'] == "Lead (joint submission)":
|
||||||
dossier_info = {
|
dossier_info = {
|
||||||
"lastUpdatedDate": response_dossier_json['items'][0]['lastUpdatedDate'],
|
"lastUpdatedDate": dossier['lastUpdatedDate'],
|
||||||
"registrationStatus": response_dossier_json['items'][0]['registrationStatus'],
|
"registrationStatus": dossier['registrationStatus'],
|
||||||
"registrationStatusChangedDate": response_dossier_json['items'][0]['registrationStatusChangedDate'],
|
"registrationStatusChangedDate": dossier['registrationStatusChangedDate'],
|
||||||
"registrationRole": response_dossier_json['items'][0]['reachDossierInfo']['registrationRole'],
|
"registrationRole": dossier['reachDossierInfo']['registrationRole'],
|
||||||
"assetExternalId": response_dossier_json['items'][0]['assetExternalId'],
|
"assetExternalId": dossier['assetExternalId'],
|
||||||
"rootKey": response_dossier_json['items'][0]['rootKey']
|
"rootKey": dossier['rootKey']
|
||||||
}
|
}
|
||||||
log.info(f"Dossier info retrieved for RML ID {rmlId}")
|
log.info(f"Dossier info retrieved for RML ID {rmlId}")
|
||||||
return dossier_info
|
return dossier_info
|
||||||
|
|
@ -89,30 +91,41 @@ def get_substance_index(assetExternalId : str) -> dict:
|
||||||
index_data = {}
|
index_data = {}
|
||||||
|
|
||||||
# Toxicological information : txi
|
# Toxicological information : txi
|
||||||
|
try:
|
||||||
txi_div = soup.find('div', id='id_7_Toxicologicalinformation')
|
txi_div = soup.find('div', id='id_7_Toxicologicalinformation')
|
||||||
txi_link = txi_div.find('a', class_='das-leaf')
|
txi_link = txi_div.find('a', class_='das-leaf')
|
||||||
txi_href = txi_link['href']
|
txi_href = txi_link['href']
|
||||||
index_data['toxicological_information_link'] = LINK_DOSSIER + txi_href + '.html'
|
index_data['toxicological_information_link'] = LINK_DOSSIER + txi_href + '.html'
|
||||||
|
except Exception as e:
|
||||||
|
log.error(f"Error retrieving toxicological information link: {e}")
|
||||||
|
index_data['toxicological_information_link'] = None
|
||||||
|
|
||||||
# Repeated dose toxicity : rdt
|
# Repeated dose toxicity : rdt
|
||||||
|
try:
|
||||||
rdt_div = soup.find('div', id='id_75_Repeateddosetoxicity')
|
rdt_div = soup.find('div', id='id_75_Repeateddosetoxicity')
|
||||||
rdt_link = rdt_div.find('a', class_='das-leaf')
|
rdt_link = rdt_div.find('a', class_='das-leaf')
|
||||||
rdt_href = rdt_link['href']
|
rdt_href = rdt_link['href']
|
||||||
index_data['repeated_dose_toxicity_link'] = LINK_DOSSIER + rdt_href + '.html'
|
index_data['repeated_dose_toxicity_link'] = LINK_DOSSIER + rdt_href + '.html'
|
||||||
|
except Exception as e:
|
||||||
|
log.error(f"Error retrieving repeated dose toxicity link: {e}")
|
||||||
|
index_data['repeated_dose_toxicity_link'] = None
|
||||||
|
|
||||||
# Acute toxicity : at
|
# Acute toxicity : at
|
||||||
|
try:
|
||||||
at_div = soup.find('div', id='id_72_AcuteToxicity')
|
at_div = soup.find('div', id='id_72_AcuteToxicity')
|
||||||
at_link = at_div.find('a', class_='das-leaf')
|
at_link = at_div.find('a', class_='das-leaf')
|
||||||
at_href = at_link['href']
|
at_href = at_link['href']
|
||||||
index_data['acute_toxicity_link'] = LINK_DOSSIER + at_href + '.html'
|
index_data['acute_toxicity_link'] = LINK_DOSSIER + at_href + '.html'
|
||||||
|
except Exception as e:
|
||||||
|
log.error(f"Error retrieving acute toxicity link: {e}")
|
||||||
|
index_data['acute_toxicity_link'] = None
|
||||||
|
|
||||||
log.info(f"Substance index retrieved for Asset External ID {assetExternalId}")
|
log.info(f"Substance index retrieved for Asset External ID {assetExternalId}")
|
||||||
|
|
||||||
return index_data
|
return index_data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ECHA parsing functions of html pages
|
#region ECHA parsing functions of html pages
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue