OHDSI / ROhdsiWebApi

An R package for interfacing with a WebAPI instance
https://ohdsi.github.io/ROhdsiWebApi
10 stars 17 forks source link

Add class attribute to WebAPI objects like cohorts and concept sets #150

Closed ablack3 closed 4 years ago

ablack3 commented 4 years ago

I'd like to get feedback on the idea of adding a class attribute to WebAPI/Atlas objects like cohorts, concept sets, etc. This would allow us to do things like add a print method so objects will look nice when printed to the console. A simple example is included in this draft pull request for cohorts. Additionally it could allow for a nice interface using generic functions such as generate(), execute(), getSql(), post() that would accept different types of WebAPI objects (characterization, pathway, incidence rate) and perform the appropriate action based on the the type of object passed to the generic function.

baseUrl <- "http://webapi"

# execute a characterization 
execute(someCharacterization, baseUrl)

# execute a pathway analysis
execute(someIncidencePathwayAnalysis, baseUrl)

# execute an incidence rate analysis
execute(someIncidenceRateAnalysis, baseUrl)

# post a characterization 
post(someCharacterization, baseUrl)

# post a pathway analysis
post(someIncidencePathwayAnalysis, baseUrl)

# post an incidence rate analysis
post(someIncidenceRateAnalysis, baseUrl)
codecov[bot] commented 4 years ago

Codecov Report

Merging #150 into develop will decrease coverage by 53.52%. The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #150       +/-   ##
===========================================
- Coverage    55.92%   2.39%   -53.53%     
===========================================
  Files           16      16               
  Lines         1250    1252        +2     
===========================================
- Hits           699      30      -669     
- Misses         551    1222      +671     
Impacted Files Coverage Δ
R/CohortDefinition.R 0.00% <0.00%> (-15.39%) :arrow_down:
R/GetDefinition.R 0.00% <0.00%> (-68.43%) :arrow_down:
R/Concept.R 0.00% <0.00%> (-100.00%) :arrow_down:
R/DeleteDefinition.R 0.00% <0.00%> (-95.24%) :arrow_down:
R/GetDefinitionsMetadata.R 0.00% <0.00%> (-86.96%) :arrow_down:
R/InvokeGeneration.R 0.00% <0.00%> (-85.42%) :arrow_down:
R/WebApi.R 0.00% <0.00%> (-81.97%) :arrow_down:
R/CancelGeneration.R 0.00% <0.00%> (-78.79%) :arrow_down:
R/AutoGeneratedDefinitions.R 0.00% <0.00%> (-70.69%) :arrow_down:
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3e09d73...6c1e9ce. Read the comment docs.

gowthamrao commented 4 years ago

@ablack3 are you thinking of closing this PR based on prior comment?

ablack3 commented 4 years ago

No I was not. I’m just floating this idea. If you think it’s a good idea I’ll add more detail and remove the draft designation. It would at least be nice to have print methods for each of the object types created by ROhdsiWebApi. Is it worth pursuing?