Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction:

...

  • Get Device Profile API - To return back the IP resolved location for the device.
  • Device Register API Enhancements - API to save User confirmed location to device_profile Cassandra table as derived location.
  • Telemetry Location Updater Samza Job Changes - To stamp derived location in the telemetry.


Get Device

...

Profile API:

This API returns back IP resolved location details from MaxMind DB.

...

End point: GET /v3/device/locationprofile/<deviceId>

IP details is sent as X-FORWARDED-FOR in the header.

...

Code Block
{
    "id": "analytics.device-location",
    "ver": "1.0",
    "ts": "2019-07-30T18:54:10.627+00:00",
    "params": {
        "resmsgid": "e045d484-eedb-4fa9-a9d8-9c3e489e664f",
        "status": "successful",
        "client_key": null
    },
    "responseCode": "OK",
    "result": {
        "user_declared_locationuserDeclaredLocation": {
            "state": "Karnataka",
            "district": "Bengaluru"
        },
        "device_profiledeviceProfile": {

        }
    }
}


Device Register API Enhancements:

  • For signed in users - Saves location details as derived location in device_profile cassandra table.
  • For anonymous users - Resolves the IP address from the x-forwarded-for header and writes to cassandra.

Request Details:

End point: POST /v3/device/register/<deviceId>

...

Code Block
{
    "id": "dev.sunbird.portal",
    "ver": "1.15.0",
    "ts": "2019-04-23T19:23:02+05:30",
    "params": {
        "msgid": "4f92a44f-127f-0c82-b2ad-715faa558a8d"
    },
    "request": {
        "uaspec": {
            "agent": "Chrome",
            "ver": "72.0.3626.121",
            "system": "mac-os-x-14",
            "platform": "Mac",
            "raw": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
        },
        "channel": "b00bc992ef25f1a9a8d63291e20efc8d",
        "fcmToken": "asda",
        "producer": "app12",
        "dspec": {"id": "oppo"},
        "ext": {
            "userid": "user1"
        },
        "user_declared_locationuserDeclaredLocation": {
            "state": "Karnataka",
            "district": "Bengaluru"
        }
    }
}

...

  1. Derived and device location details needs to be stored separately? and derived location should have only state and district or all other fields?
  2. Current Device Register API writes device location to cassandra via kafka and which of the above API should have this logic?
  3. User derived location has only state & district, telemetry stamping requires other details - state code, state custom details, city details, etc
  4. Can derived location be the new columns in same device_profile cassandra table.?
  5. Will derived location details in telemetry stamped as new fields or same current device location fields?

...