Is it possible to simulate the 'contextual matching' from carousel/list elsewhere? - actions-on-google

When you present a Google Actions carousel/list on Assistant, you get a list of items. For example:
Soccer
Basketball
Rugby
Next, the user can say Soccer, Basketball or Rugby but not Tennis, Cycling, ... This means that the matching happens in the current context, as created by the carousel or list. This is powerful, as the backend service will only be called upon expected inputs.
I would like to have this behavior in a general conversion; that is, outside the carousel or list functionality. In my application, the user asks for a list of sports. The fulfillment service returns a list of suggested sports. Now the user can repeat a certain sport, to retrieve more information about that sport. If he mentions a sport which was not recently enumerated, an error message could be read out.
I know this could be implemented by keeping the list of mentioned sports in the context and checking against that context in the fulfillment backend service when the user ask for a specific sport. But as said, I noticed that the carousel or list already somehow provide such functionality, which does not rely on the backend service, so I was wondering if there was a better way to implement this behavior?
One way could be bookkeeping user entities during the conversation? That is, we could create a user entity user sport which only holds the sports as previously mentioned. This way, if the user asks for a sport not in that list, there will be a matching error. I am not sure if this is a good application of user entities, though.
Are there better ways?

You can use entities for this purpose. Create an entity for the desired list of values (i.e. Soccer, Basketball or Rugby) with an entity type of preferredSports (or similar). Then in a intent use the preferredSports entity in your training phrases and don't use names or sports or entity that don't include your desired list of values. The intent will probably not be matched unless a user says on of the values of the entities you're trying to capture. Learn more here: Entities docs, Intent docs

Related

Firebase cloud functions chess game Swift

I am making a chess app which has a Firebase backend, i am using cloud firestore and cloud functions. basically i am using node 8 to avoid billing issues on cloud functions, i can call and trigger, but i can't wrap my head about how to make an action happen on another device instead of on my own.
After authenticating and logging in, the user gets into a lobby which is a tableViewController and there are shown only the users that are currently logged in.
What i want to achieve is by tapping on a certain row the user that got the tap on it gets an alert shown for him which states whether he accepts the challenge or he declines it. Based on that i proceed to the game or do something else.
The question is though how to make this alert trigger on the other user's device?
Also i've seen some posts that it can be done with snapshotListener on a document, but again i run into the problem of understanding how to trigger the alert on another device. If you've got some other good ideas please share!
Thank you for any feedback!
I think snapshot listeners are really the only way to go. You could use other Firebase services but those aren’t the right tools for the job. Consider creating a collection, maybe call it requests:
[requests]
<userId-userId> (recipientUserId-initiatorUserId)
initiator: string
recipient: string
date: date
Each user has a snapshot listener that listens to this collection where their own userId is equal to recipient. You can add a date field to sort the list by most recent, for example. When a user wants to challenge another user, all they need to do is create a document in this collection:
<userId-userId> (recipientUserId-initiatorUserId)
initiator: myUserId
recipient: theirUserId
date: now
And the recipient's client will instantly see this document.
You could include dressing data in this document, like the initiator's display name or a path to their avatar. But this data may be stale by the time it's rendered so the alternative is to fetch the dressing data from the database using the userId. You could also auto-gen the document ID but if you configure it (like this), it can make operations like deleting simpler. You could also configure the userIds to be alphanumerical so only one request can exist between two users; but if they requested each other at the same time, one would overwrite the other and you'd have to handle that potential edge case. There are lots of things to consider but this is the starting point.

Analysis class diagram - associating classes

New user so I can't post images. Image link provided below:
http://i.stack.imgur.com/EXf0G.jpg
This is for a walk-in booking system not an online reservation system.
Normal Booking scenario:
User/Member gives information to receptionist. Users can book up to a month in-advance.
Receptionist searches user/member info. Receptionist must be logged in to search user/member or make a booking.
if details are found the booking continues as normal, if not user details are added to the users file.
Booking time/date/type is then checked for availability. If available then a booking is made.
Extra:
There are two types of staff account 'normal-user' (Receptionist) and 'admin' (Manager).
Manager can reset staff account passwords and create new staff accounts.
Manager can edit session details on the timetable (time, date, type) etc. Do i need a timetable class here??
In order to answer that, we would need a much more developed specification.
I would suggest you develop with what you have, meeting only the minimum requirements for each iteration. Then, if you find your users need a timetable of some sort, then add it at that point.
In general, don't add more complexity than you need until you know you need it. The more moving parts a system has, the harder it is to maintain and use and to put together in the first place. Get the application up and functioning and in the users' hands. Until you get real feedback from them, you are just taking stabs in the dark. Let the users' tell you what they need and want.

Triggering a workflow on the creation of a 1:N Relationship?

