Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
cf59df2
dev-Environmental-Exposure: add buffer creater for test purpose
jc2341 Dec 8, 2024
fce3b37
dev-Environmental-Exposure: add consolidated env_features obda
jc2341 Dec 8, 2024
c3dbfed
dev-Environmental-Exposure: add food hygiene rating query template fo…
jc2341 Dec 9, 2024
9c2556f
dev-Environmental-Exposure: add greenspace query template for env_fea…
jc2341 Dec 9, 2024
ad6eea0
devEnvironmental-Exposure: correct the naming typo
jc2341 Dec 9, 2024
5f38521
devEnvironmental-Exposure: tested OBDA and sparql to extract attribut…
jc2341 Dec 9, 2024
a714893
dev-Environmental-Exposure: optimise query efficiency for greenspace …
jc2341 Dec 9, 2024
adb9191
dev-Environmental-Exposure: add food hygiene extrator
jc2341 Dec 9, 2024
3fcbdb6
dev-Environmental-Exposure: create food hygiene rating extractor func…
jc2341 Dec 10, 2024
2c3f3bd
dev-Environmental-Exposure: create greenspace extractor function for …
jc2341 Dec 10, 2024
c3d84f8
dev-Environmental-Exposure: add exposure calculator
jc2341 Dec 11, 2024
2587533
dev-Environmental-Exposure: add a robust tool to extract trajectory m…
jc2341 Dec 12, 2024
d2e3392
dev-Environmental-Exposure: add config-properties file, summarise env…
jc2341 Dec 14, 2024
30381f2
dev-Environmental-Exposure: route file for exposure goal-based agent
jc2341 Dec 14, 2024
bc92f41
dev-Environmental-Exposure: tested http request with generic dataIRI
jc2341 Dec 17, 2024
50bce42
dev-Environmental-Exposure: correct typos or http filensme
jc2341 Dec 17, 2024
83cd8ba
dev-Environmental-Exposure: consolidate featuretype and domain name q…
jc2341 Dec 17, 2024
67dc338
dev-Environmental-Exposure: add feature type query templates
jc2341 Dec 17, 2024
ba1294f
dev-Environmental-Exposure: add function to fetch trajectory metedata…
jc2341 Dec 27, 2024
1ef3877
dev-Environmental-Exposure: update db connection function
jc2341 Dec 27, 2024
b80589f
dev-Environmental-Exposure: update package import info
jc2341 Dec 27, 2024
039cf0d
dev-Environmental-Exposure: update table name fetch function
jc2341 Dec 27, 2024
4c56e4d
dev-Environmental-Exposure: get time series data function
jc2341 Dec 28, 2024
d50b8ee
dev-Environmental-Exposure: add typing package and execute_query func…
jc2341 Dec 28, 2024
84cc9c8
dev-Environmental-Exposure: consolidate OBDA mapping for test purpose
jc2341 Dec 28, 2024
bf35330
dev-Environmental-Exposure: tested version of OBDA, support feature t…
jc2341 Jan 10, 2025
0735d1d
dev-Environmental-Exposure: add CORS package in deployment process
jc2341 Jan 10, 2025
06578dc
dev-Environmental-Exposure: add SPARQLWrapper package in deployment p…
jc2341 Jan 10, 2025
9f6d216
dev-Environmental-Exposure: app.py under testing
jc2341 Jan 13, 2025
65d8114
dev-Environmental-Exposure: generic query for env_feature type and do…
jc2341 Jan 13, 2025
2cebc10
dev-Environmental-Exposure: add AREA type of feature in http request …
jc2341 Jan 13, 2025
f1b6b3a
dev-Environmental-Exposure: tested version for generic query of Point…
jc2341 Jan 13, 2025
f374c4c
dev-Environmental-Exposure: generic query command use geosparql
jc2341 Jan 13, 2025
2b7fca9
dev-Environmental-Exposure: successful version: query feature type ge…
jc2341 Jan 14, 2025
59305a8
dev-Environmental-Exposure: debug settings(tasks.json) for vscode deb…
jc2341 Jan 14, 2025
99cdd0e
dev-Environmental-Exposure: debug settings(launch.json)
jc2341 Jan 14, 2025
f432d77
dev-Environmental-Exposure: remove comments in json file
jc2341 Jan 14, 2025
5b8cecb
dev-Environmental-Exposure: successful app: query feature type generi…
jc2341 Jan 15, 2025
4cd8d3f
dev-Environmental-Exposure: add geopandas package in docker settings
jc2341 Jan 15, 2025
3d1b841
dev-Environmental-Exposure: successful case for updating to db
jc2341 Jan 16, 2025
49bc202
dev-Environmental-Exposure: add fallbacks for env_extractor, increase…
jc2341 Jan 16, 2025
bf98694
dev-Environmental-Exposure: staticbuffer and greenpace query, source sql
jc2341 Jan 17, 2025
8a20389
dev-Environmental-Exposure: CumulativeTrajectoryQuery, source sql
jc2341 Jan 17, 2025
dacf35a
dev-Environmental-Exposure: optimised version by cache
jc2341 Jan 19, 2025
1c8ee45
dev-Environmental-Exposure: add equivalent sql command for trajectory…
jc2341 Jan 19, 2025
399d267
dev-Environmental-Exposure: placeholder explanation of equivalent sql…
jc2341 Jan 19, 2025
b94e3b3
dev-Environmental-Exposure: add equivalent sql command for trajectory…
jc2341 Jan 19, 2025
e57ad42
dev-Environmental-Exposure: link source table name to env feature nam…
jc2341 Jan 20, 2025
3e0fc5b
dev-Environmental-Exposure: sparql query for dataSourceName extraction
jc2341 Jan 20, 2025
0053cb5
dev-Environmental-Exposure: tested equivalent sql for instantiated gp…
jc2341 Jan 20, 2025
f04e405
dev-Environmental-Exposure: tested equivalent sql for greenspace and …
jc2341 Jan 20, 2025
dc653dd
dev-Environmental-Exposure: basic version for adding simplified expos…
jc2341 Jan 21, 2025
bd6c99e
dev-Environmental-Exposure: add fetch source table name function
jc2341 Jan 21, 2025
75f489d
dev-Environmental-Exposure: testing route for simplified exposure cal…
jc2341 Jan 21, 2025
3899a60
dev-Environmental-Exposure: add List and Dict pack for parameter tran…
jc2341 Jan 21, 2025
140133b
dev-Environmental-Exposure: recorded point: valid dataSourceName fetch
jc2341 Jan 21, 2025
f42930d
dev-Environmental-Exposure: tested route for environmental exposure c…
jc2341 Jan 21, 2025
c5cccab
dev-Environmental-Exposure: add time count for each critical step
jc2341 Jan 21, 2025
44afd37
dev-Environmental-Exposure: old version remove execute_qury function
jc2341 Jan 21, 2025
ec9f501
dev-Environmental-Exposure: new http request template for exposure ca…
jc2341 Jan 21, 2025
9ec6b1b
dev-Environmental-Exposure: add multiple trajectory IRI in example ht…
jc2341 Jan 22, 2025
9c19ce4
dev-Environmental-Exposure: rename template to exposure_count for bet…
jc2341 Jan 22, 2025
57c983f
dev-Environmental-Exposure: tested curl file for launch exposure count
jc2341 Jan 22, 2025
58edf14
dev-Environmental-Exposure: add curl command for exposure_count route
jc2341 Jan 22, 2025
bc75cb4
dev-Environmental-Exposure: amend the description section of agent ma…
jc2341 Jan 23, 2025
62c9045
dev-Environmental-Exposure: create hyperlink for tools mentioned in r…
jc2341 Jan 23, 2025
775824e
dev-Environmental-Exposure: create count-based exposure module, revis…
jc2341 Jan 23, 2025
b50809d
dev-Environmental-Exposure: add guildance for executing exposure_coun…
jc2341 Jan 23, 2025
c6e848a
dev-Environmental-Exposure: create hyperlink for config.properties
jc2341 Jan 23, 2025
3ed7656
dev-Environmental-Exposure: test the exposure route with remote servi…
jc2341 Jan 24, 2025
77abeda
dev-Environmental-Exposure: import tested route files
jc2341 Jan 24, 2025
4a9a53d
dev-Environmental-Exposure: correct the url_prefix for register_bluep…
jc2341 Jan 24, 2025
135c9eb
dev-Environmental-Exposure: correct the url in route.py
jc2341 Jan 24, 2025
5d6dae9
dev-Environmental-Exposure: Clean up the project history files and ke…
jc2341 Jan 24, 2025
4c73c92
dev-Environmental-Exposure: Corrected indexing of config.properties file
jc2341 Jan 24, 2025
baf62af
dev-Environmental-Exposure: Simplified OBDA statement in resources fo…
jc2341 Jan 24, 2025
5e7d093
dev-Environmental-Exposure: Create link for CURL and HTTP POST
jc2341 Jan 24, 2025
2694be3
dev-Environmental-Exposure: Adjust the logical order of the narrative…
jc2341 Jan 24, 2025
f8a63ea
dev-Environmental-Exposure: remove old-version config file placed und…
jc2341 Jan 24, 2025
3ca8108
dev-Environmental-Exposure: Enhance the explanation of ENV_DATA_ENDPO…
jc2341 Jan 24, 2025
69efbed
dev-Environmental-Exposure: Manage query commands by exposure type
jc2341 Jan 26, 2025
991771c
dev-Environmental-Exposure: add and test area query adapted to trajec…
jc2341 Jan 26, 2025
55b2c82
dev-Environmental-Exposure: add connect db function with try-execept …
jc2341 Jan 29, 2025
c162738
dev-Environmental-Exposure: remove outdated buffer creator
jc2341 Jan 31, 2025
bace66b
dev-Environmental-Exposure: remove area folder that stores tested que…
jc2341 Jan 31, 2025
9bf4912
dev-Environmental-Exposure: reset the Post url to localhost
jc2341 Jan 31, 2025
7df2488
dev-Environmental-Exposure: reset the Post url to localhost for prepr…
jc2341 Jan 31, 2025
d2f725e
dev-Environmental-Exposure: hide sensitive info in config property fi…
jc2341 Feb 1, 2025
9da73d4
dev-Environmental-Exposure: remove duplicated config.properties file
jc2341 Feb 2, 2025
ddba2a3
dev-Environmental-Exposure: remove test case, use sql template for be…
jc2341 Feb 3, 2025
73192f4
dev-Environmental-Exposure: remove test case, employ sparql template,…
jc2341 Feb 3, 2025
a5c6da1
dev-Environmental-Exposure: create exposure_utilities, use class to m…
jc2341 Feb 3, 2025
da67fc4
dev-Environmental-Exposure: reduce duplicated function syntax, import…
jc2341 Feb 4, 2025
5c3bcf5
dev-Environmental-Exposure: create SQL templates which are impoted in…
jc2341 Feb 4, 2025
c5b3747
dev-Environmental-Exposure: polish exposure utilities, employ the que…
jc2341 Feb 4, 2025
abb46d5
dev-Environmental-Exposure: sparql twmplate for food hygiene, greensp…
jc2341 Feb 4, 2025
acbee28
dev-Environmental-Exposure: remove outdated test_and_debug.py
jc2341 Feb 4, 2025
bcffed7
dev-Environmental-Exposure: correct the route url, remove unnecessary…
jc2341 Feb 4, 2025
fa87c5f
dev-Environmental-Exposure: tested version with modularised sql/sparq…
jc2341 Feb 4, 2025
729e4ec
dev-Environmental-Exposure: clean resource folder, remove outdated ob…
jc2341 Feb 6, 2025
75c576c
dev-Environmental-Exposure: import DB_URL, DB_USER and DATABASE Name …
jc2341 Feb 6, 2025
942974b
dev-Environmental-Exposure: remove redundant list of config.properties
jc2341 Feb 6, 2025
f74f1e1
dev-Environmental-Exposure: Upgrade numpy version to >=1.22 to meet r…
jc2341 Feb 7, 2025
71ec883
dev-Environmental-Exposure: sync pandas version to >=1.4.0 used on l…
jc2341 Feb 7, 2025
2b65963
dev-Environmental-Exposure: Adjust config file pointer
jc2341 Feb 7, 2025
5325049
dev-Environmental-Exposure: Fix Dockerfile casing warning: change 'as…
jc2341 Feb 7, 2025
c600db5
dev-Environmental-Exposure: Remove version field from Docker Compose …
jc2341 Feb 7, 2025
23cea9b
dev-Environmental-Exposure: Remove version field from Docker Compose …
jc2341 Feb 7, 2025
d81cf59
dev-Environmental-Exposure: resolve f-string warning mainly in sparql…
jc2341 Feb 12, 2025
a1a2f09
dev-Environmental-Exposure: add digital ocean stack url
jc2341 Feb 12, 2025
06bbaa2
dev-Environmental-Exposure: add digital ocean stack url in curl for r…
jc2341 Feb 12, 2025
d9c9726
dev-Environmental-Exposure: added executeable permission for all .sh …
jc2341 Feb 12, 2025
73b2296
dev-Environmental-Exposure: change git executable bit, make .sh scrip…
jc2341 Feb 12, 2025
51f0d7d
dev-Environmental-Exposure: create cleanning tool for raw gps data
jc2341 Feb 13, 2025
ecc5219
dev-Environmental-Exposure: add cleaedning tool in gps route, test ve…
jc2341 Feb 13, 2025
edad8b0
dev-Environmental-Exposure: remove outdated config file and unused se…
jc2341 Feb 13, 2025
1525e15
dev-Environmental-Exposure:benchmark, successful code for processing …
jc2341 Feb 13, 2025
359b4bb
dev-Environmental-Exposure: create .env for targetfolder path, create…
jc2341 Feb 13, 2025
5c49184
dev-Environmental-Exposure: benchmark: successful code for bind mount…
jc2341 Feb 14, 2025
758fb85
dev-Environmental-Exposure:replace absoulte path of input folder with…
jc2341 Feb 14, 2025
c6996e3
dev-Environmental-Exposure:replac remove inaccurate http url in 4.2 s…
jc2341 Feb 14, 2025
8efa673
dev-Environmental-Exposure: consolidate the description in data inges…
jc2341 Feb 15, 2025
f9a38e2
dev-Environmental-Exposure: polish the json files used in docker swarm
jc2341 Feb 15, 2025
5f07829
dev-Environmental-Exposure: add functionality description for bind mount
jc2341 Feb 16, 2025
82b35f8
dev-Environmental-Exposure: new bind mount method learnt from Feature…
jc2341 Feb 18, 2025
e5991dc
dev-Environmental-Exposure: remove unnecessary operation that copy xu…
jc2341 Feb 18, 2025
4122f78
dev-Environmental-Exposure: use localhost as url examples
jc2341 Feb 19, 2025
addedc5
dev-Environmental-Exposure: correct config,properties file, use local…
jc2341 Feb 19, 2025
a4ba55a
dev-Environmental-Exposure: correct config,properties file, revise re…
jc2341 Feb 19, 2025
abdf030
dev-Environmental-Exposure: use prepraring instead of placing to get …
jc2341 Feb 19, 2025
b1e253a
dev-Environmental-Exposure: update route file and http request templa…
jc2341 Feb 19, 2025
c3759c1
dev-Environmental-Exposure: upgrade cleaning tool, includes flipping …
jc2341 Feb 19, 2025
ec4b0f8
dev-Environmental-Exposure: add treatment for abnormal spacing of col…
jc2341 Feb 20, 2025
f82c071
dev-Environmental-Exposure: improve the direction determination logic…
jc2341 Feb 20, 2025
7fcac81
dev-Environmental-Exposure: add time slicing filter, modify count exp…
jc2341 Feb 24, 2025
3aedcac
dev-Environmental-Exposure: remove duplicated cleaning operation for …
jc2341 Feb 28, 2025
2536ae0
dev-Environmental-Exposure: add def update_unix_time to create a Unix…
jc2341 Mar 1, 2025
1b85cb8
dev-Environmental-Exposure: merge unix crator function into gps task …
jc2341 Mar 2, 2025
a9879ea
dev-Environmental-Exposure: add absolute time filter sparql template
jc2341 Apr 1, 2025
1a98df1
dev-Environmental-Exposure: update greenspace query template used in …
jc2341 Apr 1, 2025
f9ee3cb
dev-Environmental-Exposure: update opening hours extractor based on o…
jc2341 Apr 7, 2025
00d93cc
dev-Environmental-Exposure: clean the code for absolute filter templa…
jc2341 Apr 7, 2025
6ea5eb9
dev-Environmental-Exposure: new route to absorb absolute time filter
jc2341 Apr 7, 2025
ba2b9fe
dev-Environmental-Exposure: update gps_client.py, remove duplicated l…
jc2341 Apr 7, 2025
5c07cdc
dev-Environmental-Exposure: update relative time filter basic lib
jc2341 Apr 15, 2025
4b0e07a
dev-Environmental-Exposure: function lib for solution a and b, will b…
jc2341 Apr 16, 2025
f2a4b35
dev-Environmental-Exposure: change notation for placeholder function,…
jc2341 Apr 19, 2025
fda8bc3
dev-Environmental-Exposure: add an aotumatic srid extraction query, …
jc2341 Apr 20, 2025
958dd70
dev-Environmental-Exposure: add flexible process function for area ty…
jc2341 Apr 21, 2025
03c0f3b
dev-Environmental-Exposure: benchmark: tested version for agent with …
jc2341 Apr 21, 2025
5af28ef
dev-Environmental-Exposure: benchmark: temporarily include trip detec…
jc2341 Apr 23, 2025
4810713
dev-Environmental-Exposure: add guidance for setting config file andp…
jc2341 Apr 23, 2025
7d6ee72
dev-Environmental-Exposure: remove unnecessary comments from gps client
jc2341 Apr 25, 2025
0382e34
dev-Environmental-Exposure: get_timeseries_fallback table name has an…
jc2341 Apr 25, 2025
11eb3a8
dev-Environmental-Exposure: resolved an issue with trajectory-iri han…
jc2341 Apr 27, 2025
b217165
dev-Environmental-Exposure: add exposure at time module for point fea…
jc2341 Jun 23, 2025
917efe2
dev-Environmental-Exposure: fix the write-back problem for exposure-a…
jc2341 Jun 23, 2025
e0f4617
dev-Environmental-Exposure: update new module for area-at-time exposu…
jc2341 Jun 24, 2025
04d2e44
dev-Environmental-Exposure: add initial value (-1) for result columns…
jc2341 Aug 7, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def norm_col(col):
ew_column_name = "E/W" # Optional additional direction column for longitude

