Giter Site home page Giter Site logo

germanattanasio / your-celebrity-match Goto Github PK

View Code? Open in Web Editor NEW
156.0 156.0 139.0 1.02 MB

:star2:The Celebrity Match application uses the Watson Personality insights Service and Twitter data to identify celebrities on Twitter whose tweets are conceptually closest to yours.

License: Apache License 2.0

JavaScript 53.13% CSS 19.21% Pug 27.66%

your-celebrity-match's Introduction

German Attanasio

CTO & software dev w/ expertise in distributed apps, microservices, cloud, & container orchestration.

⤷ I am a highly skilled software engineer with extensive experience building and maintaining distributed applications. With a solid software development and architecture background, I can lead teams to deliver robust and scalable systems.

⚐ Based in New York

ϟ Currently CTO @ Moveo.ai

ϟ Recently IBM Watson, IBM Research, UNICEN

Skills

JavaScript Python React NodeJS Go

your-celebrity-match's People

Contributors

aedocw avatar andresfvilla avatar dependabot[bot] avatar germanattanasio avatar greenkeeperio-bot avatar jakepeyser avatar jzhang300 avatar karentycoon avatar kulkarniankitaibm avatar mamoonraja avatar nfriedly avatar noah-eigenfeld avatar ptitzler avatar sirspidey avatar tparikh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

your-celebrity-match's Issues

Stop working after March 24th?

@germanattanasio really interesting application! I followed the link on adding more profiles, and found this message:

IMPORTANT: The beta User Modeling service is now the generally available Personality Insights service, effective February 24, 2015. See the Bluemix pricing page for information about pricing plans for generally available services.
Applications that use the User Modeling REST API will continue to function until March 24, 2015, when the beta User Modeling service will be retired. However, effective February 24, no new applications can be created that use the beta User Modeling service.
Please see the documentation for the Personality Insights service for information about using its REST API and for information about converting User Modeling applications to use the Personality Insights service.

Is this demo going to stop working after March 24?

Remove links to `.shtml` pages

In the code there are references to our old pages in the ibm.com. We should update those links and save the user from a redirect 🤓

Failed to add celebrities even set the demo environment to 0 in bluemix.

I used button "deploy to bluemix" to deploy the sample to bluemix, then added credentials for mongodb, personality insights service and twitter API, then set the demo environment value from 1 to 0, but the application doesn't work.
when @germanatt from application dashboard, it will the below error.
Sorry, there was an error. Please try again later.

Is there anything I missed?


error logs:

App/0
instance 0
2016-08-26T17:48:18.321+0800
App/0
username: germanatt
2016-08-26T17:48:18.485+0800
App/0
germanatt is not a celebrity, lets see if is in the DB
2016-08-26T17:48:18.521+0800
App/0
germanatt found in the database
2016-08-26T17:48:18.558+0800
App/0
catch(): [TypeError: Cannot read property 'distance' of undefined]
2016-08-26T17:48:18.558+0800
App/0
done()
2016-08-26T17:48:18.560+0800
RTR/3
yourcelebritymatch-kaihong-1456.mybluemix.net - [26/08/2016:09:48:18.313 +0000] "GET /like/@germanatt HTTP/1.1" 500 0 6397 "https://yourcelebritymatch-kaihong-1456.mybluemix.net/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0" 108.168.250.154:13620 x_forwarded_for:"158.85.175.87" x_forwarded_proto:"https" vcap_request_id:929ab2d7-0211-4440-6c23-0fa42d543fd8 response_time:0.246524097 app_id:1b5b264e-9388-4840-9ea6-8aca84d2b76b x_global_transaction_id:"1593667457"
2016-08-26T17:48:18.560+0800
App/0
germanatt to be compared to: 0 celebrities

Add spanish support

Personality Insights now supports spanish so we need to update the app for when the tweets are in spanish

Add/remove celebritries

We need to be able to add or remove celebrities.

I'm thinking on something like /celebrities/add where you type the twitter profile and it validates that is a verified account, >10k followers and >1k tweets.

Question about Euclidean distance formula

Doesn't the Similarity function defined in similarity.js returns similarity percentage rather than Euclidean distance as described in the function description? Also the formula used to calculate the euclidean distance appears to be little different from the general form for n-dimensional space mentioned in wiki.

origin_traits.forEach(function(trait, i) {
     distance += Math.pow(trait.percentage - target_traits[i].percentage, 2);
});
var ret = 1 - (Math.sqrt(distance / origin_traits.length));

Why is distance divided by the number of traits here? Shouldn't this be:

var ret = 1 - (Math.sqrt(distance));

where Math.sqrt(distance) represents Euclidean distance.

Thanks

Sample application deployment tracking: repository URL is missing

Hello!

