OHDSI Home | Forums | Wiki | Github

OhdsiRTools - getting cohort definition - error

OhdsiRTools is a great package and thank you for developing it.

I have the following code that gives an error

R code is


library(OhdsiRTools)
packageVersion("OhdsiRTools")
#baseUrl<-'http://api.ohdsi.org:80/WebAPI'
baseUrl <-'http://test2.ohdsitutorials.amazingawsdemos.com:80/WebAPI'
baseUrl2<-'http://test2.ohdsitutorials.amazingawsdemos.com/WebAPI'
definitionId=3
#this url works https://test2.ohdsitutorials.amazingawsdemos.com/WebAPI/ddl/results
#this also works https://test2.ohdsitutorials.amazingawsdemos.com/WebAPI/cohortdefinition/3
OhdsiRTools::getCohortDefinitionName(baseUrl ,definitionId)
OhdsiRTools::getCohortDefinitionName(baseUrl2,definitionId)

The error is

> library(OhdsiRTools)
> packageVersion("OhdsiRTools")
[1] ‘1.5.5’
> baseUrl <-'http://test2.ohdsitutorials.amazingawsdemos.com:80/WebAPI'
> baseUrl2<-'http://test2.ohdsitutorials.amazingawsdemos.com/WebAPI'
> definitionId=3
> OhdsiRTools::getCohortDefinitionName(baseUrl ,definitionId)
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Failed to connect to test2.ohdsitutorials.amazingawsdemos.com port 80: Timed out
> OhdsiRTools::getCohortDefinitionName(baseUrl2,definitionId)
Error in OhdsiRTools::getCohortDefinitionName(baseUrl2, definitionId) : 
  Base URL not valid, should be like http://server.org:80/WebAPI
> ```


The code requires :80 to be in URL but I don't have control over the port deployment. Could this be changed?  How can I make the R code work?

Ideally, I would be able to fetch definitions from the public server. (and know the URL. assumming I have valid login to it)  (something like base url of  `http://api.ohdsi.org:80/WebAPI`

Also does double slash in URL matter? (https://test2.ohdsitutorials.amazingawsdemos.com/WebAPI/cohortdefinition/3 vs https://test2.ohdsitutorials.amazingawsdemos.com//WebAPI/cohortdefinition/3

(I tried both and both work fine in browser)

Just to show that it truly works in browser
<img src="/uploads/default/original/2X/b/b11faf56de6428a45cadb1914fc798a9e8adc7d2.png" width="690" height="445">
t