columns_to_clean = [
utc_date_column_name,
utc_time_column_name,
latitude_column_name,
longitude_column_name,
speed_column_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def process_gps_csv_file(csv_file):
if not all(column in df.columns for column in required_columns) or df[required_columns].isnull().any().any():
logger.warning(f"Skipping {csv_file} due to missing or incomplete required columns.")
return None
try:
point_class = StackClient.stackClients_view.Point().getClass()
logger.info(f"Point class imported successfully")
except Exception as e:
logger.error(f"Failed to create Point instance: {e}")
raise e
# try:
# point_class = StackClient.stackClients_view.Point().getClass()
# logger.info(f"Point class imported successfully")
# except Exception as e:
# logger.error(f"Failed to create Point instance: {e}")
# raise e
# point_class = StackClient.stackClients_view.Point
points = [StackClient.stackClients_view.Point(row['LONGITUDE'], row['LATITUDE']) for _, row in df.iterrows()]
return {
Expand Down Expand Up @@ -171,6 +171,40 @@ def instantiate_gps_data(gps_object, kg_client, ts_client, double_class, point_c
logger.error(f"Error instantiating data for {gps_object['object']}: {e}")
raise

def update_unix_time(ts_client, dataIRI):
"""
This function is used to add a UNIX column for the timeseries data instantiated by TSClient
Note that TSClient has autoCommit settings, thus conn.commit() has been removed in this function
"""
try:
with ts_client.connect() as conn:
stmt = conn.createStatement()
sql_find = f'''
SELECT "tableName"
FROM "dbTable"
WHERE "dataIRI" = '{dataIRI}'
'''
rs = stmt.executeQuery(sql_find)
if rs.next():
table_name = rs.getString("tableName")
sql_alter = f'''
ALTER TABLE "{table_name}"
ADD COLUMN IF NOT EXISTS "UNIX_time" BIGINT;
'''
stmt.execute(sql_alter)
sql_update = f'''
UPDATE "{table_name}"
SET "UNIX_time" = (EXTRACT(EPOCH FROM "time") * 1000)::BIGINT
'''
stmt.execute(sql_update)
logger.info(f"UNIX_time column updated for table: {table_name}")
else:
logger.warning(f"No matching table found in dbTable for dataIRI={dataIRI}")
stmt.close()
return True
except Exception as e:
logger.error("Error updating UNIX_time column via TSClient: %s", e)
return False

if __name__ == '__main__':
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PREFIX fh: <http://www.theworldavatar.com/ontology/OntoFHRS/>
PREFIX ies4: <http://ies.data.gov.uk/ontology/ies4#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?be ?geometry ?wkt ?lat ?long
WHERE {{
BIND("{given_time}"^^xsd:dateTimeStamp AS ?givenTime)
BIND(SUBSTR(STR(?givenTime), 1, 4) AS ?timeYear)
?be a fh:BusinessEstablishment ;
geo:hasGeometry ?geometry .
FILTER(CONTAINS(STR(?geometry), CONCAT("/", ?timeYear)))
?geometry geo:asWKT ?wkt .
OPTIONAL {{ ?geometry wgs:lat ?lat . }}
OPTIONAL {{ ?geometry wgs:long ?long . }}
?startEvent ies4:isStartOf ?be ;
ies4:inPeriod ?startPeriod .
?startPeriod ies4:iso8601PeriodRepresentation ?startTime .
?endEvent ies4:isEndOf ?be ;
ies4:inPeriod ?endPeriod .
?endPeriod ies4:iso8601PeriodRepresentation ?endTime .
FILTER(?startTime <= ?givenTime && ?endTime >= ?givenTime)
}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX geo: <http://www.opengis.net/ont/geosparql#>

SELECT DISTINCT ?crs WHERE {{
?feature a <{env_data_iri}> ;
geo:hasGeometry/geo:crs ?crs .
}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the name of this file misleading? How about get_greenspace_geometry.sparql?

Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
PREFIX gs: <https://www.theworldavatar.com/kg/ontogreenspace/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT ?feature ?function ?geometry
PREFIX ex: <http://example.org/ns#>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely this is not an appropriate namespace for hasWKB?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


SELECT DISTINCT ?feature ?function ?geometry
WHERE {{
?feature gs:isPartOfDomain <{env_data_iri}> ;
gs:hasFunction ?function .
?geoPoint gs:isPartOf ?feature ;
geo:hasGeometry ?geometry .
}}
?feature a gs:Greenspace ;
a geo:Feature ;
gs:hasFunction ?function ;
geo:hasGeometry ?geomNode .
?geomNode ex:hasWKB ?geometry .
}}
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
SELECT "time", "column1", "column2", "column3", "column4", "column5", "column6", "column7"
FROM "{table_name}";
SELECT
to_timestamp("UNIX_time" / 1000.0) AT TIME ZONE 'UTC' AS "time",
"column1",
"column2",
"column3",
"column4",
"column5",
"column6",
"column7"
FROM "{table_name}"
ORDER BY "UNIX_time" ASC;
Loading