Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate PokeMob detection from HashPokemonGo #32

Open
phdowling opened this issue Sep 8, 2016 · 9 comments
Open

Integrate PokeMob detection from HashPokemonGo #32

phdowling opened this issue Sep 8, 2016 · 9 comments

Comments

@phdowling
Copy link

Hey guys,

We wrote a PokeMob detection module. We listen for tweets with location tags, and if we detect a spike in locality, we trigger an event via a websocket. How difficult would this be for you guys to integrate?

The API is basically just the following: You open a websocket conenction to /mobs/geo/all (or /mobs/geo/:lat/:lon/:radius for location-based queries, though those will be even more rare), and every now and then, though very rarely, you will receive a JSON object with detected mobs. The goal would then be to display this live in the users map.

What are your thoughts?

@sacdallago
Copy link
Member

Same as in other comment ;)

@farisca
Copy link
Contributor

farisca commented Sep 11, 2016

Hey, since the pokemobs are quite rare, could you provide us with a sample JSON object which we would get in case a mob happens?

@phdowling
Copy link
Author

phdowling commented Sep 11, 2016

Sure! The clusters basically look like this:

{
    "tweets": [{
            "id": "some_tweet_id",
            "text": "I got a pikachu",
            "coordinates": [longitude, latitude],
            "timestamp": 1473599493
        },{
            "id": "another_tweet_id",
            "text": "i also got a pikachu!",
            "coordinates": [longitude, latitude],
            "timestamp": 1473599499
        }],
    "coordinates": [longitude, latitude],  // this is a weighted moving average of the tweets in the cluster
    "timestamp": 1473599499, // timestamp of last tweet in cluster
    "isMob": true,
    "clusterId": 1
}

@phdowling
Copy link
Author

phdowling commented Sep 13, 2016

Hey, updating this a bit: the API has now changed, instead of opening a socket to /mobs/geo/:lat/:lon/:radius, you directly access /mobs via a socket and then send your setting in a message once you are connected.

This code illustrates how you connect to the server:

var socket = io('http://localhost:3000/mobs');
socket.on("connect", function () {
    console.log("Connected to server, sending geo settings..");
    socket.emit("settings", {mode: "geo", lat: 1, lon:1, radius: 5000000});
});
// or:
/*socket.on('connect', function () {
    console.log("Connected to server, sending settings for listening to all clusters..");
    socket.emit("settings", {mode: "all"});
});*/

The returned JSON basically looks the same though. @farisca Is anyone from your team working on this? If you don't have the time, then maybe we could do a PR adding this functionality, however we would need some pointers as to where to start with integrating this.

@johartl
Copy link

johartl commented Sep 14, 2016

@phdowling Can a mob always be linked to a single Pokemon? For example, in your JSON example both tweets are about Pikachu. If that's always the case would you be able to include the pokemonId in the mob object?

{
    // ...
    "pokemonId": 25 // Pikachu
    // ...
}

@phdowling
Copy link
Author

Actually, we don't group by any tweet content, only geolocation and number of users tweeting. Basically, we got about zero mobs on most given days as it is, limiting this further to only considering clusters would not be very useful as far as we can see.

@johartl
Copy link

johartl commented Sep 14, 2016

I don't want you to limit your results further but ask you to add some more context to your cluster object. For our project it would be nice to display a mob together with some additional information like the Pokemon(s) which "caused" that mob. So I'm thinking about something like this.

{
    "tweets": [{
            // ...
            "text": "I got a pikachu",
            "pokemonId": 25 // <--- Pokemon mentioned in the tweet
        },{
            // ...
            "text": "i also got a pikachu!",
            "pokemonId": 25 // <--- Pokemon mentioned in the tweet
        }],
    // ...
}

@farisca
Copy link
Contributor

farisca commented Sep 14, 2016

Regarding radius parameter, what is its unit?

@farisca farisca mentioned this issue Sep 14, 2016
@phdowling
Copy link
Author

Meters

On Sep 14, 2016 9:29 PM, "Faris Cakaric" [email protected] wrote:

Regarding radius parameter, what is its unit?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#32 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA1hdwYq0quL-qeb9qUyp0cl9MZ2omkXks5qqEsEgaJpZM4J4Z4B
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants