Skip to content

Handles authentication, manages data and importing content

Notifications You must be signed in to change notification settings

content-lense/content-lense-api

Repository files navigation

Welcome to Content Lense 👋

This is the API of Content Lense, a project that aims at enabling publishers to easily gain insights into their content.

-> See the full ContentLense on Github

How to get started

  • We will soon provide a very simple docker compose stack that includes latest stable builds of all parts of content lense. You will then just need to do a docker compose up to get up and running.
  • If you want to try the api right now, please do the following:
# Checkout and start the API docker stack
git clone git@github.com:content-lense/content-lense-api.git
cd content-lense-api
docker compose up -d

# Create the database, load doctrine fixtures and create jwt key pairs
./dev_flush_db.sh

Entities

Organisation

  • One Organisation has one owner User.
  • One Organisation can have many members[] Users.
  • One Organisation can have many Articles in 'articles[]'.
  • One Organisation can have many AnalysisMicroservices in 'analysisMicroservices[]'.
  • Every member has access to all Articles of the Organisation
  • Every member has access to the organisations API token (note: currently, using the API token means to have the same permissions as the owning user of the organisation)

User

  • Users log in via POST request to /auth/login with a JSON payload that includes email and password. The route issues a JWT token using the split-cookie approach (header and signed payload).
  • Only users that have isActive and isConfirmed set to true are allowed to login

Article

  • Article belong the an Organisation and can be created via a simple POST request to /articles using the Accept header set to application/json+ld
  • One Article can have many ArticleAnalysisResults
  • One Article can have many ArticleMentions (currently only people via mentionedPeople field)

ArticleMention

  • this is a mapping table between Article and Person including a mentionCount field

Person

  • One Person can be the author of many Articles (Person::articles)
  • One Person can be mentioned in many Articles ('Person::articleMentions')
  • More fields are firstName, lastName, age, gender and rawFullName (we currently have this field to recognize unique mentions from our Mentioned entites API which is part of this project)

AnalysisMicroservice

Analysis microservices are APIs (either an existing ContentLense service or any service of your choice) used to analyse incoming texts. For example, it counts the number of mentions of people, analyses text complexity, sentiment, etc.

  • Once a AnalysisMicroservices is registered, new articles are automatically sent to it if autoRunForNewArticles and isActive are both set to true.
  • The resulting payload of these services is stored in ArticleAnalysisResult.
  • After the result has been received from the microservice, a PostAnalysisProcessorMessage is created for all configured PostProcessors. The PostProcessorService needs to handle the configured post processing steps (e.g. STORE_MENTIONED_PEOPLE post processor which handles the result of the metion api payload)
  • One AnalysisMicroservice has one Organisation.
  • More fields are:
    • name: choose whatever you want
    • endpoint: the route (e.g. http://localhost:3111/sentiment)
    • headers: any additional headers you'd like us to send to the endpoint, e.g. (x-auth-token: 123-123-123-123)
    • method: method to be used (defaults to post)

The endpoint of every configured microservice should accept the following JSON payload:

{
    "id": 0, 
    "heading":"The Headline of the Article",
    "summary":"A short summary / abstract of the article",
    "authors": ["First Author", "Second Author"],
    "body": "The entire fulltext"
}

ArticleAnalysisResult

  • this is a mapping table between Article and AnalysisMicroservice including a rawResult field that contains the payload of the microservice

Webhook (work in progress)

Webhook help you to forward results of ContentLense to other services, e.g. Content Management Systems. They run either _after a AnalysisMicroservice is done OR after a new article has been posted if runOnNewArticle is set to true. It simply forwards the result of the analysis to the CRM including the article information to the configured endpoint

  • One Webhook can have many AnalysisMicroservice ('runAfterAnalyses')

RefreshToken

This is an empty entity extending Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken needed for the LexikJWTAuthenticationBundle, we did not change anything on it.

Supported by

Media Tech Lab media-tech-lab

About

Handles authentication, manages data and importing content

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published