Skip to content
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<img align="right" width="200" height="200" src="./docs/fia-logo.svg" alt="Feature Info Agent Logo">

This Feature Info Agent (FIA) acts as a single access point for [TWA Visualisations](https://github.com/cambridge-cares/TheWorldAvatar/wiki/TWA-Visualisations) to query for both meta and time series data of an individual feature (i.e. a single geographical location) so that it can then be displayed within the side panel of the visualisation.
This Feature Info Agent (FIA) acts as a single access point for [TWA viz](https://github.com/TheWorldAvatar/viz) instances to query for both meta and time series data of an individual feature (i.e. a single geographical location) so that it can then be displayed within the side panel of the visualisation.

Please see the [CHANGELOG](./CHANGELOG.md) file for details on recent changes; the latest available image of the FIA can be determined by viewing its [GitHub package page](https://github.com/cambridge-cares/TheWorldAvatar/pkgs/container/feature-info-agent).
Please see the [CHANGELOG](./CHANGELOG.md) file for details on recent changes; the latest available image of the FIA can be determined by viewing its [GitHub package page](https://github.com/TheWorldAvatar/pkgs/container/feature-info-agent).
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that package repo URL is correct. Also there isn't a image deployed to it yet.
Once an image has been deployed we'll know the URL for certain.


## Overview

Expand All @@ -18,7 +18,7 @@ These SPARQL queries are written on a class-by-class (TBox) basis; this should m

At the time of writing, the FIA has a few restrictions that all deploying developers should be aware of. These are as follows:

- The FIA can only be run within a [TWA Stack](https://github.com/cambridge-cares/TheWorldAvatar/tree/main/Deploy/stacks/dynamic/stack-manager).
- The FIA can only be run within a [TWA Stack](https://github.com/TheWorldAvatar/stack).
- The FIA can only report meta and time data that is contained within the same stack as the agent itself.
- The FIA can only return time series data on series that uses the [Instant](https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html) class.

Expand Down Expand Up @@ -74,7 +74,7 @@ For the FIA to function, a number of configuration steps need to take place befo

**Note:** As of version `3.0.0` of the FeatureInfoAgent, the configuration format has changed to support new options. The new format is documented below, but the older format is also supported. To support the newer features, it is recommended that developers write new configurations using the new format, and existing configurations are manually updated wherever possible.

Follow the below configuration steps within the `fia-queries` subdirectory of the TWA stack manager's data directory. Volumes that are used by containers running with the TWA Stack are populated by named subdirectories within the stack manager's [data directory](https://github.com/cambridge-cares/TheWorldAvatar/tree/main/Deploy/stacks/dynamic/stack-manager/inputs/data). For more details, read the [TWA Stack Manager documentation](https://github.com/cambridge-cares/TheWorldAvatar/tree/main/Deploy/stacks/dynamic/stack-manager).
Follow the below configuration steps within the `fia-queries` subdirectory of the TWA stack manager's data directory. Volumes that are used by containers running with the TWA Stack are populated by named subdirectories within the stack manager's [data directory](https://github.com/TheWorldAvatar/stack/tree/main/stack-manager/inputs/data). For more details, read the [TWA Stack Manager documentation](https://github.com/TheWorldAvatar/stack/tree/main/Deploy/stacks/dynamic/stack-manager).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Follow the below configuration steps within the `fia-queries` subdirectory of the TWA stack manager's data directory. Volumes that are used by containers running with the TWA Stack are populated by named subdirectories within the stack manager's [data directory](https://github.com/TheWorldAvatar/stack/tree/main/stack-manager/inputs/data). For more details, read the [TWA Stack Manager documentation](https://github.com/TheWorldAvatar/stack/tree/main/Deploy/stacks/dynamic/stack-manager).
Follow the below configuration steps within the `fia-queries` subdirectory of the TWA stack manager's data directory. Volumes that are used by containers running with the TWA Stack are populated by named subdirectories within the stack manager's [data directory](https://github.com/TheWorldAvatar/stack/tree/main/stack-manager/inputs/data). For more details, read the [TWA Stack Manager documentation](https://github.com/TheWorldAvatar/stack/tree/main/stack-manager).


The configuration file should be a JSON file named `fia-config.json`, contained within it should be:

Expand Down Expand Up @@ -195,7 +195,7 @@ The following HTTP request routes are available for the agent:

The FIA container is an optional built-in service in the stack; to enable it you need to create/modify the configuration file for that stack. An example of the changes required are described in the stack-manager readme file [here](../../Deploy/stacks/dynamic/stack-manager/README.md#adding-the-feature-info-agent). After spinning up the stack the agent should be accessible via the `/feature-info-agent` route.

Note that the version of the FIA run by the stack is determined by the stack manager itself; to use a custom (or newer) version, developers will need ensure the newer FIA image is built (either locally or uploaded to GitHub), then provide a custom service configuration (ideally a near-copy of the stack's default configuration for the FIA, found [here](https://github.com/cambridge-cares/TheWorldAvatar/blob/main/Deploy/stacks/dynamic/stack-clients/src/main/resources/com/cmclinnovations/stack/services/built-ins/feature-info-agent.json)) within the stack manager's `inputs/config/services` directory.
Note that the version of the FIA run by the stack is determined by the stack manager itself; to use a custom (or newer) version, developers will need ensure the newer FIA image is built (either locally or uploaded to GitHub), then provide a custom service configuration (ideally a near-copy of the stack's default configuration for the FIA, found [here](https://github.com/TheWorldAvatar/stack/blob/main/stack-clients/src/main/resources/com/cmclinnovations/stack/services/built-ins/feature-info-agent.json)) within the stack manager's `inputs/config/services` directory.

## Automated actions

Expand Down Expand Up @@ -228,7 +228,7 @@ For troubleshooting and FAQs, please see the [FIA Troubleshooting](./docs/troubl

The FIA is a simple HTTP agent written using the existing TWA agent framework. The core functionality of the agent is split across 4 classes; the central `FeatureInfoAgent` class that acts as the receiver and transmitter for HTTP requests, and classes that actually run logic (which should be self-explanatory): `ClassHandler`, `MetaHandler`, and `TimeHandler`.

The algorithm used to find, format, and return data after a request is received is detailed in the Mermaid diagram [here](./docs/mermaid-get-request.md) (although you can also read the in-code documentation for more details).
The algorithm used to find, format, and return data after a request is received is detailed in the flowchart diagram [here](./docs/mermaid-get-request.md) (although you can also read the in-code documentation for more details).

Building the Docker image for the FIA is automatically triggered under certain conditions (see above), but developers can also build a local copy using the provided `build.sh` script after supplying the required `repo_username.txt` and `repo_password.txt` files within the `credentials` directory.

Expand Down
4 changes: 3 additions & 1 deletion docs/mermaid-get-request.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Mermaid `GET` request
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Mermaid `GET` request
# `GET` request flowchart


```mermaid
graph TD
A[Incoming '/get' request] --> B{Is request valid?};
Expand All @@ -15,4 +17,4 @@ graph TD
M --> N[Query RDB for values];
N --> O[Format all data as JSON];
O --> P[Return OK code with JSON content];
```
```
3 changes: 1 addition & 2 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

This page offers some solutions for common issues, and answers to common questions, that may arise when using the FIA. Users that have encountered, and solved issues, are welcome to add to the table below.


| Issue/Question | Solution/Answer |
| ----------- | ----------- |
| Agent cannot find a class for my instance IRI. | This can happen when your KG (or Ontop mapping) does not contain the required triples to fulfil the class determination queries. You may need to add triples, or update your mapping until these queries return the expected class. |
| Agent still cannot find a class for my instance IRI. | When no `endpoint` parameter is present in the HTTP request, the agent will federate queries across all Blazegraph namespaces. The federation technology used by the agent framework sometimes fails to return valid results; try adding the `endpoint` parameter to your GeoServer table so it becomes present in requests. |
| Agent still cannot find a class for my instance IRI. | When no `endpoint` parameter is present in the HTTP request, the agent will federate queries across all Blazegraph namespaces. The federation technology used by the agent framework sometimes fails to return valid results; try adding the `endpoint` parameter to your GeoServer table so it becomes present in requests. |