OHDSI Home | Forums | Wiki | Github

OhdsiRTools question


(Vojtech Huser) #1

For Dream challenge, I am working with this definition here
http://atlas-demo.ohdsi.org/#/cohortdefinition/1772216

I am hoping to use OhdsiRTools::insertCohortDefinitionInPackage

If I look at the code, the key part of the code works fine (with the following parameters)

definitionId = 1772216
baseUrl='http://atlas-demo.ohdsi.org:80/WebAPI'
url <- paste(baseUrl, "cohortdefinition", definitionId, 
             sep = "/")
json <- httr::GET(url)
httr::content(json)

I believe the regex in the function below is failing all the cool features for cohorts on OHDSRTools.

.checkBaseUrl
function (baseUrl) 
{
  patterns <- list("https?:\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})+(\\/.*)?\\/WebAPI$", 
    "https?:\\/\\/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(:[0-9]{1,5})+(\\/.*)?\\/WebAPI$")
  results <- lapply(patterns, function(p) {
    result <- grepl(pattern = p, x = baseUrl, ignore.case = FALSE)
  })
  return(any(as.logical(results)))
}

I get false when I run
OhdsiRTools:::.checkBaseUrl(baseUrl)

Is this true bug or am I doing something wrong.

version I am using is OhdsiRTools * 1.7.0 2019-08-05 [1] Github (OHDSI/OhdsiRTools@8626e57)


(Chris Knoll) #2

The WEBApi is hosted on a separate top level domain from atlas-demo. I found the WebAPI endpoint hosted at: http://api.ohdsi.org/WebAPI/info

So, try changing the base url to http://api.ohdsi.org/WebAPI


(Vojtech Huser) #3

I did that URL as well but it fails the RegEx in the check function as well.

baseUrl=‘http://api.ohdsi.org/webAPI
OhdsiRTools:::.checkBaseUrl(baseUrl)
[1] FALSE

Until it would say TRUE, all the great functions in OhdsiRTools will fail.


(Lee Evans) #4

@Vojtech_Huser The URL is case sensitive.

Try this URL instead:
http://api.ohdsi.org/WebAPI


(Vojtech Huser) #5

same failure with WebAPI.
The problem is that the regex check (at the start of every OhdsiRTools call is expecting a pattern that this does not match. (I think the port 80 requirement there is failing it). But I am not a regex expert. I think a check based on try of a httr call would be much better than forcing a pattern with regex.

formal issue now here https://github.com/OHDSI/OhdsiRTools/issues/27


t