Skip to content

Instantly share code, notes, and snippets.

@jwalton922
Last active February 15, 2018 21:23
Show Gist options
  • Save jwalton922/864831e2543434d02b8e2873e79e64d6 to your computer and use it in GitHub Desktop.
Save jwalton922/864831e2543434d02b8e2873e79e64d6 to your computer and use it in GitHub Desktop.
##############
Query for Activity Last Seven Days
{
temporalEngagement(courseSectionId: "cs1",
filter: {timeWindow: {gte: "2018-02-02T00:00:00", lt: "2018-02-05T00:00:00"}},
timeBin: day,
sortBy: "timeBin"
sortOrder: asc
) {
totalCount
timeWindow
percentPersonsViewed
totalTimeSpent
}
}
Response
{
"temporalEngagement": [
{
"totalCount": 10,
"timeWindow": "2018-02-02"
},
{
"totalCount": 8,
"timeWindow": "2018-02-03"
},
{
"totalCount": 3,
"timeWindow": "2018-02-04"
}
]
}
##############
Query for Activity for one day by hour
{
temporalEngagement(courseSectionId: "cs1", reportingContextId: "book1", learningResource: "book1",
filter: {timeWindow: {gte: "2018-02-02", lt: "2018-02-03"}},
timeBin: hour,
sortBy: "timeBin"
sortOrder: asc
) {
totalCount
timeWindow
}
}
Response - note only time windows with data returned
{
"temporalEngagement": [
{
"totalCount": 5,
"timeWindow": "2018-02-02T07:00:00"
},
{
"totalCount": 3,
"timeWindow": "2018-02-02T15:00:00"
},
{
"totalCount": 2,
"timeWindow": "2018-02-02T18:00:00"
}
]
}
#####################
Most active query
mostActiveTimeQuery(courseSectionId: "cs1", filter: {timeWindow: {gte: "2018-02-02", lt: "2018-02-05"}}, sortBy: "timeWindows.minDate", sortOrder: desc) {
minDate
maxDate
}
Most Active Query Response
{
"mostActiveTimeQuery" : {
"timeWindows": [
"minDate": "2018-02-03T10:00:00",
"maxDate": "2018-02-03T12:00:00",
]
}
}
########################
Students with no activity
{
temporalEngagement(courseSectionId: "cs1", reportingContextId: "book1", learningResource: "book1",
filter: {timeWindow: {gte: "2018-02-02", lt: "2018-02-05"}},
timeBin: day,
sortBy: "timeBin"
sortOrder: asc
) {
timeWindow
bucket(filter: {lte: 0}) {
totalCount
}
}
}
Query Response
{
"temporalEngagement" : [
{
"timeWindow" : "2018-02-02",
"bucket" : {
totalCount: 3
}
},
{
"timeWindow" : "2018-02-03",
"bucket" : {
totalCount: 0
}
},
{
"timeWindow" : "2018-02-04",
"bucket" : {
totalCount: 1
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment