Missing deviceInfo in telemetry

Goal: Track chvs who have upgraded to the latest cht-android (v1.0.4-4)

Method: Using the query below, I was expecting to track the chvs using the metadata → android_version_name field.

WITH user_info AS (
  SELECT
    max(meta.doc ->> '_id') AS meta_id,
    nullif(meta.doc #>> '{metadata,user}','') AS meta_username,
    couchdb.doc ->> 'place' AS place_uuid,
    couchdb.doc ->> 'contact' AS contact_uuid,
    couchdb.doc ->> 'roles' AS contact_type
  FROM couchdb
  INNER JOIN couchdb_users_meta AS meta
    ON couchdb.doc ->> 'username' = meta.doc #>> '{metadata,user}'
  WHERE
    couchdb.doc ->> 'type' IS NULL AND
    couchdb.doc ->> 'username' IS NOT NULL
  GROUP BY meta_username, place_uuid, contact_uuid,contact_type
)

SELECT
  user_info.*,
  nullif(doc #>> '{metadata,versions,app}','') AS app_version,
  nullif(doc #>> '{device,deviceInfo,app,version}','') AS android_version_name,
  nullif(doc #>> '{device,deviceInfo,software,osVersion}','') AS os_version,
  nullif(doc #>> '{device,deviceInfo,software,osApiLevel}','') AS os_api_level,
  nullif(doc #>> '{device,deviceInfo,software,androidVersion}','') AS android_version_number,
  nullif(doc #>> '{device,deviceInfo,ram,free}','') AS free_ram,
  nullif(doc #>> '{device,deviceInfo,ram,total}','') AS total_ram,
  nullif(doc #>> '{device,deviceInfo,storage,free}','') AS free_storage,
  nullif(doc #>> '{device,deviceInfo,storage,total}','') AS total_storage,
  nullif(doc #>> '{device,deviceInfo,hardware,model}','') AS hardware_model,
  nullif(doc #>> '{device,deviceInfo,hardware,device}','') AS device_name
FROM
  couchdb_users_meta AS meta
INNER JOIN user_info ON
  doc ->> '_id' = user_info.meta_id

Challenge: The results of the query show null for deviceInfo fields for a number of chvs. Could you assist me in figuring out the reason behind the missing info?

Hi @iesmail,

Those devices could be browsers, please check device.userAgent too.

Hi Binod,

I updated my query as follows:

WITH user_info AS (
  SELECT
    max(meta.doc ->> '_id') AS meta_id,
    nullif(meta.doc #>> '{metadata,user}','') AS meta_username,
    couchdb.doc ->> 'place' AS place_uuid,
    couchdb.doc ->> 'contact' AS contact_uuid,
    couchdb.doc ->> 'roles' AS contact_type
  FROM couchdb
  INNER JOIN couchdb_users_meta AS meta
    ON couchdb.doc ->> 'username' = meta.doc #>> '{metadata,user}'
  WHERE
    couchdb.doc ->> 'type' IS NULL AND
    couchdb.doc ->> 'username' IS NOT NULL
  GROUP BY meta_username, place_uuid, contact_uuid,contact_type
)

SELECT
  user_info.*,
  nullif(doc #>> '{metadata,versions,app}','') AS app_version,
  nullif(doc #>> '{device,deviceInfo,app,version}','') AS android_version_name,
  nullif(doc #>> '{device,deviceInfo,software,osVersion}','') AS os_version,
  nullif(doc #>> '{device,deviceInfo,software,osApiLevel}','') AS os_api_level,
  nullif(doc #>> '{device,deviceInfo,software,androidVersion}','') AS android_version_number,
  nullif(doc #>> '{device,deviceInfo,ram,free}','') AS free_ram,
  nullif(doc #>> '{device,deviceInfo,ram,total}','') AS total_ram,
  nullif(doc #>> '{device,deviceInfo,storage,free}','') AS free_storage,
  nullif(doc #>> '{device,deviceInfo,storage,total}','') AS total_storage,
  nullif(doc #>> '{device,deviceInfo,hardware,model}','') AS hardware_model,
  nullif(doc #>> '{device,deviceInfo,hardware,device}','') AS device_name, 
  nullif(doc #>> '{device,userAgent}','') AS user_agent
FROM
  couchdb_users_meta AS meta
INNER JOIN user_info ON
  doc ->> '_id' = user_info.meta_id
where doc #>> '{device,userAgent}' like '%Mobile%'

Though am filtering mobile useragents only, I am still getting null android_version_name.

So for example a row with useragent below shows a null android version name. So it looks like it’s not a browser issue but cht phone app issue.

Mozilla/5.0 (Linux; Android 8.1; SM-J410F Build/M1AJB) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Crosswalk/23.53.589.4 Mobile Safari/537.36 org.medicmobile.webapp.mobile.moh_zanzibar/v0.4.25

Do you see any pattern when you compare the device.userAgent between these two groups of devices?

  1. where deviceInfo details are null
  2. where deviceInfo details are not null

Could this be happening only with certain devices, or with certain versions of the Android wrapper? Most of these metrics should be supported in Android wrapper v0.4.0+ and the one you have shared above seems to be on 0.4.25. So if possible, let’s look further for more insights.

Hi @binod,

671 out of 682 rows with null device info contain:

  1. android wrapper version 0.4.25
  2. Majority of the phone are A107F, A105F, SM-J410F.

The remaining 11 contain v0.7.3-3-webview with a mix of devices ( SM-A107F, SM-A037F, SM-E135F, SM-J410F)

1 Like

It’s quite likely there may have been a buggy interaction between cht-android 0.4.x and the cht-core version you were running at the time. We only started logging some pieces of deviceInfo from cht-core 3.8.

What’s interesting from from your data is all (or most?) of the devices running cht-android 0.7.x were correctly logging deviceInfo.

I’m seeing a few devices logging that cht-android 1.x is running on the device. As of today, I see 104 devices running 1.x