chembl / chembl_webservices_2

Source code of the ChEMBL web services.
https://www.ebi.ac.uk/chembl/ws
Other
16 stars 3 forks source link

Molecule: Clinical Data #108

Open nclopezo opened 7 years ago

nclopezo commented 7 years ago

In the current interface, in the compound report card there is the section Clinical Data. How can this information be obtained using the current web services? Or could it be added to the response?

mnowotka commented 7 years ago

@agaulton - I can't find a table with a similar name in the app schema, any hints?

mnowotka commented 7 years ago

So interestingly this data comes from AJAX calls to:

So you can use them directly and in the meantime I'll try to find a code of this simple API and integrate into the new API.

nclopezo commented 7 years ago

I found the code in the current interface that implements that API. It does the following:

  1. It generates a search term for the compound. For example, for CHEMBL25 in Cochrane it would be 'ASPIRIN'.
  2. It generates a url for the compound. For example: http://www.cochrane.org/search/site/ASPIRIN
  3. It curls the URL and looks into the content for a match of a regular expression to get the count:
if(preg_match("/<div\s+class=\"search-results-range\">Showing\s+results\s+\d+\s+to\s+\d+\s+of\s+(\d+)<\/div>/", $content, $matches) == 1){
                    $count = $matches[1];
                }

But It seems that it is not reading the content correctly: https://www.ebi.ac.uk/chembl/compound/inspect/CHEMBL25

in https://www.ebi.ac.uk/chembl/clinical/cochrane/CHEMBL25 it says:

...
count: "0"
...

But If you go to http://www.cochrane.org/search/site/ASPIRIN in a browser you get 89 results.

I am not sure what would be the best solution to implement this: A. The web services would do the same process that is currently done by the current interface? B. The client device would do this process using javascript? I did a simple test and I would have to implement a workaround for the issue with Access-Control-Allow-Origin.