-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CORS and Handle query by WKT (#33)
* adding openapi using boilerplate * adding openapi using boilerplate * update index * remove prefix * add openapi v3 instead * use openapi v3 * add conneg mime types * add params and minor updates to api spec * update openapi spec as per discussions * update openapi spec searchGeomByPositionAndDataset * add /dataset endpoint * first version of /datasets/ impl * adding dataset template * adding backend code to render dataset * update templates * update openapi with dataset/item endpoint * adding proxyfix * add werkqeug * fix werkzeug bug * potential fix for pg too many clients. set to autocommit * add db conn pool * adding expplicit commit statement * wrap connections in a try-finally block * revising mapping from contractedcatchment * handle dbconn if down * update layout to point to the single layout template * if no_items none, then use 0 * update geom view page to use single layout * alternates to use single layout * adding first code for search by wkt * first cut at find by wkt intersect * adding find by wkt and gis op * fix CORS and use POST body for /wkt * splitting out mappings to a separate file. load in via read file
- Loading branch information
Showing
7 changed files
with
138 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"asgs16_sa1": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel1", | ||
"asgs16_sa2": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel2", | ||
"asgs16_sa3": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel3", | ||
"asgs16_sa4": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel4", | ||
"asgs16_mb": "http://linked.data.gov.au/dataset/asgs2016/meshblock", | ||
"asgs16_ste": "http://linked.data.gov.au/dataset/asgs2016/stateorterritory", | ||
"asgs16_sua": "http://linked.data.gov.au/dataset/asgs2016/significanturbanarea", | ||
"asgs16_ireg": "http://linked.data.gov.au/dataset/asgs2016/indigenousregion", | ||
"asgs16_iloc": "http://linked.data.gov.au/dataset/asgs2016/indigenouslocation", | ||
"asgs16_iare": "http://linked.data.gov.au/dataset/asgs2016/indigenousarea", | ||
"asgs16_ra": "http://linked.data.gov.au/dataset/asgs2016/remotenessarea", | ||
"asgs16_gccsa": "http://linked.data.gov.au/dataset/asgs2016/greatercapitalcitystatisticalarea", | ||
"asgs16_ucl": "http://linked.data.gov.au/dataset/asgs2016/urbancentreandlocality", | ||
"asgs16_sosr": "http://linked.data.gov.au/dataset/asgs2016/sectionofstaterange", | ||
"asgs16_sos": "http://linked.data.gov.au/dataset/asgs2016/sectionofstate", | ||
"asgs16_lga": "http://linked.data.gov.au/dataset/asgs2016/localgovernmentarea", | ||
"asgs16_ced": "http://linked.data.gov.au/dataset/asgs2016/commonwealthelectoraldivision", | ||
"asgs16_ssc": "http://linked.data.gov.au/dataset/asgs2016/statesuburb", | ||
"asgs16_nrmr": "http://linked.data.gov.au/dataset/asgs2016/naturalresourcemanagementregion", | ||
"geofabric2_1_1_contractedcatchment": "http://linked.data.gov.au/dataset/geofabric/contractedcatchment", | ||
"geofabric2_1_1_riverregion": "http://linked.data.gov.au/dataset/geofabric/riverregion", | ||
"geofabric2_1_1_awradrainagedivision": "http://linked.data.gov.au/dataset/geofabric/drainagedivision" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
import json | ||
import sys | ||
from importlib_resources import files | ||
|
||
class DatasetMappings(): | ||
DATASET_RESOURCE_BASE_URI_LOOKUP = { | ||
"asgs16_sa1": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel1", | ||
"asgs16_sa2": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel2", | ||
"asgs16_sa3": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel3", | ||
"asgs16_sa4": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel4", | ||
"asgs16_mb": "http://linked.data.gov.au/dataset/asgs2016/meshblock", | ||
"asgs16_ste": "http://linked.data.gov.au/dataset/asgs2016/stateorterritory", | ||
"asgs16_sua": "http://linked.data.gov.au/dataset/asgs2016/significanturbanarea", | ||
"asgs16_ireg": "http://linked.data.gov.au/dataset/asgs2016/indigenousregion", | ||
"asgs16_iloc": "http://linked.data.gov.au/dataset/asgs2016/indigenouslocation", | ||
"asgs16_iare": "http://linked.data.gov.au/dataset/asgs2016/indigenousarea", | ||
"asgs16_ra": "http://linked.data.gov.au/dataset/asgs2016/remotenessarea", | ||
"asgs16_gccsa": "http://linked.data.gov.au/dataset/asgs2016/greatercapitalcitystatisticalarea", | ||
"asgs16_ucl": "http://linked.data.gov.au/dataset/asgs2016/urbancentreandlocality", | ||
"asgs16_sosr": "http://linked.data.gov.au/dataset/asgs2016/sectionofstaterange", | ||
"asgs16_sos": "http://linked.data.gov.au/dataset/asgs2016/sectionofstate", | ||
"asgs16_lga": "http://linked.data.gov.au/dataset/asgs2016/localgovernmentarea", | ||
"asgs16_ced": "http://linked.data.gov.au/dataset/asgs2016/commonwealthelectoraldivision", | ||
"asgs16_ssc": "http://linked.data.gov.au/dataset/asgs2016/statesuburb", | ||
"asgs16_nrmr": "http://linked.data.gov.au/dataset/asgs2016/naturalresourcemanagementregion", | ||
"geofabric2_1_1_contractedcatchment": "http://linked.data.gov.au/dataset/geofabric/contractedcatchment", | ||
"geofabric2_1_1_riverregion": "http://linked.data.gov.au/dataset/geofabric/riverregion", | ||
"geofabric2_1_1_awradrainagedivision": "http://linked.data.gov.au/dataset/geofabric/drainagedivision" | ||
} | ||
@classmethod | ||
def find_resource_uri(cls, dataset_type, dataset_local_id): | ||
prefix = cls.DATASET_RESOURCE_BASE_URI_LOOKUP.get(dataset_type) | ||
class DatasetMappings: | ||
DATASET_RESOURCE_BASE_URI_LOOKUP = {} | ||
|
||
def __init__(self): | ||
dict_lookup = {} | ||
jsonfile = files('model').joinpath('default_mappings.json').read_text() | ||
dict_lookup = json.loads(jsonfile) | ||
self.DATASET_RESOURCE_BASE_URI_LOOKUP = dict_lookup | ||
|
||
def find_resource_uri(self, dataset_type, dataset_local_id): | ||
prefix = self.DATASET_RESOURCE_BASE_URI_LOOKUP.get(dataset_type) | ||
if prefix is None: | ||
return None | ||
return "{0}/{1}".format(prefix, dataset_local_id) | ||
|
||
def get_prefix(self, dataset_type): | ||
return self.DATASET_RESOURCE_BASE_URI_LOOKUP.get(dataset_type) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ flask-cors | |
flask_swagger_ui | ||
flask-restplus | ||
Werkzeug | ||
python-dotenv | ||
importlib-resources |