I am developing a customer care chat bot to resolve basic queries of customer for my e-commerce site. My order id is 13 digit long. To read queries like
"Please check my order status with id 9876566765432"
api.ai is unable to understand that it is order id. I have set entity type #sys.number. It is able to identify smaller number like 343434 etc. I have tried with #sys.number-integer, #sys.number-sequence but not working for long numbers. Pleas advise...
If you are using the enterprise edition you can use #sys.number-sequence.
Related
I have been downloading tonnes of tweets for the last few weeks. In order to reduce download time, I only saved tweet user ids not the user account. I need to pass them through a bot check but have now realised that 90% of the user ids are huge numbers (e.g. 1.25103113308656E+018) and cannot be used to search for the account.
Is there a way to convert these back to an account number?
Notes:
The tweet_id column is an equally huge, different number meaning they haven't been read into the wrong column.
When I raise them from the e notation into their raw number it still doesn't work.
I am limited by the week window of the twitter api so I must find a way of linking the data I have already got to individual accounts. This work is for a charitable cause and your help would be greatly appreciated.
The Tweepy API call returns a Response which contains the data in the _json field. You can parse the user key of the said json and extract the IDs and the screen name of the user and store it.
Then you can query the Tweepy api again as per their doc to get the user information.
Please make a note that when you store the ID field, you have to cast it to the String datatype.
I know we can use stripe customer id to retrieve list of cards attached to the customer id. Also, I know we can retrieve ONE specific card with the card's id....But what if I do not want to use the card id to retrieve the card. Instead I want to use exp month, year, last4. Is this possible?
I thought of
all_cards = stripe.Customer.retrieve(cus_id).sources.all(object=CARD)
the_card = all_cards.all(
exp_month=data.get(EXP_MONTH),
exp_year=data.get(EXP_YEAR),
last4=data.get(LAST_4)
)
but it says no such parameters such as exp_month
I thought of doing it in a way to loop through all the card and match the parameters which myself believes would be a bad idea if there is a better one.
Does anyone have a better idea or suggestions?
Thanks in advance for any advise
According to stripe documentation: no. https://stripe.com/docs/api/python#retrieve_card
There is a simple reason for that: the data might not be unique. Your customer, by some weird luck might have two or more cards ending the same month and year(well, actually that's not that weird) and with the same last 4 digits.
If you are working with some legacy system and need to retrieve some old data about the cards from Stripe, I'd create a management command to just fill the blanks: get the data from Stripe and attach card_id to the objects you already have.
Ps. you might be interested in this library: https://github.com/ArabellaTech/aa-stripe/ - disclaimer: I am one of the authors.
We have a table in Azure Table Storage that is storing a LOT of data in it (IoT stuff). We are attempting a simple migration away from Azure Tables Storage to our own data services.
I'm hoping to get a rough idea of how much data we are migrating exactly.
EG: 2,000,000 records for IoT device #1234.
The problem I am facing is in getting a count of all the records that are present in the table with some constrains (EG: Count all records pertaining to one IoT device #1234 etc etc).
I did some fair amount of research to find posts that say that this count feature is not implemented in the ATS. These posts however, were circa 2010 to 2014.
I'm assumed (hoped) that this feature has been implemented now since it's now 2017 and I'm trying to find docs to it.
I'm using python to interact with out ATS.
Could someone please post the link to the docs here that show how I can get the count of records using python (or even HTTP / rest etc)?
Or if someone knows for sure that this feature is still unavailable, that would help me move on as well and figure another way to go about things!
Thanks in advance!
Returning number of entities in the table storage is for sure not available in Azure Table Storage SDK and service. You could make a table scan query to return all entities from your table but if you have millions of these entities the query will probably time out. it is also going to have pretty big perf impact on your table. Alternatively you could try making segmented queries in a loop until you reach the end of the table.
Or if someone knows for sure that this feature is still unavailable,
that would help me move on as well and figure another way to go about
things!
This feature is still not available or in other words as of today there's no API which will give you a count of total number of rows in a table. You would have to write your own code to do so.
Could someone please post the link to the docs here that show how I
can get the count of records using python (or even HTTP / rest etc)?
For this you would need to list all entities in a table. Since you're only interested in the count, you can reduce the size response data by making use of Query Projection and fetching just one or two attributes of the entities (may be PartitionKey and RowKey). Please see my answer here for more details: Count rows within partition in Azure table storage.
Is it possible to get lifetime data from using facebookads api on python? I tried to use date_preset:lifetime and time_increment:1, but got a server error instead. And, then I found this on their website:
"We use data-per-call limits to prevent a query from retrieving too much data beyond what the system can handle. There are 2 types of data limits:
By number of rows in response, and
By number of data points required to compute the total, such as summary row."
Any way I can do this? And, another question, is there like any way to pull raw data from facebook ad account, like a dump of all the data that resides on facebook for an ad account?
The first thing is to try is to add the limit parameter, which limits the number of results returned per page.
However, if the account has a large amount of history, the likelihood is that the total amount of data is too great, and in this case, you'll have to query ranges of data.
As you're looking for data by individual day, I'd start trying to query for month blocks, and if this is still too much data, query for each date individually.
Background: I have app and web data, some of my apps (new iOS versions) use GA dimensions and the rest (Android and web) use GA custom variables.
So firstly, I'm currently trying to replicate this query in BigQuery in the Query Explorer to get simple user counts over a defined date for my web users only:
select count(distinct fullvisitorid, 10000000) as users
from table_date_range([12345678.ga_sessions_],
timestamp('2015-02-01'), timestamp('2015-03-01'))
where hits.customvariables.customvarvalue like '%web%'
I get around 5.34m users. This corresponds to what I see in Google Analytics. I am confident this figure is correct.
If I go into the Query Explorer and apply no filters (so I include my app and web users) I get 5.70m users. Again, this corresponds to Google Analytics and we're confident this figure is correct, web makes up the majority of our traffic.
If I run another query in Query Explorer but this time apply the filter:
ga:customVarValue1=#web
I get 8.73m users. So I have more users after applying the filter than without... obviously this isn't correct and has something to do with how the Query Explorer is applying the filter post aggregation.
Note: When I run this query in BigQuery:
select sum(users)
from (
select count(distinct fullvisitorid, 1000000) as users,
hits.customvariables.customvarvalue as platform
from table_date_range([12345678.ga_sessions_],
timestamp('2015-02-01'), timestamp('2015-03-01'))
group each by 2)
where platform like '%web%'
I get 8.73m users. Almost the exact same number as I get when applying the filter in Query Explorer, the difference I get of around 1% can be explained by the sampling. I've tested it on multiple dates so I'm sure this is what's happening. Applying the filter post aggregation instead of pre (as in my first BigQuery query) leads to a higher number of users because we had two web releases in this timeframe. So all users are being counted once for every version of web they used.
To add:
One of the developers on my team wrote some Python script back in February which replicated the first BigQuery code written above (a simple user count where the variable=web) but instead hits the Core Reporting API and requests an unsampled report. Until March 5th 2015 the number of users we got using BigQuery versus the Python script were almost identical (difference of 1% due to sampling). Then on March 5th they began to diverge, even for historical user counts, and instead our Python script started producing counts similar to the Query Explorer (filters being applied post aggregation instead of pre).
My question(s) are:
1. What changed on March 5th?
2. How do we replicate in Query explorer the first BigQuery code above? Are we applying the variable filter correctly?
3. How do we replicate the BigQuery code in our Python script which hits the Core reporting API?
Lastly:
When in Query Explorer I ask for user counts over a given date and instead use a dimension filter:
ga:dimension2=#ios
I get around 50% LESS than I get in BigQuery when running:
select count(distinct fullvisitorid, 10000000) as users
from table_date_range([12345678.ga_sessions_],
timestamp('2015-02-01'), timestamp('2015-03-01'))
where hits.customdimensions.value like '%ios%'
If the filter was being applied post aggregation as it is when filtering using variables then I would get a higher user count, not less. I seriously cannot explain what the Query Explorer is doing in order to give me substantially lower counts when filtering on dimensions.
Please halp
I don't have an answer for you, but since you're using BigQuery, I assume you are a Premium customer? If so, you can open a ticket with their support team - they should get back to you quickly.