Skip to content

pax-atlantica/pax

Repository files navigation

Pax

The end of fake news.

Tech Stack

  • Node + Express
  • PostgreSQL
  • React + Redux
  • D3

Dev Stack

  • AWS EC2
  • Travis CI

Continuous Integration

See: https://github.com/pax-atlantica/pax-ci

How to Start This App

Upon cloning the forked repo, npm install on root directory in command line. Once installed, execute ‘npm run start-dev’ on the same directory. Open the app on a web browser by accessing 127.0.0.1:3000. Make sure to add remote upstream if you plan to contribute/ update app.

How to contribute

First rebase your local repo through ‘git –rebase upstream master.’ Commit all changed you’ve made, then ‘git push origin master’. Now you can make a pull request through your local forked copy of the project! The request will be checked by one of the members before it gets merged.

Server Endpoints

REQUEST

METHODURLREQUEST.BODYEXAMPLE
GET/api/getUser
GET/api/logoutUser
POST/api/analyzeJSON{ data: article }
POST/api/extractJSON{ data: link }
GETapi/vote:id
POST/api/voteJSON{ article_id: articleId, upvote: isUpvote }
GET/api/user/upvoteAverages
GET/api/user/allArticles

RESPONSE

METHODURLSUCCESS TYPESUCCESS CONTENTFAIL TYPEFAIL CONTENT
GET/api/getUserstringusernamenullnull
POST/api/logoutUsernullnullnullnull
POST/api/analyzeobjectanalysisnullnull
POST/api/extractobjectanalysisnullnull
POSTapi/vote:idobjectvotesnullnull
POST/api/voteobjectvotesnullnull
POST/api/user/upvoteAveragesobjecttone averagesnullnull
POST/api/user/allArticlesarrayall user articlesnullnull

Schema

USER SCHEMA

USERUSERNAMEEMAILPASSWORD
idStringStringString

SEARCH / ARTICLE SCHEMA

SEARCHUSERSTEXTISLINKRESULTPOLARITYPOLARITY SCORE
idForeign KeyVarCharBooleanNumberStringNumber

–>

ANGERDISGUSTFEARJOYSADNESSANALYTICALCONFIDENTTENTATIVE
NumberNumberNumberNumberNumberNumberNumberNumber

–>

OPENNESSCONSCIENTIOUSNESSEXTRAVERSIONAGREEABLENESSEMOTIONAL RANGE
NumberNumberNumberNumberNumber

UPVOTES / DOWNVOTES (JOIN TABLE)

VOTEVOTEDUPVOTEDOWNVOTEUSERARTICLE
idBooleanBooleanBooleanForeign KeyForeign Key

Client State

** ANALYZER analyzeUrl: true, &#9;&#9;&#9;<- toggle view to URL input analyzeText: false, &#9;&#9;&#9;<- toggle view to direct text input error: null, &#9;&#9;&#9;<- hold error messages height: 400, &#9;&#9;&#9;<- set height of emotion chart bar graph id: null, &#9;&#9;&#9;<- hold user id when they log in score: null, &#9;&#9;&#9;<- hold score of most recently analyzed article sentiment: null, &#9;&#9;&#9;<- hold sentiment of mose recently analyzed article success: false, &#9;&#9;&#9;<- toggle on success or failure of analysis summary: null, &#9;&#9;&#9;<- hold the summary of analyzed article title: null, &#9;&#9;&#9;<- hold the title of the analyzed article or ‘Your input’ tone: null, &#9;&#9;&#9;<- hold the tone of the most recently analyzed article waiting: false, &#9;&#9;&#9;<- toggle the waiting view while analysis is happening width: 800, &#9;&#9;&#9;<- set width of emotion chart bar graph init: true &#9;&#9;&#9;<- ???

** USER login: false, &#9;&#9;&#9;<- toggle when user is logged in

upvoteAverages: { &#9;&#9;&#9;<- tone averages of all articles analyzed by single user anger: 0, disgust: 0, fear: 0, joy: 0, sadness: 0, analytical: 0, confident: 0, tentative: 0, openness: 0, conscientiousness: 0, extraversion: 0, agreeableness: 0, emotional_range: 0, }, loginView: false, &#9;&#9;&#9;<- ??? dashboardView: false, &#9;&#9;&#9;<- show dashboard component inputView: true, &#9;&#9;&#9;<- show input component resultView: false, &#9;&#9;&#9;<- show result component waitingView: false, &#9;&#9;&#9;<- show waiting component aboutView: false, &#9;&#9;&#9;<- show about component

** DASHBOARD articles: ”, &#9;&#9;&#9;<- hold an array of articles analyzed by a user visible: false, &#9;&#9;&#9;<- ??? defaultInternalView: true, &#9;&#9;&#9;<- ??? errorInternalView: false, &#9;&#9;&#9;<- ??? showArticlesView : false, &#9;&#9;&#9;<- ???

** VOTES downVote: false, &#9;&#9;&#9;<- toggle user vote downVoteCount: 0, &#9;&#9;&#9;<- hold all downvotes upVote: false,&#9;&#9;&#9;<- toggle user vote upVoteCount: 0, &#9;&#9;&#9;<- hold all upvotes

How to Start This App

Requires node >= 8.8.1 and nodemon

  1. Fork and clone
  2. Run npm install
  3. .env file: LOCAL=1

    LOCAL_DB_PASSWORD={YOUR PASSWORD} LOCAL_DB_USER={YOUR USER} LOCAL_DB_HOST={YOUR HOST} LOCAL_DB_NAME={YOUR NAME}

    GOOGLE_CLIENT_ID={YOUR CLIENT ID} GOOGLE_CLIENT_SECRET={YOUR CLIENT SECRET} GOOGLE_LOCAL_DIRECT={ex: http://127.0.0.1:3000/auth/google/callback}

    AYLIEN_APP_ID={YOUR API ID} AYLIEN_APP_KEY={YOUR API KEY} WATSON_USERNAME={YOUR USERNAME} WATSON_PASSWORD={YOUR PASSWORD}