# Open Source Database Monitor

With the rise of cheminformatics, so comes the rise of open source databases. Unfortunately, open source databases are spread amongst a variety of URLS and can be hard to keep track in an efficient fashion. We create the `Uptime` bot

{% embed url="<https://chemistrydb.com>" %}

```
 Zinc 15                                                  OpenFDA                                                      
 Zinc 20                                                  Metabolites Biological Role                                  
 PubChem                                                  MetaboAnalyst                                                
 NIST Chemistry Webhook                                   Adverse Drug Reaction Classification System                  
 Chem Exper                                               Metabolism and Transport Database                            
 NMR Shift Database                                       Ecology Toxicity                                             
 Drug Bank                                                Human and Environment Risk Assessment                        
 Binding Database                                         International Toxicity Information for Risk Assesments       
 Spectral Database for Organic Compounds                  Japan Exisiting Database                                     
 Sider                                                    National Pesticide Center                                    
 ChemSpider                                               Pesticide Info                                               
 Stitch                                                   Kyoto Encyclopedia of Genes and Genomes                      
 CardPred                                                 Hetereocycles                                                
 Comparative Toxicogenomics Database                      Chemical Resolver                                            
 AMED Cardiotoxicity Database                             LookChem                                                     
 Tox21                                                    Lipid Maps                                                   
 Drug Safety Analysis System                             
```

**Imports**

```
from global_chem_extensions import GlobalChemExtensions

do = GlobalChemExtensions().development_operations()
```

**Check Cheminformatic Databases**

{% tabs %}
{% tab title="Code" %}

```
successes, failures = do.check_status_on_open_source_cheminformatic_databases()
print (successes)
print (failures)
```

{% endtab %}

{% tab title="Output" %}

```
{' Zinc 15': 'Up', ' Zinc 20': 'Up', ' PubChem': 'Up', ' NIST Chemistry Webhook': 'Up', ' Chem Exper': 'Up', ' NMR Shift Database': 'Up', ' Binding Database': 'Up', ' Spectral Database for Organic Compounds': 'Up', ' Sider': 'Up', ' ChemSpider': 'Up', ' Stitch': 'Up', ' CardPred': 'Up', ' Comparative Toxicogenomics Database': 'Up', ' AMED Cardiotoxicity Database': 'Up', ' Tox21': 'Up', ' Drug Safety Analysis System': 'Up', ' OpenFDA': 'Up', ' Metabolites Biological Role': 'Up', ' MetaboAnalyst': 'Up', ' Adverse Drug Reaction Classification System': 'Up', ' Metabolism and Transport Database': 'Up', ' Ecology Toxicity ': 'Up', ' Japan Exisiting Database': 'Up', ' National Pesticide Center': 'Up', ' Pesticide Info': 'Up', ' Kyoto Encyclopedia of Genes and Genomes': 'Up', ' Hetereocycles': 'Up', ' Chemical Resolver': 'Up', ' LookChem': 'Up', ' Lipid Maps': 'Up'}
{' Drug Bank': 'Down', ' Human and Environment Risk Assessment ': 'Down', ' International Toxicity Information for Risk Assesments': 'Down'}
```

{% endtab %}
{% endtabs %}

**Check Bacteria Databases**

{% tabs %}
{% tab title="Code" %}

```
successes, failures = do.check_status_on_open_source_bacteria_databases()
print (successes)
print (failures)
```

{% endtab %}

{% tab title="Output" %}

```
{' European Molecular Biology Laboratory': 'Up', ' DDBJ bioinformatics': 'Up', ' BROAD Institute': 'Up', ' Biocyc Genome Database': 'Up', ' National Center for Bioinformatics Microbial Genome Database': 'Up', ' Ensembl Bacteria': 'Up', ' NIH Human Microbiome Project': 'Up', ' Microbial Genome Database': 'Up', ' JGI Genomes ': 'Up', ' Pseudomonas Genome Database': 'Up', ' Ecocyc': 'Up', ' ECMDB': 'Up', ' Staphylococcus regulator RNA Database': 'Up', ' Vibrio Cholera Genome Database': 'Up'}
{' ATCC': 'Down', ' EzBioCloud Public Genome': 'Down'}
```

{% endtab %}
{% endtabs %}

**Github Repository**

![](https://538359177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUSbA3Zf4EXyGn0UpfW5b%2Fuploads%2F7i8jzU9DAnWlPqpZgESS%2FScreen%20Shot%202022-02-24%20at%2010.26.09%20AM.png?alt=media\&token=fa320059-26a9-4c9c-8936-44248714b8ca)

The bot serves as a heart beat checker pinging URLS for databases that are most often used by cheminformaticians.&#x20;

![](https://538359177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUSbA3Zf4EXyGn0UpfW5b%2Fuploads%2F8IrSXQ32vvV57BHlioq8%2FScreen%20Shot%202022-02-24%20at%2010.28.37%20AM.png?alt=media\&token=dca01c81-eb74-4602-98c9-340b4c2ccd32)

Within the GlobalChemExtensions component we would like a persistent monitoring system tied to the same URLS the bot is also pinging.&#x20;

```
for i in contents:
    if 'name' in i and \
        '#' not in i and 'chemistrydb.com' not in i \
        and 'Cheminformatic Database Statuses' not in i:
        i = i.strip('\n').split('name:')[1]
        names.append(i)

    if 'url' in i:
        i = i.strip('\n').split('url:')[1]
        urls.append(i)

return urls, names
```

The code then checks the status code to see if it still alive. If not it gets reported as a failure. This is useful for folk relying on these databases for whatever processing they are doing.&#x20;

```
response = urllib.request.urlopen(url)
status_code = response.getcode()

if '200' == status_code:
    successes[name] = 'Up'
 except:
    failures[name] = 'Down'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://globalchem.gitbook.io/globalchem-your-chemical-graph-network/development-operations/open-source-database-monitor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