I am trying to run a workflow on the creation of a 1:n relationship.
I have a Contact entity, and PortalRole entity. When I associate the PortalRole with the contact I would like to trigger a workflow which sends out welcome emails to the users.
The PortalRoles are assigned to the contacts from a ribbon button which launches a HTML web resource and uses JSON / JQuery and the REST services to create the associations.
How can I call the workflow? I need to grab the Contacts email address and send them 1 of 2 emails depending on how many associations they have (new portal user or portal user gaining extra roles)
You should build your workflow for the PortalRole entity and trigger it from Create. You'll still be able to access Contact fields in the workflow.
The trick is in your last requirement - send "Email A" for the first role association and then "Email B" for the each additional association.
You could add a Yes/No field to Contact called "First Role Assigned." Your workflow would look something like this:
If Contact:FirstRoleAssigned = Yes
Send "Email B"
Else
Send "Email A"
Set Contact:FirstRoleAssigned = Yes
This blog post provides a very good explanation of dealing with relationships.
(So Many) Many-to-Many Options: Which to Use?
So…of these three approaches, which is best? As always, it depends on
what you need to do, but here are some rules of thumb you can use as
guidance:
Native N:N
Probably the easiest to configure but the most limiting. Use when you
only need to know that two records are connected to each other but you
don’t need additional information about the connection itself.
Examples:
Custom entity Industry with an N:N to Account Add a custom N:N
relationship between the Competitor and Territory entities to track
which competitors are active in which territories Custom entity Color
with an N:N to Contact (you don’t track your contacts’ favorite
colors???)
Manual N:N
A little more work to configure, but generally worth the effort. Use
when in addition to knowing two records are connected, you also need
information about the connection, such as its status, when it was
created and so forth.
Examples:
Associations and Members Events and Registrations (1:N from Contact
to Registration, 1:N from Event to Registration) Subscribers and
Subscriptions (1:N from Contact to custom entity “Subscription”, 1:N
from custom entity “Subscription Product” to Subscription)
Connections and Connection Roles
As I mentioned above, these are actually a specific implementation of
the Manual approach. And if you delve into this a little, you’ll find
that the Connection entity is a bona-fide customizable entity. You can
even customize it, adding custom fields to the connection form and so
forth. But…be careful about overdoing it: there’s only one Connection
entity, and customizations made for one Connection Role generally will
not be applicable to another one.
One specific advantage of these is that a single connection role can
connect records of different types (e.g., contacts can refer other
contacts, accounts and opportunities)
This is a judgment call, but I’d say to use these when you need to
track some information about the actual connections (such as when
they’re created and how many there are…), but not that much. Examples:
Referrals (Contact to Contact, Contact to Account, Contact to
Opportunity) Former Employee (Contact to Account, Lead to Account)
Board of Directors (Contact to custom entity “Board”, Lead to Board)
http://community.dynamics.com/product/crm/crmtechnical/b/richardknudson/archive/2011/05/08/many-to-many-relationships-in-dynamics-crm-2011.aspx

A personalized email algorithm

I've been delving into a lot of recommendation algorithms lately (collaborative filtering mostly) and I've found quite a lot of answers on recommending an item based on either a specific user or item (which is part of what I want to do, so that works out). I also want to sent out somewhat-personalized emails, meaning given an email with a certain set of products, pick a set of users to send out the email to.
What would be the best way/algorithm to go about doing this?
For this, you simply turn around the usual collaborative filtering process: instead of recommending items to users, you recommend users to items. You are therefore guessing which users will most like a given item.
Just feed in product IDs as "user IDs", and your real user IDs as "item IDs" into a collaborative filtering system like Apache Mahout. It will recommend users ("items") that would be best for any given email ("user").
Of course you still need input data. Perhaps you have collected a past history of which users have rated or bought or viewed products. That is still your input.

Form Journey Tracking using google analytics

Is there anyway, using google analytics, to track a user's journey/selections through a long form so I can see where they drop off?
I've created a 'contact us' form which starts with drop down menu which requires the user to make a choice i.e. apply for job, apply for funding etc. and then each option requires the user to fill out a form, which is completed over serval steps.
Is there a way to track a user's individual form choices from their initial selection on the Contact Us page through to the form being submitted? That way I could see where in the form journey the users are dropping off.
If the form is a multi-page form, then you can use Goal Funnel tracking to obtain reports which will help you understand how users fail to complete the form:
http://www.google.co.uk/support/googleanalytics/bin/answer.py?hl=en-uk&answer=55515
The Regular Expression matching in Goal Funnels is quite useful if you have different paths or different form URLs for the same goal. You could also track multiple page views per actual URL, if you wanted to monitor the users who move onto a different step on a single URL.
If you need to analyze how users complete a particular form, you could use Event Tracking to record when each field is completed. You will need to carefully think about how you wish to use Event Tracking to obtain the information you require.
http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
But Google Analytics is not good at tracking individual users' behavior. You may wish to take a look at ClickTale if you want to do more advanced form usage analysis.