Cosecha/redadalertas

on Raids

Opened this issue · 4 comments

It seems we are missing one level of data abstraction between a report of a raid and something we call a raid.

A report is what reporters create when they notice what looks like a raid

A raid is what is created from a having a number of reports that are in agreement and are from credible sources.

  • one raid can have one or more reports associated with it and one ore more reporters who each have a credibility rating.
  • it would seem to be the job of the algorithm in code to aggregate reports from the same area, combine information from different reporters who have a good credibility rating and then upon a certain threshold declare it a raid

Can I suggest modification to the api?

I haven't thought of it this way before. Please do. And thanks @mckennatim!

@mckennatim Are you familiar with swagger? We are sort of modeling the data through this documentation tool. But it is in the API repo: https://github.com/Cosecha/redadalertas-api

@celsom3 here is a swagger-like definitions section.

If we did use similar registration/ authentication for subscribers and reporters the there would be one user record type that has a boolean field for subscriber and reporter. They would join by userId to reporterId and subscriberId and the subscriber and reporter records. I'd suggest that email be the username since it would apply to a users multiple devices (phone/laptop).

Subscribers would have an array of regions they subscribe to

Reporters would have a rating, an array of reports they have made, an array of recommenders and an array of people they recommend.

A report would have a raid info, a reporterId and a report rating maybe based upon reporter's rating and completeness or speciificity.

A raid would combine information from all the highly rated reports for a location. It would also be joined to those reports via an array of reportIds, and to the reports via an array of reporterIds. Its confidence rating would be the threshold upon which the raid becomes an alert and could merely be some combination of the report ratings.

definitions:
  User:
    type: object
    properties:
      userId:
        type: string
      email:
        type: string
      apikey:
        type: string
      subscriber:
        type: boolean
      reporter:
        type: boolean    
      timestamp:
        type: string

  Subscriber:
    type: object
    properties:
      subscriberId:
        type: string
      phoneNumber:
        type: integer
        format: int32
      regions:
        type: array
          items:
            type: object
            properties:
              lat: 
                type: integer
              lon:
                type: integer
              city:
                type: string
              zip:
                type string  
              radius:
                type: integer  

  Reporter:
    type: object
    properties:
      reporterId:
        type: string     
      reports: 
        type: array
        items:
          type: string (raidIds)
      recommendedBy:
        type: array
        items: 
          type: object
          properties:
            colleagueId:
              type: string
            colleagueRating:
              type: integer 
      recommends:
        type: array
        items: 
          type: object
          properties:
            colleagueId:
              type: string
            rating: 
              type: integer                                 
      rating:
        type: integer 

  Report:
    type: object
    properties:
      id:
        type: string
      reporterId:
        type: string
      verifiedBy:
        type: array
        items: 
          type: reporterId     
      timestamp:
        type: string
      rating:
        type: integer  
      location:
        type: object
        properties:
          lat: 
            type: integer
          lon:
            type: integer
          address:
            type: object
            properties:
              street: 
                type: string
              city: 
                type: string
              zip: 
                type: string
      numOfIceMen: 
        type: integer
      iceIds: 
        type: array
        items:
          type: string
      images: 
        type: array
        items:
          type: image  
      other:
        type: array
        items:
          type: string 

  Raid:
    type: object
    properties:
      id:
        type: string
      reportersIds: 
        type: array
        items:
          type: string
      reportIds:
        type: array
        items:
          type: string 
      timestamp:
        type: string
      confidence:
        type: integer  
      location:
        type: object
        properties:
          lat: 
            type: integer
          lon:
            type: integer
          address:
            type: object
            properties:
              street: 
                type: string
              city: 
                type: string
              zip: 
                type: string
      numOfIceMen: 
        type: integer
      iceIds: 
        type: array
        items:
          type: string
      images: 
        type: array
        items:
          type: image  
      other:
        type: array
        items:
          type: string    

Yeah, this is great. Thanks. I think maybe we can use the terms 'endorses' and 'endorsedBy', like LinkedIn. :-)