All files / src/runtime results.coffee

100% Statements 6/6
50% Branches 1/2
100% Functions 3/3
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19    25x 25x 25x     51x       51x   51x          
module.exports.Results = class Results
  constructor: () ->
    @patientResults = {}
    @populationResults = {}
    @localIdPatientResultsMap = {}
 
  recordPatientResult: (patient_ctx, resultName, result) ->
    p = patient_ctx.patient
    # NOTE: From now on prefer getId() over id() because some data models may have an id property
    # that is not a string (e.g., FHIR) -- so reserve getId() for the API (and expect a string
    # representation) but leave id() for data-model specific formats.
    patientId = if typeof p.getId == 'function' then p.getId() else p.id()
    @patientResults[patientId] ?= {}
    @patientResults[patientId][resultName] = result
    @localIdPatientResultsMap[patientId] = patient_ctx.getAllLocalIds()
 
  recordPopulationResult: (resultName, result) ->
    @populationResults[resultName] = result