Sign inSign up

menome/thelink-api

By menome

•Updated over 3 years ago

API Backend for theLink

Image
0

5.9K

menome/thelink-api repository overview

This is the backend API for theLink. It is written in NodeJS, and interfaces with both OpenAPI 3.0 and GraphQL. It uses Neo4j as its database.

⁠Graph Schema

Upon running, theLink API will build indices and add some key nodes to the database. For more information, check the setup queries.⁠

TheLink API also makes some assumptions on how the graph is structured. Here is a set of guidelines for what it should look like.

⁠Nodes

Here is a list of the primary node types and their properties.

Nodes/Labels

  • Card - These nodes represent primary business entries (eg. Employees, Projects, Units of work, Job sites, etc.)
    • Labels: All cards should contain the 'Card' label, as well as another label that denotes its entity type. (eg. "Employee")
    • Properties: The following are reserved properties on each node. Aside from these, any properties can be added and configured to be displayed.
      • Name (Required)
      • Uuid (Required)
      • Latitude (If the node has a spatial location. Eg. work sites.)
      • Longitude
      • OmitFromSearch (Explicitly omit this card from search results.)
      • MarkdownContent (Can be rendered into a markdown window for easy reading.)
      • Uri (For things like Internet Articles. These cards will carry a hyperlink to their source material.)
      • Thumbnail (Explicit URL to a photo that represents this card. Image for a card thumbnail.) (Formerly a boolean to determine if there was a thumbnail at card-thumbs/(uuid).jpg
      • ThumbnailLibrary (Library that the thumbnail is part of.)
      • PendingMerge (Used by the Harvester. The node's data is incomplete and pending a merge.)
      • SourceSystemProps_<source system name> (Used by the Harvester/Refinery. Keeps track of which properties were filled in by which source system.)
      • SourceSystems (Used by the Harvester/Refinery. Determines which source systems have informed this node's properties.)
      • SourceSystemPriorities (Used by the Harvester/Refinery. Determines the priority of source systems on how they influence the overwriting of properties.)
  • File - This is a type of card. (node:Card:File). Files have certain reserved properties, in addition to those of other cards.
    • PendingUpload (Used by the filestore. A user has requested to upload a file, and that file has not been uploaded yet but we have some metadata for it.)
    • LibraryKey (The name of the library this file resides in.)
    • LibraryPath (The path within the library.)
  • Meta, User - These are system-reserved labels. Meta keeps track of database state and version, User keeps track of users that can authenticate and use theLink.

Relationships

  • Card relationships
    • Relationships between cards have no real restriction on their labels or properties as of yet.
  • Facet Relationships
    • Relationships denoting that a Card belongs to a facet should be of the form (c:Card)-[:HAS_FACET]->(f:Facet)
    • The direction and the type should follow this preserved.
    • Facets can be nested in heirarchical structures like so: (c:Card:Company)-[:HAS_FACET]->(city:Facet:City)-[:HAS_FACET]->(region:Facet:Region)-[:HAS_FACET]->(country:Facet:Country)
      • This allows us to search for all Company cards within a given country, by traversing the facet hierarchy.

A note on Dates and Times

All Dates/Times are taken and received in ISO 8601 format. Internally, we store dates/times in Neo4j's Date format.

⁠Configuration

Config is done through the following files.

  • config.json - Basic configuration. See schema for details here⁠
    • Configuration can be done via environment variables as well. This config file lists them.
  • schema.graphql - GraphQL Datamodel Configuration. List types here, and directives, and theLink will take care of setting up indices, queries, and mutations.
    • This is merged with the base theLink schema found here: here⁠

Tag summary

Content type

Image

Digest

sha256:263986ba5…

Size

453.1 MB

Last updated

over 3 years ago

docker pull menome/thelink-api