Cht-core: Sentinel doesn't survive startup

Created on 7 Aug 2017  路  7Comments  路  Source: medic/cht-core

scdf at SCdF in ~/Code/Medic/medic-sentinel on master*
$ node server
Node Version: 8.2.1
warn: Disabled transition "accept_patient_reports"
warn: Disabled transition "conditional_alerts"
warn: Disabled transition "default_responses"
info: Loading transition "maintain_info_document"
warn: Disabled transition "multi_report_alerts"
warn: Disabled transition "update_sent_by"
warn: Disabled transition "resolve_pending"
warn: Disabled transition "registration"
warn: Disabled transition "update_clinics"
warn: Disabled transition "update_notifications"
warn: Disabled transition "update_scheduled_reports"
warn: Disabled transition "update_sent_forms"
warn: Disabled transition "generate_patient_id_on_people"
info: transitions: processing enabled
info: startup complete.
info: transitions: fetching changes feed, starting from 87-g1AAAACbeJzLYWBgYMpgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUklMiTV____PyuDOVEzFyjAbmRimmhpYohNAx5j8liAJEMDkPoPNU0PbJpxspGBuXEqNn1ZAGIoMI4
info: checking schedule again in 5 minutes
/Users/scdf/Code/Medic/medic-sentinel/lib/lineage.js:6
      const id = lineageDoc.contact &&
                           ^

TypeError: Cannot read property 'contact' of null
    at lineage.find.lineageDoc (/Users/scdf/Code/Medic/medic-sentinel/lib/lineage.js:6:28)
    at Array.find (native)
    at contacts.forEach.contactDoc (/Users/scdf/Code/Medic/medic-sentinel/lib/lineage.js:5:26)
    at Array.forEach (native)
    at bindContacts (/Users/scdf/Code/Medic/medic-sentinel/lib/lineage.js:4:12)
    at db.medic.fetch (/Users/scdf/Code/Medic/medic-sentinel/lib/lineage.js:77:9)
    at Request._callback (/Users/scdf/Code/Medic/medic-sentinel/node_modules/nano/lib/nano.js:217:16)
    at Request.self.callback (/Users/scdf/Code/Medic/medic-sentinel/node_modules/request/request.js:188:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
Bug

All 7 comments

@garethbowen https://github.com/medic/medic-sentinel/pull/154

Does this make sense to you? I'm not really sure if this is the right way of fixing this, if we're even happy with this situation etc.

Looks good. Needs a unit test. It should also be backported to 2.13.x so I've added this issue to the project.

Added a test, merged to master, merged to 2.13.x here: medic/medic-sentinel@f7dd2d0

@SCdF @garethbowen does this need to be AT-ed?

For AT:

  1. Find a report
  2. Delete one of the contacts in that report's lineage
  3. Modify the report so the sentinel transitions pick up the doc and attempt to hydrate it
  4. Make sure the report is processed correctly (no crash, no error, sentinel meta data updated).

Over to @ngaruko for acceptance testing.

Trying to edit a report after the patient has been deleted brings up a uuid in the dropdown. Not a big issue I guess but a blank would make more sense. Right @sglangevin ?
image
Closing this as the api 'survives' nonetheless.

Was this page helpful?
0 / 5 - 0 ratings