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
- 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
- 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)
- Users log in via POST request to
/auth/login
with a JSON payload that includesemail
andpassword
. The route issues a JWT token using the split-cookie approach (header and signed payload). - Only users that have
isActive
andisConfirmed
set totrue
are allowed to login
- 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)
- this is a mapping table between Article and Person including a
mentionCount
field
- 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
andrawFullName
(we currently have this field to recognize unique mentions from our Mentioned entites API which is part of this project)
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
andisActive
are both set totrue
. - 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 configuredPostProcessors
. ThePostProcessorService
needs to handle the configured post processing steps (e.g.STORE_MENTIONED_PEOPLE
post processor which handles the result of themetion api
payload) - One AnalysisMicroservice has one Organisation.
- More fields are:
name
: choose whatever you wantendpoint
: 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"
}
- this is a mapping table between Article and AnalysisMicroservice including a
rawResult
field that contains the payload of the microservice
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')
This is an empty entity extending Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken
needed for the LexikJWTAuthenticationBundle
, we did not change anything on it.
Media Tech Lab media-tech-lab
