Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address: change coordinates format #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions inspire_schemas/builders/conferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def add_address(
self,
cities=None,
country_code=None,
latitude=None,
longitude=None,
coordinates=None,
place_name=None,
postal_address=None,
postal_code=None,
Expand All @@ -97,8 +96,7 @@ def add_address(
Args:
cities (list): list of strings containing cities.
country_code (str): string of length 2 representing the country.
latitude (float): latitude of the location.
longitude (float): longitude of the location.
coordinates (dict(lon, lat)): a dict of coordinates for loaction
place_name (str): name of the specific place where this is located.
postal_address (str): full postal address in original language.
postal_code (str): postal code of the location.
Expand All @@ -108,8 +106,7 @@ def add_address(
'addresses',
cities=cities,
country_code=country_code,
latitude=latitude,
longitude=longitude,
coordinates=coordinates,
place_name=place_name,
postal_address=postal_address,
postal_code=postal_code,
Expand Down
12 changes: 4 additions & 8 deletions inspire_schemas/builders/seminars.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def set_address(
self,
cities=None,
country_code=None,
latitude=None,
longitude=None,
coordinates=None,
place_name=None,
postal_address=None,
postal_code=None,
Expand All @@ -78,8 +77,7 @@ def set_address(
Args:
cities (list): list of strings containing cities.
country_code (str): string of length 2 representing the country.
latitude (float): latitude of the location.
longitude (float): longitude of the location.
coordinates (dict(lon, lat)): coordinates of the loaction.
place_name (str): name of the specific place where this is located.
postal_address (str): full postal address in original language.
postal_code (str): postal code of the location.
Expand All @@ -91,10 +89,8 @@ def set_address(
address['cities'] = cities
if country_code:
address['country_code'] = country_code
if latitude:
address['latitude'] = latitude
if longitude:
address['longitude'] = longitude
if coordinates:
address['coordinates'] = coordinates
if place_name:
address['place_name'] = place_name
if postal_address:
Expand Down
12 changes: 2 additions & 10 deletions inspire_schemas/records/elements/address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,8 @@ properties:
uniqueItems: true
country_code:
$ref: country_code.json
latitude:
description: |-
:example: 50.7736
title: Latitude of the location
type: number
longitude:
description: |-
:example: 6.07532
title: Longitude of the location
type: number
coordinates:
$ref: coordinates.json
place_name:
description: |-
Name of the specific place where this is located.
Expand Down
12 changes: 12 additions & 0 deletions inspire_schemas/records/elements/coordinates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
additionalProperties: true
description: |-
Coordinates of the location
properties:
lon:
title: Longitude of the location
type: number
lat:
title: Latitude of the location
type: number
title: Coordinates of the location
type: object
6 changes: 4 additions & 2 deletions tests/integration/fixtures/conferences_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"sed sint ut"
],
"country_code": "HN",
"latitude": 98176984,
"longitude": -89125791,
"coordinates": {
"lon": 98176984,
"lat": -89125791
},
"place_name": "qui anim",
"postal_address": [
"qui",
Expand Down
26 changes: 16 additions & 10 deletions tests/integration/fixtures/institutions_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
"nisi deserunt eu cupidatat"
],
"country_code": "CF",
"latitude": 96958276,
"longitude": 58308717,
"coordinates": {
"lon": 96958276,
"lat": 58308717
},
"place_name": "anim nulla in",
"postal_address": [
"pariatur id sint irure in",
Expand All @@ -35,8 +37,6 @@
"consectetur nulla quis"
],
"country_code": "IS",
"latitude": -14558297,
"longitude": 55541699,
"place_name": "labore",
"postal_address": [
"sed laborum enim elit",
Expand All @@ -54,8 +54,10 @@
"ipsum"
],
"country_code": "KZ",
"latitude": 65627536,
"longitude": -93715142,
"coordinates": {
"lon": 65627536,
"lat": -93715142
},
"place_name": "tempor",
"postal_address": [
"ani",
Expand All @@ -70,8 +72,10 @@
"in labore sed labo"
],
"country_code": "NU",
"latitude": 80630464,
"longitude": -58695324,
"coordinates": {
"lon": 80630464,
"lat": -58695324
},
"place_name": "cillum cupidatat sed Lorem in",
"postal_address": [
"sed rep",
Expand All @@ -91,8 +95,10 @@
"velit quis pariatur"
],
"country_code": "MN",
"latitude": -76869123,
"longitude": 66796700,
"coordinates": {
"lon": -76869123,
"lat": 66796700
},
"place_name": "cupidatat",
"postal_address": [
"nostrud adipisicing sint Duis",
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/fixtures/seminars_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"mollit magna"
],
"country_code": "DK",
"latitude": 42002729,
"longitude": -69156711,
"coordinates": {
"lon": 42002729,
"lat": -69156711
},
"place_name": "et tempor Lorem mollit esse",
"postal_address": [
"nisi consectetur eu",
Expand Down