How to find all (zip code, city name) pair through OpenStreetMap? - gis

I want to find all zip code and its corresponding city name, country name in Europe.
My initial idea is to query osm data which contains tag like:
<tag k="addr:city" v="München"/>
<tag k="addr:country" v="DE"/>
<tag k="addr:housenumber" v="10"/>
<tag k="addr:postcode" v="80538"/>
The result should be a dictionary which key is the zip code and value is a tuple composed of city and country name.
How could I query the OSM, for example through http://overpass-turbo.eu/ to get the raw information? Is there any better way?

That kind of data structure you are looking for is the basis for every so called 'geocoder' as nominatim. I recommend to look over there: https://wiki.openstreetmap.org/wiki/Nominatim
https://wiki.openstreetmap.org/wiki/Nominatim/Development_overview

Related

How can I parse words when there is only Enter Mark between them in MySql?

I have an interesting data, Country names side by side, I need to get each one of them for spesific id.
I just don't know how can I parse those country names.
When I try to locate that mark,
select locate('¶',facility_country) from table_name,
it only returns me 0, doesn't work. I need to find a way to parse country names from that string.
for each id, I want to multiply my data on countries. Or maybe make a new dim table out of them: id and countries. In order to type my parse code or function, still not sure how to do it though but I can manage, I just need to locate that mark so I can separate.
I tried using Ascii, such like:
select CHAR(182);
This returns me the same mark.
select locate(CHAR(182),facility_country) from table_name;
When I try like that still I can't locate the mark, it only returns me 0.
How can I parse those county names with that Enter Mark? I have done similar things with "," or " " but first time I see something like that.
Edit: When I copy full text it looks like this after I paste:
USA
Australia
Brazil
Canada
France
Germany
Ireland
Israel
Italy
Netherlands
New Zealand
Switzerland
United Kingdom
(stackoverflow puts them side by side like that, on dbeaver this is what I see: )
edit2: #RiggsFolly requested this:
SELECT facility_country from clinical_trials LIMIT 5
output:
There are many lines like the line3.
edit3: #Tangentially Perpendicular solved it. We are looking at rendered image so we don't know what is the raw data, Apperantly its Char(10) and I can locate with it.

How to add multiple values to a claim in policy

I am working with API Management policy expressions and trying to create a claim with multiple values dynamically. I have a list of string values and want to create a claim values from that string list.
e.g "123232,43434,545455,5656565,676767" and i want to add these values to claim dynamically
<validate-jwt............>
<required-claims>
<claim name="test" match="any">
<value> </value> how can i create multiple value dynamically
</claim>
</required-claims>
</validate-jwt>
I think you can split the string to array and apply claims like below:
<required-claims>
<claim name="group" match="any">
<value>value[0]</value>
<value>value[1]</value>
</claim>
</required-claims>
Also refer https://learn.microsoft.com/en-us/azure/api-management/api-management-access-restriction-policies#authorize-access-to-operations-based-on-token-claims

Mapping Similarities based on Attributes

I have a CSV that looks like this:
Bob 123.com random.com something.something.com etc
Mike 123.com random.com something.something.something.com etc
Joe etc.com random.domain.com random.com something.com
The names are the labels I am using and the domain names are the attributes that I would want to connect to one another based on similarity (name of attribute). How can I do this without typing every single one of the labels and attributes?
Given your CSV file format, here is an example of how to create unique Person and Domain nodes, and the relationships between them:
LOAD CSV FROM 'url-of-csv' AS row
MERGE (p:Person {name: row[0]})
WITH p, TAIL(row) AS domains
UNWIND domains AS domain
MERGE (d:Domain {name: domain})
MERGE (p)-[:IN]->(d);
And there is an example of how you'd get all the people who are in the random.com domain:
MATCH (d:Domain {name: 'random.com'})<-[:IN]-(p:Person)
RETURN p;

How to identify unique entries in ccda file?

Basically, if user uploads same c-cda document again or other documents containing same entries of like medications, vitals, allergies, surgeries, etc than I want to make sure they do not get duplicated in database and want to skip those from inserting again.
Each entry inside an HL7 CDA could have an id attribute, which definition form HL7 V3 RIM is:
3.1.1.3
Act.id :: SET (0..N)
Definition:A unique identifier for the Act.
Use it in order to uniquely identify you entries, and avoid duplicates.
This element is not mandatory, but if you are implementing C-CDA, this template for substance administration specifies that this element is mandatory, so you should ask document sender to inform it. Here is a substance administration example form C-CDA:
<substanceAdministration classCode="SBADM" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.16"/>
<id root="cdbd33f0-6cde-11db-9fe1-0800200c9a66"/>
<text>
<reference value="#med1/>
Proventil 0.09 MG/ACTUAT inhalant solution, 2 puffs QID PRN wheezing
</text>
<statusCode code="completed"/>
<effectiveTime xsi:type="IVL_TS">
<low value="20110301"/>
<high value="20120301"/>
</effectiveTime>
<effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
<period value="6" unit="h"/>
</effectiveTime>
...
Martí
martipamies#vico.org

Parse JSON in Google Refine

I'm trying to pull out specific elements from results from the Data Science Toolkit coordinates2politics API, using Google Refine.
Here is sample cell #1:
[{"politics":[
{"type":"admin2","friendly_type":"country","code":"usa","name":"United States"},
{"type":"admin6","friendly_type":"county","code":"55_025","name":"Dane"},
{"type":"constituency","friendly_type":"constituency","code":"55_02","name":"Second district, WI"},
{"type":"admin5","friendly_type":"city","code":"55_48000","name":"Madison"},
{"type":"admin5","friendly_type":"city","code":"55_53675","name":"Monona"},
{"type":"admin4","friendly_type":"state","code":"us55","name":"Wisconsin"},
{"type":"neighborhood","friendly_type":"neighborhood","code":"Eastmorland|Madison|WI","name":"Eastmorland"}
],"location":{"longitude":"-89.3259404","latitude":"43.0859191"}}]
I added a column based on this column using this GREL syntax to pull out the county, Dane:
value.parseJson()[0]["politics"][1]["name"]
But when I got to Sample Cell #2, the syntax no longer works because the JSON result is a little different:
[{"politics":[
{"type":"admin2","friendly_type":"country","code":"usa","name":"United States"},
{"type":"constituency","friendly_type":"constituency","code":"55_05","name":"Fifth district, WI"},
{"type":"admin4","friendly_type":"state","code":"us55","name":"Wisconsin"},
{"type":"admin6","friendly_type":"county","code":"55_079","name":"Milwaukee"},
{"type":"admin5","friendly_type":"city","code":"55_84675","name":"Wauwatosa"},
{"type":"constituency","friendly_type":"constituency","code":"55_04","name":"Fourth district, WI"}
],"location":{"longitude":"-88.0075875","latitude":"43.0494572"}}]
Is there some way to sort the JSON or phrase my syntax so that I can find the county in either case?
Update
Here's the magic GREL that allowed me to find elements in the JSON string by name, not just position:
filter(value.parseJson()[0]["politics"], item, item["type"]=="admin6")[0]["name"]
The field named politics is an array, which you return with:
value.parseJson()[0]["politics"]
One element of that array is associated with the county (it's the one whose friendly_type field is "county"). So you need to filter the politics field to find the one whose friendly_type is county, like this:
filter(value.parseJson()[0]["politics"], item, item["friendly_type"]=="county")
That returns an array with one element. You want to get the name field out of that one element, so you need to extract the name of the zeroth array element, making your complete expression:
filter(value.parseJson()[0]["politics"], item, item["friendly_type"]=="county")[0]["name"]