It appears that the application is using the Sample application deployment tracking library cf-deployment-tracker-client(https://github.com/watson-developer-cloud/your-celebrity-match/blob/master/server.js#L5) but doesn't specify the repository property in package.json. Without this property no traceback information to your github repository is recorded. Please consider adding the following to package.json

    ...
    "dependencies": {
        ...   
       "cf-deployment-tracker-client": "*"
    },
    ...
   "repository": {
     "type": "git",
     "url": "https://github.com/watson-developer-cloud/your-celebrity-match.git"
   }

as shown in this example: https://github.com/IBM-Bluemix/node-helloworld/blob/master/package.json#L9-18

Deployment Instructions on Bluemix

Do you happen to have instructions on how to deploy the app on Bluemix (CF)? I tried with the current manifest.yml but I faced multiple issues.

Improve the similarity function

We currently use euclidean distance to calculate the similarity between users and celebrities.

/**
 * Return the euclidean distance between two profiles
 * @param  json origin The personality insights profile
 * @param  json target The personality insights profile
 * @return Array      The 5 main traits
 */
var similarity = function(/*object*/ origin, /*object*/ target) {
  origin = typeof (origin) === 'string' ? JSON.parse(origin) : origin;
  target = typeof (target) === 'string' ? JSON.parse(target) : target;
  var distance = 0.0,
    origin_big5 = origin.tree.children[0].children[0].children,
    target_big5 = target.tree.children[0].children[0].children;

    // for each trait in origin personality...
    origin_big5.forEach(function(trait, i) {
      distance += Math.pow(trait.percentage - target_big5[i].percentage, 2);
    });
    var ret = 1-(Math.sqrt(distance/origin_big5.length));
    return ret;
};

Some of the problems from this approach is that most of the people are similar to the same celebrity. That's because they all have a similar value in key traits like 'openness' or 'neuroticism'.

One quick way to solve this is to take into account the average value for each trait(for all the celebrities) and assign a weight to each dimension distance.

Several updates

  • make sure it scales, it could be in the front page of reddit
    • Mainly looking at page weight: Shoot for 2-3mb max and rendering in 5 sec or less.
    • Test with dev tools throttling to 3G speeds and make sure things are still reasonable.
  • Add google analytics
  • testing + travis (see this)
  • security.js (helmet + express-rate-limitation) + CSRF (see personality-insights and speech demos)
  • package.json should not specify node-engine so that Bluemix will always use the latest one.
  • Update travis to send emails when there is a tag release.
  • Bluemix deployment tracker and privacy notice

How to add 'not-qualify as a celebrity' twitter profile batch

I would like to add a batch of twitter profiles (that are not qualified as celebrities) though the POST request rather adding individual profile as demonstrated in the below example:

curl -X POST --user {username}:{password}
--header "Content-Type: application/json"
--header "Accept: text/csv"
--data-binary "@{path_to_file}profile.json"
--output profile.csv
"https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2016-10-20&consumption_preferences=true&raw_scores=true&csv_headers=true"

Not connecting to mongodb

Hi,

I deployed the app on Bluemix, changed the credentials for personality insights & twitter.
Created a database and a user in mlab and changed the line in config.js using the connection to my mlab database:

 FROM THIS: mongodb: process.env.MONGODB || 'mongodb://localhost/celebs',
 TO THIS: mongodb: process.env.MONGODB || 'mongodb://<myuser>:<mypassword>@ds036617.mlab.com:36617/celebrities',

I have access to my database using mongo shell.
mongo ds036617.mlab.com:36617/celebrities -u -p

When I try to do npm start I get an error:

connect-to-mongodb
Server running on port: 3000
(node:1453) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
mongoose-connection-error: { MongoError: Authentication failed.
    at Function.MongoError.create (/Users/sandra/Desktop/Bluemix/Projects/your-celebrity-match/node_modules/mongodb-core/lib/error.js:31:11)
    at /Users/sandra/Desktop/Bluemix/Projects/your-celebrity-match/node_modules/mongodb-core/lib/connection/pool.js:497:72
    at authenticateStragglers (/Users/sandra/Desktop/Bluemix/Projects/your-celebrity-match/node_modules/mongodb-core/lib/connection/pool.js:443:16)
    at Connection.messageHandler (/Users/sandra/Desktop/Bluemix/Projects/your-celebrity-match/node_modules/mongodb-core/lib/connection/pool.js:477:5)
    at Socket.<anonymous> (/Users/sandra/Desktop/Bluemix/Projects/your-celebrity-match/node_modules/mongodb-core/lib/connection/connection.js:321:22)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)
  name: 'MongoError',
  message: 'Authentication failed.',
  ok: 0,
  errmsg: 'Authentication failed.',
  code: 18,
  codeName: 'AuthenticationFailed' }

Is there anything else I need to change to use the mongodb in mLab???

Thanks!

404 Error when making a **POST** request to: `http://localhost:3000/celebrities/syncdb`

I'm following the steps in the README. The step syncdb is not very clear, as when I load the url on the browsers, the app throws 404.

Update the database with the celebrities by making a POST request to:

`http://localhost:3000/celebrities/syncdb`

The celebrities are not added by default. Hence the above step is recommended. Refer #Celebrities section below for more information.
When running in bluemix make sure the environment variable `DEMO` is set to `0`.

Change from mongodb to cloudant

Bluemix keeps changing the way to access to mongodb so I decided to change from mongodb to cloudant.
Right now the instructions to deploy this app doesn't work.

Manifest.yml attempts to bind a service that doesn't exist.

If a client uses the Deploy to Bluemix button, the manifest.yml used creates a service called:

personality-insights-service-standard

However, it attempts to bind a service called:

personality-insights-service

The deployment fails because we can't find a service will name personality-insights-service

The service name and binding name should match in the manifest.yml file.

Sorry, there was an error. Please try again later.

I deployed the app on bluemix using the one-button-to-deploy, and whatever I type, I always get the error : "Sorry, there was an error. Please try again later."

I saw a closed issue with a similar problem. Do you know what can be the cause ?

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.