openbeta / openbeta-graphql Goto Github PK
View Code? Open in Web Editor NEWThe open source rock climbing API
Home Page: https://openbeta.io
License: GNU Affero General Public License v3.0
The open source rock climbing API
Home Page: https://openbeta.io
License: GNU Affero General Public License v3.0
Whenever we add a new area we should also update Typesense Area collection.
Create a search index on Typesense containing only area data including climb count, density
Create a GQL query to show recent edit history
updateFields
(describing updated fields) in dbClimb job should only delete climb index
https://github.com/OpenBeta/openbeta-graphql/blob/staging/src/db/export/Typesense/Typesense.ts#L141
Make db connection str more flexible to support "mini" database setup (using docker) and managed cluster in production
Create filter
type so that we can filter areas by multiple criteria.
// find all crags at Smith Rock where grade < 5.10
query Example1 {
areas(filter: {name: "Smith Rock", type: "sport", yds: {'lt': "5.10"} }) {
area_name
}
}
Input type tutorial: https://www.yld.io/blog/query-by-2-or-more-fields-on-graphql/
Right now there is a lot of grades with different formats
ex. V2/3, V2-3, V2+
#88 requires Mongo to run with as a replica set.
East coast
Mountain
West coast
We now have bbox for all areas. It's good to calculate the area center lat,lng (metadata.lat
and metadata.lng
)
we need unzip and wget in base image
https://gitlab.com/openbeta/openbeta-nodejs-docker
image: registry.gitlab.com/openbeta/openbeta-nodejs-docker:16
The db seeding function loops through all available data files and insert them all at once causing heavy load on mongo db.
Limit the number of async calls to a few states at a time. Use p-limit or a similar package.
As a user I want to add a new climb or edit an existing field.
Investigate JWT/role-based access control middleware for Apollo GraphQL
A starting point: https://www.apollographql.com/docs/apollo-server/security/authentication/
we import json file directly which requires Node --experimental-json-modules
flag, available in node v16.14
https://github.com/OpenBeta/openbeta-graphql/blob/staging/src/model/MutableAreaDataSource.ts#L14
To do:
Learn more https://simonplend.com/import-json-in-es-modules/
Area._id
instead of Area.metadata.area_id
Area.uuid
or Area.id`This task impacts multiple layers (DB schemas, DB queries, GQL/frontend). I'd highly recommend tackling this in multiple PRs and gradually deprecate out-dated fields.
Climbs are now children of Area.
Assuming area page has the following slug: areas/<uuid>/optional-area-name
The breadcrumb component will need all ancestor uuids + display names
{
"area_name": "Smith Rock",
"children": [
{
"area_name": "Aggro Gully",
"metadata": {
"lat": 44.36724,
"lng": -121.14238
}
},
_path: {
[ <uuid of great grandparent>, "Oregon"],
[<grandparent uuid>, "Central Oregon"],
[<parent uuid>,"Smith Rock"],
}
...
]
}
Calculate area statistics, number of climbs, trad/sport breakdown, etx during db load time. Fyi -parent-child linking
Use something like https://github.com/pinojs/pino for logging
I want to pan, zoom the map and be able to ask the api to return crags/climbs within the map bounding box.
As a user I want to find areas and climbs near a latitude, longitude.
Input:
Todo:
I removed the old code.
Typesense tentant on https://cloud.typesense.org was created under my personal namespace. We should move it to OpenBeta project so other team members can access it.
Return total climbs, crags in the database.
How do we track edit history?
For this prototype
watch
to save changes to Media collection to media_history collectionI want to search for an area by name, for example, Black Velvet Canyon and be able to click on the result to jump to the page.
Todo: Include area.uuid in Typesense index so that search widget can generate URL to the area.
As a user I want to get all climbs in Colorado.
The following query failed:
query AllClimbsInColorado {
areas(filter: {path_tokens: {tokens: "Colorado"}, leaf_status: {isLeaf: true}}) {
areaName
climbs {
name
yds
id
}
}
}
Error:
{
"errors": [
{
"message": "Cannot return null for non-nullable field Climb.name.",
"locations": [
{
"line": 5,
"column": 7
}
],
"path": [
"areas",
0,
"climbs",
0,
"name"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
},
I want to move an area to be under a different parent.
To do:
The graphql api has rate limiting enabled to mitigate DDoS.
yarn build
fails because rate limiting is too restricted
nginx-ingress log:
2022/01/03 18:26:19 [error] 4682#4682: *58324847 limiting requests, excess: 150.950 by zone "openbeta_graphql-api_0f0e359b-87be-4802-a75e-be0d7456f75b_rpm", client: 70.123.62.81, server: api.openbeta.io, request: "POST / HTTP/1.1", host: "api.openbeta.io"
FYI @ygingras
Need to figure out how to add new areas and routes to the database
Create a query to return all leaf areas, ie areas with climbs, not intermediate parent areas. Since climbs are embedded documents in an Area, this will be useful to get climbs.
isLeaf: boolean
on Area objectisLeaf
param to data sourceisLeaf
param to areas resolverThe readme is lacking set up instructions for seeding the database with test data.
To do
Make it easier to add new area from the frontend by requiring only a country code
Sample climb md file
At the moment we only process data in the frontmatter section (data loader code), ignoring content below --- marker.
TO DO:
TBD How to define a UUID for climbs and crags
We'll want to be able to search climbs by
Leave room in the future to filter by
New build should be deployed automatically to stg-api.openbeta.io when we merge PRs to staging
branch.
Add a new query to help getting photo URLs by bounding box or area id/climb id.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.