Why does Tesco return T-mobile for this here-api query? - geocoding

Why does Tesco return T-mobile for this API query? https://discover.search.hereapi.com/v1/discover?at=52.5344,-1.9948&limit=1&q=Tesco&apiKey={INSERT_YOUR_API_KEY_HERE}
Response:
{"items":[{"title":"T-Mobile","id":"here:pds:place:826gcqdf-b4c4185edba2407f8ab7a5a3314c2d07","ontologyId":"here:cm:ontology:tesco","resultType":"place","address":{"label":"T-Mobile, West Bromwich, B70 8, United Kingdom","countryCode":"GBR","countryName":"United Kingdom","state":"England","countyCode":"WMD","county":"West Midlands","city":"West Bromwich","district":"West Bromwich","postalCode":"B70 8"},"position":{"lat":52.52075,"lng":-1.99064},"access":[{"lat":52.52111,"lng":-1.99158}],"distance":1547,"categories":[{"id":"600-6500-0073","name":"Mobile/Cell Phone Retailer","primary":true},{"id":"600-6500-0072","name":"Consumer Electronics Store"},{"id":"600-6500-0075","name":"Computer & Software"},{"id":"700-7100-0134","name":"Telephone Service"},{"id":"700-7200-0261","name":"IT and Office Equipment Services"},{"id":"700-7600-0116","name":"Gas Station"}],"chains":[{"id":"44"}],"contacts":[{"phone":[{"value":"+441215254794","categories":[{"id":"600-6500-0073"}]},{"value":"+443456102894"}],"www":[{"value":"http://www.t-mobile.co.uk","categories":[{"id":"600-6500-0073"}]},{"value":"http://www.youtube.com/lifesforsharing","categories":[{"id":"600-6500-0073"}]},{"value":"https://stores.tescomobile.com/west-midlands/west-bromwich/46-new-square?utm_source=extended_network&utm_medium=places&utm_campaign=WestBromwich_2335","categories":[{"id":"600-6500-0072"},{"id":"600-6500-0073"},{"id":"600-6500-0075"},{"id":"700-7100-0134"},{"id":"700-7200-0261"}]}],"email":[{"value":"Westbromwich#communityattesco.co.uk","categories":[{"id":"700-7600-0116"}]}]}],"openingHours":[{"categories":[{"id":"700-7600-0116"}],"text":["Mon-Sun: 00:00 - 23:59"],"isOpen":true,"structured":[{"start":"T000000","duration":"PT23H59M","recurrence":"FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA,SU"}]},{"categories":[{"id":"600-6500-0073"},{"id":"700-7200-0261"},{"id":"600-6500-0075"},{"id":"700-7100-0134"},{"id":"600-6500-0072"}],"text":["Mon-Sat: 09:00 - 18:00","Sun: 10:00 - 16:00"],"isOpen":false,"structured":[{"start":"T090000","duration":"PT09H00M","recurrence":"FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"},{"start":"T100000","duration":"PT06H00M","recurrence":"FREQ:DAILY;BYDAY:SU"}]}]}]}
{"mode":"full","isActive":false}

It looks T-Mobile place has wrong "ontologyId":"here:cm:ontology:tesco".
Expected result is "ontologyId":"here:cm:ontology:t-mobile".
It's reported in Mapcreator tool and takes some times to fix.

Related

Getting value between '-' in google sheets

Im trying to get the number between '-' and '-' in google sheets but after trying many things I still havent been able to find the solution.
Data record 1
England Premier League
West Ham vs Crystal Palace
2.090 - 3.47 - 3.770
Expected value = 3.47
Data record 2
England League Two
Carlisle vs Scunthorpe
2.830 - 3.15 - 2.820
Expected value = 3.15
Hopefully someone can help me out
Try either of the following
option 1.
=INDEX(IFERROR(REGEXEXTRACT(AE1:AE4," \d+\.\d+ ")*1))
option 2.
=INDEX(IFERROR(REGEXEXTRACT(AE1:AE4,".* - (\d+\.\d+) ")))
(Do adjust the formula according to your ranges and locale)
use:
=INDEX(IFNA(REGEXEXTRACT(A1:A, "- (\d+(?:.\d+)?) -")*1))

Using regex in Google Apps Script to extract number before a string

