Skip to content

Commit

Permalink
Update Accessing Public Data.r (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahamyirou authored Aug 13, 2024
1 parent 301cd9c commit 2ff3d27
Showing 1 changed file with 56 additions and 10 deletions.
66 changes: 56 additions & 10 deletions docs/examples/Accessing Public Data.r
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,63 @@ execute_query <- function(endpoint, query) {
# Query for retrieving data from the 'Infobase' table - this table is public
query_infobase <- Query$new()
query_infobase$query('Infobase', '{
Infobase {
Date
Location
region
measureid
fractionid
viral_load
seven_day_rolling_avg
pruid
}
Infobase {
Date
Location
region
measureid
fractionid
viral_load
seven_day_rolling_avg
pruid
}
}')

query_WastewaterAtEpiYearWeek <- Query$new()
query_WastewaterAtEpiYearWeek$query('WastewaterAtEpiYearWeek', '{
WastewaterAtEpiYearWeek {
Location
SiteName
City
Province
Country
EpiYear
EpiWeek
Week_start
measure
w_avg
min
max
Population_Coverage
pruid
}
}')

query_InfobaseTrend <- Query$new()
query_InfobaseTrend$query('InfobaseTrend', '{
InfobaseTrend {
Location
measure
latestTrends
pruid
t_low
t_high
LatestLevel
Grouping
City
Province
Country
}
}')

# Call execute_query function to execute GraphQL queries and parse JSON results into data frames
Infobase_df <- execute_query(endpoint, query_infobase$queries$Infobase)[["Infobase"]]
InfobaseTrend_df <- execute_query(endpoint, query_InfobaseTrend$queries$InfobaseTrend)[["InfobaseTrend"]]
WastewaterAtEpiYearWeek_df <- execute_query(endpoint, query_WastewaterAtEpiYearWeek$queries$WastewaterAtEpiYearWeek)[["WastewaterAtEpiYearWeek"]]

0 comments on commit 2ff3d27

Please sign in to comment.