docs: function (tabName, thePicoInp, dname, callback) {
        var eci = findEciById(thePicoInp.id)
        if (tabName === 'about') {
          var hasRID = function (pid, rid) {
            return !!get(dbDump.pico, [pid, 'ruleset', rid])
          }
          var thePicoOut = {}
          thePicoOut.pico_id = thePicoInp.id
          thePicoOut.id = thePicoInp.id
          thePicoOut.eci = eci
          var ppECI = getP(thePicoInp, 'parent_eci', undefined)
          var pp = ppECI
            ? { id: get(dbDump.channel, [ppECI, 'pico_id']), eci: ppECI }
            : undefined
          if (pp) {
            thePicoOut.parent = {}
            thePicoOut.parent.id = pp.id
            thePicoOut.parent.eci = pp.eci
            thePicoOut.parent.dname = getV(pp, 'dname', undefined)
          }
          if (thePicoInp.id === rootPico.id || (pp && pp.id === rootPico.id)) {
            var pswdAuth = hasRID(
              thePicoInp.id,
              'io.picolabs.owner_authentication'
            )
            var didAuth = hasRID(thePicoInp.id, 'io.picolabs.did_auth_only')
            thePicoOut.isOwner = pswdAuth || didAuth
            thePicoOut.pswdAuth = pswdAuth
          }
          thePicoOut.children = []
          var reportedChildren = getP(thePicoInp, 'children', [])
          var i = 0
          var cLen = reportedChildren.length
          for (; i < cLen; ++i) {
            var p = reportedChildren[i]
            var cp = {}
            cp.id = p.id
            cp.eci = p.eci
            if (dbDump.pico[p.id] === undefined) continue
            cp.dname = getV(p, 'dname', undefined)
            cp.canDel = getP(p, 'children', []).length === 0
            thePicoOut.children.push(cp)
          }
          thePicoOut.dname = getV(thePicoInp, 'dname', dname)
          thePicoOut.color = getV(
            thePicoInp,
            'color',
            thePicoOut.parent ? '#7FFFD4' : '#87CEFA'
          )
          callback(null, thePicoOut)
        } else if (tabName === 'rulesets') {
          var theRulesetInp = thePicoInp
          var installedRS = {}
          for (var rs in theRulesetInp.ruleset) {
            installedRS[rs] = theRulesetInp.ruleset[rs]
            if (
              rs !== 'io.picolabs.wrangler' &&
              rs !== 'io.picolabs.visual_params'
            ) {
              installedRS[rs].canDel = true
            }
          }
          var avail = []
          dbDump.enabledRIDs.forEach(function (rid) {
            if (installedRS[rid] === undefined) {
              avail.push(rid)
            }
          })
          var theRulesetOut = {
            pico_id: thePicoInp.id,
            eci: eci,
            installed: installedRS,
            avail: avail
          }
          callback(null, theRulesetOut)
        } else if (tabName === 'logging') {
          var theLoggingOut = {}
          theLoggingOut.eci = eci
          theLoggingOut.pico_id = thePicoInp.id
          if (get(dbDump, ['pico', thePicoInp.id, 'ruleset', 'io.picolabs.logging', 'on'])) {
            theLoggingOut.status = true
            $.getJSON('/api/pico/' + thePicoInp.id + '/logs', function (data) {
              theLoggingOut.logs = groupLogsByEpisode(data)
              callback(null, theLoggingOut)
            }).fail(function (err) {
              theLoggingOut.error = 'Failed to get data'
              callback(null, theLoggingOut)
            })
          } else {
            theLoggingOut.disabled = true
            callback(null, theLoggingOut)
          }
        } else if (tabName === 'testing') {
          var testing = []
          eci = findEciById(thePicoInp.id)
          for (rid in thePicoInp.ruleset) {
            testing.push({ rid: rid })
          }
          callback(null, { pico_id: thePicoInp.id, eci: eci, testing: testing })
        } else if (tabName === 'channels') {
          var theChannels = []
          var thePolicies = get(dbDump, ['policy'])
          Object.keys(thePicoInp.channel).forEach(function (id) {
            var aChannel = get(thePicoInp, ['channel', id], undefined)
            if (aChannel) {
              if (aChannel.type !== 'secret' || aChannel.name !== 'admin') {
                aChannel.canDel = true
              }
              var thePolicy = thePolicies[aChannel.policy_id]
              aChannel.policy_name = thePolicy.name
              aChannel.policy_text = JSON.stringify(thePolicy, undefined, 2)
              theChannels.push(aChannel)
            }
          })
          callback(null, {
            pico_id: thePicoInp.id,
            id: thePicoInp.id,
            eci: thePicoInp.admin_eci,
            channel: theChannels,
            policy: thePolicies
          })
        } else if (tabName === 'subscriptions') {
          var theSubscriptions = {}
          theSubscriptions.pico_id = thePicoInp.id
          theSubscriptions.eci = eci
          var subsRID = 'io.picolabs.subscription'
          if (get(dbDump, ['pico', thePicoInp.id, 'ruleset', subsRID, 'on'])) {
            var subscribablePicos = []
            for (var k in dbDump.channel) {
              var aChannel = dbDump.channel[k]
              if (aChannel.name === 'wellKnown_Rx') {
                if (aChannel.pico_id === thePicoInp.id) {
                  theSubscriptions.wellKnown_Rx = k
                } else { // avoid offering subscription to self
                  subscribablePicos.push({
                    id: aChannel.id,
                    pico_name: getV({ id: aChannel.pico_id }, 'dname')
                  })
                }
              }
            }
            theSubscriptions.subscribable_picos = subscribablePicos.sort(
              function (a, b) {
                var nameA = a.pico_name.toUpperCase()
                var nameB = b.pico_name.toUpperCase()
                if (nameA < nameB) return -1
                if (nameB < nameA) return 1
                return 0
              }
            )
          } else {
            theSubscriptions.disabled = true
          }
          var theSubsVars = get(dbDump, [
            'pico',
            thePicoInp.id,
            subsRID,
            'vars'
          ])
          var recSubs = function (subsType) {
            if (theSubsVars && theSubsVars[subsType]) {
            } else return
            var someSub = {}
            var subCount = 0
            var theSubs = theSubsVars[subsType]
            Object.keys(theSubs).forEach(function (id) {
              ++subCount
              someSub[id] = theSubs[id]
              someSub[id].asString = JSON.stringify(theSubs[id], undefined, 2)
              var subsECI = theSubs[id].Tx || theSubs[id].wellKnown_Tx
              var pico = { id: get(dbDump.channel, [subsECI, 'pico_id']) }
              someSub[id].name = getV(pico, 'dname')
            })
            if (subCount) theSubscriptions[subsType] = someSub
          }
          recSubs('established')
          recSubs('outbound')
          recSubs('inbound')
          callback(null, theSubscriptions)
        } else if (tabName === 'policies') {
          var policyUI = { disabled: true, eci: eci, pico_id: thePicoInp.id }
          $.getJSON('/sky/cloud/' + eci + '/io.picolabs.policy/ui', function (ui) {
            callback(null, {
              pico_id: thePicoInp.id,
              ui: ui,
              text: JSON.stringify(ui, undefined, 2)
            })
          }).fail(function () {
            callback(null, policyUI)
          })
        } else {
          callback(null, thePicoInp)
        }
      }