Watson Assistant retaining the value that is a recognised entity - entity

I am capturing a user response in my assistant, after which I want following questions to repsond based in the response that has been previously captured into an entity i have created
For example I will respond to a question with
Banana this is captured as an entity
I then want the watson assistant to then respond to subsequent question based on the entity captured. For example I want to ask
What colour ? and for the assistant to know that Im asking the question in relation to the banana, as I know that some people interacting with the assistant won't ask the question "what colour is a banana ?"

What you are asking is one of the reasons (as #data_henrik mentioned) we have context variables. These once set will remain through out the conversation. You can set a context variable using either the context editor ( see three dot menu of a dialog node ) or in the json response packet i.e.
"context": {
"my_saved_entity" : #entity_defined
}
In your case #entity_defined = banana so "my_saved_entity" becomes banana.
You can then use this context variable in your response;
The colour of a $my_saved_entity is Yellow
And you can text for a setting of $my_saved_entity in the dialog condition i.e.
(if) $my_saved_entity = "banana" or the short hand version $my_saved_entity:banana
I would suggest you read the following documentation, and have a play
https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-runtime#dialog-runtime-context-variables

Related

Get LimeSurvey not selected multiple choice answers with "N" using API Remote Control

Is it possible to get not selected answers in multiple choice question type marked with "N" when consuming Lime Survey API?
The API method export_responses gives all the question/subquestions/answers codes of user responses in bulk.
But the multiple choice question type signalizes only the selected answers with an "Y". I'd like responses bring the answers not selected with an "N" written. LimeSurvey can do that?
Example:
listTpFisioAt is the question code; text, in listTpFisioAt[text], is an option. When I consume the API to get responses I get something like this:
lisTpFisioAt[Fototerapia]
lisTpFisioAt[Termoterapia]
lisTpFisioAt[Cinesioterapia] Y
lisTpFisioAt[Eletroterapia]
lisTpFisioAt[Hidroterapia] Y
In this case user selected Cinesioterapia and Hidroterapia in Lime Survey interface.
I'd like to get:
lisTpFisioAt[Fototerapia] N
lisTpFisioAt[Termoterapia] N
lisTpFisioAt[Cinesioterapia] Y
lisTpFisioAt[Eletroterapia] N
lisTpFisioAt[Hidroterapia] Y
No, is not possible. Limesurvey fills checked options only. The other ones are left empty. You will need to fill the empty ones yourself by processing the output.
Hope it helps.
Thanks

Wit Quick Replies in Context

I am working on WIT Chat Bot... i have a story, in that i am asking for the quick replies Yes or No. if user press Yes or No. I have to make another call on WIT with context. So how can i set quick replies into context. how to handle quick replies.
i have tried for another contexts i am updating context like below..
context.getContext().remove("reasons_cancellation");
context.getContext().put("cancelbutton_pressed", true);
but i am not sure with quick reply keys and possible values
If I understand you correctly, you are looking to handle yes_no entity of quick replies feature in wit.ai.
In case of handling quick replies like yes/no, you would need to add 'Yes' and 'No' as quick replies to very latest 'bot says' statement.
After that, you need to have Yes & No as User's next response statement. Note, Yes & No would need to be shown as branch. In user response of yes/no, use yes_no entities with value of yes or no in respective branches.
Once this is specified, specify an action with a name. yes_no entity will be passed to the action. In your action implementation (your server side logic), you need to retrieve value of yes_no entity, use it and assign the value in context when needed.
Hope this helps.

Which fields are required to create an event through Social Tables API

I have the following questions that I was not clear on from the API documentation:
Which fields are required to create an event?
What does "Invalid field: 0" mean? (this was an error message received when trying to create an event)
The sample body includes "spaces" as string -- is this the space name or ID?
Is this required? If yes, to create a space I need an event ID but to create an event do I need a space?
Hey thanks for using our API. It looks like the developer docs on our portal got kind of mangled. We'll be working on fixing that soon.
In the meantime, let me try to help.
So, the actual required fields for that endpoint are very minimal, here is a small sample post I made for a room here at Social Tables:
{
"name": "Dan's Office Party",
"category": "Other",
"spaces": [
{
"name": "st test"
}
]
}
The key thing here is that spaces is an array, with at least a name property attached.
The error message you referred to is a failing validation check on the type of one of the fields you submitted.
You do need a space to create an event, but as you can see, only the name is absolutely required. However, if you want to do any diagramming with that event, you'll probably want to attach a venue_id with one of our floorplan IDs in addition to the name property.
I have created an issue to update the mangled doc located at https://developer.socialtables.com/api-console#!/Events/post_4_0_legacyvm3_teams_team_events and will comment here when it is updated.

How to get with Mediawiki API all images in a category which are not in another one?

I am entirely new to API, so sorry if the question is silly.
I would like to get all images in a category in Commons let's say X, but exclude those which are also in another one (Y). I do not understand if I can actually do this.
https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&cmtype=file&cmtitle=Category:X
will get all of them, how to exclude some?
moreover I would like in the result to have the description of the images, not just the name of the file, is that possible?
MediaWiki has - by default - no built-in support for category building and querying intersections. To accomplish this task, extensions or external tools or multiple API queries and result processing is required.
CirrusSearch API
On Wikimedia Commons, like on the whole Wikimedia Wiki farm, CirrusSearch powers filtered search, including search for category intersections and is also available through API (action=query&list=search&srsearch=incategory:A+-incategory:B, this is Category:A minus Category:B).
FastCCI
One of the tools I can recommend (because it's a dedicated high-performance solution and actually running) is fastcci, developed by Daniel Schwen; specifically for Wikimedia Commons, there is already a database maintained and a webservice running but it's possible to set it up for any wiki, provided the tool set has a host to run on and has database access.
Query
Consider the following query URL:
https://fastcci.wmflabs.org/?c1=3302993&c2=15516712&d1=0&d2=0&s=200&a=not&t=js
https://fastcci.wmflabs.org/ - Host Wikimedia Commons fastcci runs on
c1 - ID of category 1
c2 - ID of category 2
d1 - depth of category 1 to search in (fastcci by default considers sub-categories)
d2 - depth of category 2 to search in (fastcci by default considers sub-categories)
s - Number or results to return
o - Offset
a - conjunction
t - connection type (t=js for a JSONP response; otherwise assumes being used as websocket)
Response
fastcciCallback( [ 'RESULT 27572680,0,0|1675043,0,0|27577015,0,0|27577043,0,0|27577106,0,0|27576896,0,0|27576790,0,0|23481936,0,0|17560964,0,0|11009066,0,0', 'OUTOF 10', 'DBAGE 378310', 'DONE'] );
RESULT followed by a | separated list of up to 50 integer triplets of the form pageId,depth,tag. Each triplet stands for one image or category
Resources
Sample client side implementation - to see it in action, just visit any category and next to the Good pictures button in any category page.
Example is FilesOf('Category:Saaleck') - FilesOf('Category:Rapeseed fields in Saxony-Anhalt')
Server application
Presentation on YouTube
Slides
A note on pageIDs
page IDs → page titles: GET /w/api.php?action=query&pageids=page_IDs_separated_by_pipe
page titles → page IDs: GET /w/api.php?action=query&titles=Titles_separated_by_pipe
AFAIK, there is no way to get that directly using the API. But, assuming both categories are reasonably small, you could get all images from both of them and then compute the complement in your code.
To retrieve the description, you can use prop=imageinfo&iiprop=extmetadata&iiextmetadatafilter=ImageDescription.
In the context of your example query, it would look like this:
https://commons.wikimedia.org/w/api.php?action=query&generator=categorymembers&gcmtype=file&gcmtitle=Category:X&prop=imageinfo&iiprop=extmetadata&iiextmetadatafilter=ImageDescription

Rally print stories with parent feature name in the card generated

I've used Joel Krooswyk's Print All Backlog Story Cards solution for printing all stories in a backlog.
What I'd like to do is to extend this to have each card print the name of the parent feature that the card belongs to so I can print them all up and lay them on a table for a collaborative estimation session.
The issue is, I'm having trouble finding how to do it.
A snippet of his code in question:
queryArray[0] = {
key: CARD_TYPE,
type: 'hierarchicalrequirement',
query: '((Iteration.Name = "") AND (Release.Name = ""))',
fetch: 'Name,Iteration,Owner,FormattedID,PlanEstimate,ObjectID,Description,UserName',
order: 'Rank'
};
I can't seem to find the element to fetch!
Parent was listed on an example queries page(intended for use in the browser query functionality), with Parent.Name containing the actual text but so that hasn't worked - trying to find a reference that is clear about it seems to be eluding me.
I've looked at the type definition located at:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/?fetch=ObjectID&pagesize=100&pretty=true
Going to the hierarchical requirement's type definition from that page indicates it has a Parent field in one form or another.
I'm not even sure that that one will solve what I'm looking at.
A bit stuck, and I'm not sure what I'm trying to do is even possible with the hierarchical requirement object type.
Note: I assume even if I do find it I'll need to add some code to deal parentless stories- not worried about that though, that's easy enough to deal with once I find the actual value.
Many thanks to anyone who can help :)
I modified Joel's app to include PI/Feature's FormattedID to the cards when a story has a parent PI/Feature.
You may see the code in this github repo.
Parent field of a user story references another user story.
If you want to read a parent portfolio item of a user story, which is a Feature object, use Feature attribute or PortfolioItem attribute. Both will work:
if (data[i].PortfolioItem) {
//feature = data[i].PortfolioItem.FormattedID; //also works
//feature = data[i].Feature.Name; //also works
feature = data[i].Feature.FormattedID;
} else {
feature = "";
}
as long as the version of API is set in the code to 1.37 or above (up to 1.43).
PrintStoryCards app is AppSDK1 app.
1.33 is the latest version of AppSDK1.x
1.29, which the app is using is not aware of PortfoilioItems.
PortfolioItem was introduced in Rally in WS API version 1.37.
See API versioning section in the WS API documentation .
If you want to access Portfolio Items, or other features introduced in later versions of WS API up to 1.43 this syntax will allow it.
<script type="text/javascript" src="/apps/1.33/sdk.js?apiVersion=1.43"></script>
This has to be used with caution. One thing that definitely will break is around calculations of timebox start and end dates. That's why many legacy Rally App Catalog apps are still at 1.29.
This is due to changes in API Version 1.30.
Note that this method of setting a more advanced version of WS API for AppSDK1 does not work with v2.0 of WS API.
You should be able to add PortfolioItem to your fetch. Parent is the field used if the parent is a story. PortfolioItem is the field used if the parent is a Feature (or whatever your lowest level PI is).
Then in the results you can just get it like this:
var featureName = (story.PortfolioItem && story.PortfolioItem.Name) || 'None';