Is it possible to get the labels and priority from a Microsoft Planner task with the Microsoft Graph API?
See screenshot below to have an idea:
Using next endpoint: https://graph.microsoft.com/v1.0/planner/plans/<plan-id>/tasks I get next data:
{
"#odata.etag": "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBBWCc=\"",
"planId": "r4g58er4grregrg7848",
"bucketId": "64g8df54hhktohk487",
"title": "Title of a task",
"orderHint": "545457845775LM",
"assigneePriority": "",
"percentComplete": 0,
"startDateTime": null,
"createdDateTime": "2022-01-07T13:58:14.5355148Z",
"dueDateTime": null,
"hasDescription": true,
"previewType": "description",
"completedDateTime": null,
"completedBy": null,
"referenceCount": 0,
"checklistItemCount": 1,
"activeChecklistItemCount": 3,
"conversationThreadId": null,
"id": "grejgopreg645647",
"createdBy": {
"user": {
"displayName": null,
"id": "74463467-d67d-4512-9086-c9e279dde6ae"
}
},
"appliedCategories": {
"category5": true
},
"assignments": {}
}
I've next comments on this JSON:
What is assigneePriority? When a priority is filled in, will always be an empty string.
What is appliedCategories? Can these categories being used for the labels? But what is category5?
While it's not the most straightforward answer, you can figure out what labels are assigned to a task. You'll need both the planid and taskid to get it.
The appliedCategories are actually the labels applied to a particular task. Their identifieres are just category##. To find the corresponding label name, you'll need to make a call to get the plan details.
Graph API URL: https://graph.microsoft.com/beta/planner/plans/{planid}/details
This will return a JSON object containing each of the categories and their descriptions. You can find more info here about the plannerPlanDetails type. Note: the v1.0 graph endpoint only returns the first 6 categories, while the beta version will return 25.
"categoryDescriptions": {
"category1": "Some name",
"category2": "Some other name",
"category3": "Another",
"category4": null,
...
"category25": null
}
Within the task details, appliedCategories object will contain any labels assigned to that task.
For the priority, you will find a priority property on the task object when using the beta version of the endpoint. It's an integer, but from my testing, the following are the corresponding priority titles
9 - Low
5 - Important
3 - Medium
1 - Urgent
You'll have to do some correlation on your own to match them up, but this is how you can get the information you're looking for.
Related
I am trying to get only the matched data from nested array of elastic search class. but I am not able to get it..the whole nested array data is being returned as output.
this is my Query:-
QueryBuilders.nestedQuery("questions",
QueryBuilders.boolQuery()
.must(QueryBuilders.matchQuery("questions.questionTypeId", quesTypeId)), ScoreMode.None)
.innerHit(new InnerHitBuilder());
I am using querybuilders to get data from nested class.Its working fine but not able to get only the matched data.
Request Body :
{
"questionTypeId" : "MCMC"
}
when questionTypeId = "MCMC"
this is the output i am getting..Here I want to exclude the output for which the questionTypeId = "SCMC".
output :
{
"id": "46",
"subjectId": 1,
"topicId": 1,
"subtopicId": 1,
"languageId": 1,
"difficultyId": 4,
"isConceptual": false,
"examCatId": 3,
"examId": 1,
"usedIn": 1,
"questions": [
{
"id": "46_31",
"pid": 31,
"questionId": "QID41336691",
"childId": "CID1",
"questionTypeId": "MCMC",
"instruction": "This is a single correct multiple choice question.",
"question": "Who holds the most english premier league titles?",
"solution": "Manchester United",
"status": 1000,
"questionTranslation": []
},
{
"id": "46_33",
"pid": 33,
"questionId": "QID41336677",
"childId": "CID1",
"questionTypeId": "SCMC",
"instruction": "This is a single correct multiple choice question.",
"question": "Who holds the most english premier league titles?",
"solution": "Manchester United",
"status": 1000,
"questionTranslation": []
}
]
}
As you have tagged this with spring-data-elasticsearch:
Support to return inner hits was recently added to version 4.1.M1 and so will be included in the next released version. Then in a SearchHit you will get the complete top level document, but in the innerHits property only the matching inner hits will be returned.
Here's the JSON i'm working with:
{
"featured": [
{
"name": "Featured Show number 1",
"id": "123",
"slug": "featured-show-number-one",
"description": "This is an item description for show number 1"
},
{
"name": "Featured Show number 2",
"id": "456",
"slug": "featured-show-nubmer-tow",
"description": "This is an item description for show number 2"
}
],
"nonfeatured": [
{
"name": "Show number 3",
"id": "789",
"slug": "show-number-three",
"description": "This is an item description for show number 3"
},
{
"name": "Show number 4",
"id": "135",
"slug": "show-number-four",
"description": "This is an item description for show number 4"
}
]
}
What I am trying to figure out is after I parse this JSON using two data models, one for "Featured" and one for "Nonfeatured", looping through each show and adding it to an array, I need to add the arrays of shows together to create one array containing all the shows. However, I need to keep track of which shows are featured and which ones are non featured from the single array. Is there a way to do this?
The short answer to your specific question here is 'no'. The result of adding array A and array B (where both contain the same types) is A + B; there is no metadata providing any kind of source information.
But that is not to say that you couldn't accomplish the same thing by changing the model slightly. One option would be to add an extra boolean flag to the model called isFeatured or similar. Or you could 'future-proof' any work by using an enumeration of source lists containing featured, non-featured plus anything else you may require later.
To take the first example, an option would be to add the boolean field and then call code similar to below prior to 'summing' the arrays.
arrayA.forEach { $0.isFeatured = true }
arrayB.forEach { $0.isFeatured = false }
let arrayC = arrayA + arrayB
Then each element in the summed array will tell you its source list.
I am new to Neo4j. I am trying to populate Yelp dataset in Neo4j. Basically, I am interested in three json file provided by them i.e.
user.json
{
"user_id": "-lGwMGHMC_XihFJNKCJNRg",
"name": "Gabe",
"review_count": 277,
"yelping_since": "2014-10-31",
"friends": ["Oa84FFGBw1axX8O6uDkmqg", "SRcWERSl4rhm-Bz9zN_J8g", "VMVGukgapRtx3MIydAibkQ", "8sLNQ3dAV35VBCnPaMh1Lw", "87LhHHXbQYWr5wlo5W7_QQ"],
"useful": 45,
"funny": 4,
"cool": 55,
"fans": 17,
"elite": [],
"average_stars": 4.72,
"compliment_hot": 5,
"compliment_more": 1,
"compliment_profile": 0,
"compliment_cute": 1,
"compliment_list": 0,
"compliment_note": 11,
"compliment_plain": 20,
"compliment_cool": 15,
"compliment_funny": 15,
"compliment_writer": 1,
"compliment_photos": 8
}
I have omitted several entries from friends array to make output readable
business.json
{
"business_id": "YDf95gJZaq05wvo7hTQbbQ",
"name": "Richmond Town Square",
"neighborhood": "",
"address": "691 Richmond Rd",
"city": "Richmond Heights",
"state": "OH",
"postal_code": "44143",
"latitude": 41.5417162,
"longitude": -81.4931165,
"stars": 2.0,
"review_count": 17,
"is_open": 1,
"attributes": {
"RestaurantsPriceRange2": 2,
"BusinessParking": {
"garage": false,
"street": false,
"validated": false,
"lot": true,
"valet": false
},
"BikeParking": true,
"WheelchairAccessible": true
},
"categories": ["Shopping", "Shopping Centers"],
"hours": {
"Monday": "10:00-21:00",
"Tuesday": "10:00-21:00",
"Friday": "10:00-21:00",
"Wednesday": "10:00-21:00",
"Thursday": "10:00-21:00",
"Sunday": "11:00-18:00",
"Saturday": "10:00-21:00"
}
}
review.json
{
"review_id": "VfBHSwC5Vz_pbFluy07i9Q",
"user_id": "-lGwMGHMC_XihFJNKCJNRg",
"business_id": "YDf95gJZaq05wvo7hTQbbQ",
"stars": 5,
"date": "2016-07-12",
"text": "My girlfriend and I stayed here for 3 nights and loved it.",
"useful": 0,
"funny": 0,
"cool": 0
}
As we can see in the sample files that relationship between user and business is associated via the review.json file. How can I create a relationship edge between user and business using the review.json file.
I have also seen Mark Needham tutorial where he has shown StackOverflow data population but in that case, relationship file was already present with sample data. Do I need to build a similar file? If yes, how should I approach this problem? or is there any other way to build relationship between user & business?
It very much depends on your model as to what you want to do, but you could do 3 imports:
//Create Users - does assume the data is unique
CALL apoc.load.json('file:///c://temp//SO//user.json') YIELD value AS user
CREATE (u:User)
SET u = user
then add the businesses:
CALL apoc.load.json('file:///c://temp//SO//business.json') YIELD value AS business
CREATE (b:Business {
business_id : business.business_id,
name : business.name,
neighborhood : business.neighborhood,
address : business.address,
city : business.city,
state : business.state,
postal_code : business.postal_code,
latitude : business.latitude,
longitude : business.longitude,
stars : business.stars,
review_count : business.review_count,
is_open : business.is_open,
categories : business.categories
})
For the businesses, we can't just do the SET b = business because the JSON has nested maps. So you might want to decide if you want them, and might have to go down a different route.
Lastly, the reviews, which is where we join it all up.
CALL apoc.load.json('file:///c://temp//SO//review.json') YIELD value AS review
CREATE (r:Review)
SET r = review
WITH r
//Match user to a review
MATCH (u:User {user_id: r.user_id})
CREATE (u)-[:HAS_REVIEW]->(r)
WITH r, u
//Match business to a review, and a user to a business
MATCH (b:Business {business_id: r.business_id})
//Merge here in case of multiple reviews
MERGE (u)-[:HAS_REVIEWED]->(b)
CREATE (b)-[:HAS_REVIEW]->(r)
Obviously - change labels/relationships to types you want, and it might need tuning depending on the size of data etc, so you might need to use apoc.periodic.iterate to work it.
Apoc is here if you need it (and you should use it!)
I've set up a Druid cluster to ingest real-time data from Kafka.
Question
Does Druid support fetching data that's sorted by timestamp? For example, let's say I need to retrieve the latest 10 entries from a Datasource X. Can I do this by using a LimitSpec (in the Query JSON) that includes the timestamp field? Or is there another better option supported Druid?
Thanks in advance.
Get unaggregated rows
To get unaggregated rows, you can do a query with "queryType: "select".
Select queries are also useful when pagination is needed - they let you set a page size, and automatically return a paging identifier for use in future queries.
In this example, if we just want the top 10 rows, we can pass in "pagingSpec": { "pageIdentifiers": {}, "threshold": 10 }.
Order by timestamp
To order these rows by "timestamp", you can pass in "descending": "true".
Looks like most Druid query types support the descending property.
Example Query:
{
"queryType": "select",
"dataSource": "my_data_source",
"granularity": "all",
"intervals": [ "2017-01-01T00:00:00.000Z/2017-12-30T00:00:00.000Z" ],
"descending": "true",
"pagingSpec": { "pageIdentifiers": {}, "threshold": 10 }
}
Docs on "select" type queries
You can use a group by query to do this, So group by __time as an extraction function then set granularity to all and use the limitSpec to sort/limit that will work. Now if you want to use a timeseries query it is more tricky to get the latest 10. One way to do it is to set the granularity to the desired one let say Hour then set the interval to be 10H starting from the most recent point in time. This sounds more easy to say than achieve. I will go the first way unless you have a major performance issue.
{
"queryType": "groupBy",
"dataSource": "wikiticker",
"granularity": "all",
"dimensions": [
{
"type": "extraction",
"dimension": "__time",
"outputName": "extract_time",
"extractionFn": {
"type": "timeFormat"
}
},
],
"limitSpec": {
"type": "default",
"limit": 10,
"columns": [
{
"dimension": "extract_time",
"direction": "descending"
}
]
},
"aggregations": [
{
"type": "count",
"name": "$f2"
},
{
"type": "longMax",
"name": "$f3",
"fieldName": "added"
}
],
"intervals": [
"1900-01-01T00:00:00.000/3000-01-01T00:00:00.000"
]
}
How does it work in iOS? Currently using Objective C.
Created in Document.
LIKE
{
"_id": "",
"userEmail": "",
"broadcastID": "",
"like": "",
"count": 0,
"type": "like"
}
and
REACH
{
"_id": "",
"userEmai": "",
"broadcastID": "",
"reach": "",
"count": 0,
"type": "reach"
}
Thank you in advance :)
Count Numbers of Likes/Reached
A typical approach would be to create a view with a map function that emits (places into the index) the values you care about. You can then run queries based on the view to further refine the information you retrieve.
Between the map function and query options, you have a lot of control over the information you retrieve. For example, you already have a 'type' field, so it's easy to have your map function only produce output for documents of the correct type.