I receive a Gmail that contains text similar to that below. I only want to extract the number immediately before the string 'symbol(s)'. In this case that number would be 233, but it and the other contents of the email vary every day.
ZBH Zimmer Biomet Holdings Inc Medical Devices Healthcare NYSE 25,250 120.68 0.03 0.02 3,124,139
ZBRA Zebra Technologies Corp Cl A Communication Equipment Technology NASDAQ 19,620 368.14 -11.43 -3.01 626,763
ZION Zions Bancorp N.A. Banks - Regional Financial Services NASDAQ 8,580 57.47 0.46 0.81 1,507,253
ZTS Zoetis Inc Drug Manufacturers - Specialty Healthcare NYSE 83,530 175.14 0.47 0.27 2,152,320
233 symbol(s)
I have figured out how to extract everything before,
(?:(?!symbols(s)).)*
but I don't want everything, only the number '233'.
Thank you
Description
Regex is hard for most people to work with, myself included. Make your life easier. I would split the long text string into words and then search for "symbols(s)", then I know the number is just before that.
Script
function test2() {
try {
let text = "ZBH Zimmer Biomet Holdings Inc Medical Devices Healthcare NYSE 25,250 120.68 0.03 0.02 3,124,139 ZBRA Zebra Technologies Corp Cl A Communication Equipment \
Technology NASDAQ 19,620 368.14 -11.43 -3.01 626,763 ZION Zions Bancorp N.A. Banks - Regional Financial Services NASDAQ 8,580 57.47 0.46 0.81 1,507,253 ZTS Zoetis Inc \
Drug Manufacturers - Specialty Healthcare NYSE 83,530 175.14 0.47 0.27 2,152,320 233 symbol(s)";
text = text.split(" ");
let i = text.indexOf("symbol(s)");
console.log(text[i-1]);
}
catch(err) {
console.log(err);
}
}
Console.log
8:31:44 AM Notice Execution started
8:31:46 AM Info 233
8:31:44 AM Notice Execution completed
Reference
String.split()
Array.indexOf()
I like TheWizEd's approach, but in case you still want to try a regex, you can use the following:
\d*(?=\ssymbol)
It's called a lookahead assertion. It will match any number of digits before a space and the word "symbol".
If you really need to include the (s) at the end then you can use this one:
\d*(?=\ssymbol\(s\))
You can test it here with your sample text and it should work: https://regexr.com/

display regular date for FormattedRelative

I want to display friendly format date just like whatsapp and telegram do. For example, for today's date it shows "today" and yesterday date it shows "yesterday". But I don't want to show three days before as "3 days ago". It should be the regular date like this "Sun, 7 Jul 2019".
I don't have any custom to the current code because it still uses the example from the repo. But I tried to change the format but none of that works.
What does your code look like? You'd have to do some logic like
if (daysAgo > -2) {
return <FormattedRelativeTime numeric="auto" unit="day" value={daysAgo} />
}
return <FormattedDate weekday="short" day="numeric" month="short" year="numeric" value={ts} />

Yahoo Finance API .get_historical() not working python

So I recently downloaded the yahoo_finance API and its version 1.4.0. I got it a few days ago, and the .get_historical() was working fine. Now however, it doesn't. Heres what its doing:
import yahoo_finance as yf
apple=yf.Share('AAPL')
apple_price=apple.get_price()
print apple.get_historical('2016-02-15', '2016-04-29')
The error I get is:YQLResponseMalformedError: Response malformed. Is there a bug in the API or am I forgetting something?
The Yahoo Stock Price API doesn't work anymore, which a lot of modules are based on, unfortunately.
Alternatively, you could use Google's API
https://www.google.com/finance/getprices?q=1101&x=TPE&i=86400&p=3d&f=d,c,h,l,o,v
q=1101 is the stock quote
x=TPE is the exchange (List of Exchanges here: https://www.google.com/googlefinance/disclaimer/ )
i=86400 interval in seconds (86400 sec = 1 day)
p=3d data since how long ago
f= fields of data (d=date, c=close, h=high, l=low, o=open, v=volume)
Data would look like this:
EXCHANGE%3DTPE
MARKET_OPEN_MINUTE=540
MARKET_CLOSE_MINUTE=810
INTERVAL=86400
COLUMNS=DATE,CLOSE,HIGH,LOW,OPEN,VOLUME
DATA=
TIMEZONE_OFFSET=480
a1496295000,24.4,24.75,24.35,24.75,11782000
1,24.5,24.5,24.3,24.4,10747000
a1496295000 is the Unix timestamp of first row of data
the second row 1 is the interval offset from first row (offset 1 day)

Regex Pattern for String including newline characters

I am looking for a regex pattern that will return a match from %PDF-1.2 to and including %%EOF in the string below.
So far my patterns don't seem to work.
DOCUMENTS ACCEPTED
001//201//0E9136614////ACME 107 PTY LTD//8
**E10 End of validation report**
BDAT 4367 LAST
XSVBOUT
001XSVSEPRXXXOUT_TP.19
ZHDASCRA55 0700 8
ZCO*** TEST DATABASE ***ACME 107 PTY LTD 551824563 APTY LMSH PDF NSW 20111217 PNPC
ZIL 77000030149 Australian Securities and Investments Commission 86768265615 ZUMESOFT SOLUTIONS PTY LTD 61 buxton st north adelaide SA 5006
ZIAProprietary Company 42600 0E9136614 201 TAX INVOICE EXE 0 0E9136614201C PA 20111217 Not Subject to GST - Treasurer's Determination (Exempt Taxes, Fees and Charges)
ZTRENDRA55 5
%PDF-1.2
%????
3495
%%EOF
BDAT 11 LAST
/(?s)(%PDF-1\.2.+%%EOF)/ should solve your problem
If you are using an older flavor of regex the (?s) could be moved to the end of regex modifier like //s so.