Skip to content

Commit 2d835a1

Browse files
authored
Merge pull request #108 from MITLibraries/gdt-123-initial-adrs
Document initial architectural decisions related to GDT
2 parents 2f0d3fe + ddd874c commit 2d835a1

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# 2. Extend TIMDEX UI for GIS data
2+
3+
Date: 2024-01-24
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
The [GIS Data Tool (GDT) project](https://mitlibraries.atlassian.net/jira/software/c/projects/GDT/boards/225)
12+
requires a discovery interface for GIS data. The project team has made the decision to extend TIMDEX UI for this
13+
purpose.
14+
15+
This approach necessarily adds some complexity to the TIMDEX UI codebase. Generally, the UI design changes proposed for
16+
GDT fall into three categories:
17+
18+
* Changes that are unique to the GDT app (e.g., app name in the header, 'Ask GIS' sidebar widget);
19+
* Changes that should apply to all TIMDEX UI apps (e.g., filter sidebar redesign, IA enhancements); and
20+
* Changes that are currenty unique to the GDT app, but may later apply other other TIMDEX UI apps (e.g., geospatial
21+
querying, filters that are specific to geospatial data).
22+
23+
General UI enhancements should be straightforward to implement across all TIMDEX UI applications. However, we will also
24+
need to develop the GDT UI without disrupting existing TIMDEX UI implementations, while considering the future
25+
possibility of integrating geospatial search into those applications.
26+
27+
These are the potential solutions we have considered:
28+
29+
### Feature flags
30+
31+
Using the [`flipflop` gem](https://github.com/voormedia/flipflop), we can add a `GDT` feature that is toggled by an
32+
environment variable. We've implemented this in many of our Rails apps and found that it's an effective way to manage
33+
multiple versions of an application (most recently, in TIMDEX API). The downside of using `flipflop` is that it does
34+
not appear to be especially well maintained, but we're familiar with it and have used it successfully in the past.
35+
36+
### Index detection
37+
38+
Since geospatial records will be in a separate index at first, we can check for the index the app is using (currently
39+
defined in in an environment variable) to determine which UI elements to display and which type of query to construct.
40+
This would solve the problem similarly to feature flags. It does not account for the possible future state of geospatial
41+
data existing in other indices, but it could solve the immediate need of maintaining GDT features separately.
42+
43+
### Search params
44+
45+
Bento uses a `target` param to identify which source is being queried. We could implement a similar design pattern in
46+
TIMDEX UI to distinguish between geospatial queries and 'general' queries. This would likely include a boolean in the
47+
search form that would trigger a geospatial query. In addition to providing the query target, we could use the param
48+
value to evaluate whether to add GIS-specific UI elements to the results view.
49+
50+
Like index detection, this is duplicative of the feature flags approach, but it would allow us to achieve a similar
51+
effect without using an external dependency. However, this would not be a consistent solution for the full record view,
52+
as direct linking is a common use case for full records, and we may not be able to guarantee the presence of a `gis=true`
53+
param in these links.
54+
55+
One use case where search params could be useful is the potential future state in which `search.libraries.mit.edu` (or
56+
another TIMDEX UI app) includes GIS data in search results. In that instance, it may be valuable to allow users to
57+
choose whether they want geospatial data queried in their search.
58+
59+
### Data detection
60+
61+
We could check for the presence of certain fields in the API response to determine which UI elements to display. If
62+
geospatial records are in the results, then GDT-specific fields would appear in the brief and full record, and
63+
GDT-specific filters would appear in the sidebar. This would help address the use case of adding geospatial data to
64+
indices searched by non-GDT applications.
65+
66+
### Theme gem
67+
68+
We can use the theme gem to conditionally modify certain views that are shared across our Rails properties. This would
69+
solve the problem of customizing the header, but not views that are specific to the GDT UI.
70+
71+
## Decisions
72+
73+
We will extend TIMDEX UI for GIS data using a combination of the solutions described above:
74+
75+
* We will create a separate Heroku app in the TIMDEX UI pipeline for GDT.
76+
* Where possible and reasonable, local header customizations will be controlled by the theme gem.
77+
* We will use `flipflop` to implement a GDT feature flag, which will toggle GDT-specific features.
78+
* We will add universal UI improvements to all TIMDEX UI implementations.
79+
* In the future, we will consider adding a `gis` search param and/or a data detection enhancer as needed.
80+
81+
If we decide to add geospatial data to other TIMDEX UI applications in the future, we can decide whether a search param
82+
or data detection approach will be more effective. (Note that this decision will likely require us to modify how our
83+
feature flag is implemented, or to replace it altogether.)
84+
85+
We will not use index detection, as it does not address any additional use cases.
86+
87+
## Consequences
88+
89+
Using the theme gem for header customizations may be useful for other applications. We can minimize repetition by
90+
managing these changes in environment variables read by the theme gem, but we should be wary of overabstraction. We will
91+
try this with adding the app name to the header to start, and carefully consider whether it may be useful for other UI
92+
elements.
93+
94+
The feature flag will serve as an initial solution to isolating GDT UI features. Because we have used `flipflop` before,
95+
it should not significantly impact development time, which is an important consideration at this point in the project.
96+
97+
There may be additional use cases we haven't yet considered that could impact this decision. We should remain open to
98+
changing our approach as the project develops.

0 commit comments

Comments
 (0)