Commit 30f968b
Implements backend API, integrates with frontend (#4)
This PR adds the following:
- implements the entire meta2onto API (sorry, probably should've broken
it up...)
- updates endpoint paths, field references in the frontend to match the
backend
- adds a facility for the database to load the latest dump on startup,
similar to ECCO
- downloads the latest database dump if it's not already present on
invoking `run_stack.sh`
- note that the dump is currently around 850mb and I expect that to grow
- if it's missing or doesn't match the remote's exact file size in bytes
(I presume this is enough to ensure it's different), you'll be prompted
with a message to download it that includes its actual remote size
- adds `memcached` for caching expensive responses
Regarding the frontend, here are a few significant changes:
- the Cart component now directly downloads the response from
`/api/cart/download` rather than getting a link and fetching that
- the Autocomplete listing now shows the ontology ID alongside the
result (feel free to remove if you like; that was mostly for me); it
also passes the entity's name to the search page rather than its ID to
match the mockup.
- I vaguely recall them saying that they wanted to select an ontology ID
from the list, but perhaps that's not the case? Right now, the search
will match multiple ontology entities as long as their names are the
same.
- The initial results are currently capped at 50, but due to some joins
that exclude the actual number of results can end up winnowing it down
to ~47. I'm looking into it return exactly as many results as you ask
for while not blowing up the size early in the query.
- Search and Cart were updated to reflect the field names I return from
the backend
## Caveats
Note that the backend API structure is very much a work in progress. For
example, I'd like to combine the GEO metadata series table with the
regular Series table, decide between whether it's going to be flat or
nested, normalize how queries and pagination are done (there are some
custom endpoints, for example), etc. There's also currently no formal
type definition for the API; I intend to add that, as well as Swagger or
ReDoc to surface that information better, as well as add an OpenAPI
schema endpoint for programmatic use.
The data model is also kind of all over the place, due to not knowing
how (or, in many cases, if) the data i was provided would be used in the
app. I have a lot of cleanup to do both on the model and the interface,
but I imagine that it'll be best to address it in a future PR.
The way that searches are conducted is currently complicated, but I
figure I should get the PR out first. I'll explain it in a subsequent
comment on this PR.
## Trying it Out
Since I was only given a subset of ontology terms for testing, only a
small subset of entities in the ontology will actually be able to be
matched to results. (They're all disease entities from the MONDO
ontology, and only a small selection of them at that.) Here's a few
entries that you can search for that actually return responses, pulled
from the `api_searchterms` table joined with `api_ontologyterms`:
Ontology ID |Query Phrase
------------------|--------------------------------
MONDO:0000270|lower respiratory tract disorder
MONDO:0000637|musculoskeletal system cancer
MONDO:0001416|female reproductive organ cancer
---------
Co-authored-by: Vincent Rubinetti <[email protected]>1 parent cb13ca8 commit 30f968b
File tree
72 files changed
+5473
-213
lines changed- backend
- src
- api
- management
- commands
- migrations
- utils
- meta2onto
- compose-envs
- db-exports
- frontend
- src
- api
- components
- pages
- util
- services/postgres
- docker-entrypoint-initdb.d
- docker-entrypoint-postinit.d
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
72 files changed
+5473
-213
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Whitespace-only changes.
Whitespace-only changes.
Lines changed: 80 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments