<jupyter_start><jupyter_text>Import the packages above, along with the the get_hazard_codes function from the safety.py file. Also import a dataframe of chemcials you would like to have scored for their safety, witht he pubchem cid for each. Lastly, import the scoring table which contains all of the GHS hazard codes and their respective scores.  Perform the action below to append a column to your dataframe with the GHS hazard info/classification.<jupyter_code>hazard_codes = []
for i, row in data.iterrows():
    cid = row['HBA_cid']
    values = get_hazard_codes(cid)
    hazard_codes.append(values)
data['GHS_info'] = hazard_codes

data
#Converting the GHS_info column in the data table as a list for testing our fucntions.
GHS_list = data['GHS_info'].tolist()

#dictionary to pull hazard scores from
scoring_table_dict = scoring_table.to_dict() 
from scoring import get_hazard_scores
health_list = []
env_list = []

for item in GHS_list:
    get_hazard_scores(item, health_list, env_list, scoring_table_dict)
health_list
env_list
data['Health Score'] = health_list
data['Environmental Score'] = env_list
data
extra_data = pd.DataFrame()
HBA_cid = [6209,
13836,
11198,
6060,
65551,
517011,
74819,
67553,
74236,
2724141,
70681,
2723680,
5946,
6285,
6225,
6379,
66137,
74745,
79880,
12429,
]
extra_data['HBA_cid'] = HBA_cid
extra_data
hazard_codes = []
for i, row in extra_data.iterrows():
    cid = row['HBA_cid']
    values = get_hazard_codes(cid)
    hazard_codes.append(values)
extra_data['GHS_info'] = hazard_codes

extra_data
#Converting the GHS_info column in the data table as a list for testing our fucntions.
GHS_list_2 = extra_data['GHS_info'].tolist()
health_list_2 = []
env_list_2 = []

for item in GHS_list_2:
    get_hazard_scores(item, health_list_2, env_list_2, scoring_table_dict)
extra_data['Health Score'] = health_list_2
extra_data['Environmental Score'] = env_list_2
extra_data<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08691153647180548, 'fraction_numerical': 0.0553543714433523, 'mean_word_length': 5.7386759581881535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '621934', 'license': 'MIT', 'n_tokens_mistral': 760, 'n_tokens_neox': 690, 'n_words': 203, 'path': 'scripts/safety/Final_Safety_Example.ipynb', 'repo_name': 'jrodguez/des-basis-set', 'size': '1933'}