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 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 1424x 11x 3x 3x 6x 9x 11x 11x 17x 34x 51x 17x 1x 1x | module.exports.Executor = class Executor
constructor: (@library,@codeService,@parameters) ->
withLibrary: (lib) ->
@library = lib
@
withParameters: (params) ->
@parameters = params ? {}
@
withCodeService: (cs) ->
@codeService = cs
@
exec_expression: (expression, patientSource) ->
Results r = new Results()
expr = @library.expressions[expression]
while expr && p = patientSource.currentPatient()
patient_ctx = new PatientContext(@library,p,@codeService,@parameters)
r.recordPatientResult(patient_ctx, expression, expr.execute(patient_ctx))
patientSource.nextPatient()
r
exec: (patientSource, executionDateTime) ->
Results r = @exec_patient_context(patientSource, executionDateTime)
popContext = new PopulationContext(@library,r,@codeService,@parameters)
for key,expr of @library.expressions when expr.context is "Population"
r.recordPopulationResult( key, expr.exec(popContext))
r
exec_patient_context: (patientSource, executionDateTime) ->
Results r = new Results()
while p = patientSource.currentPatient()
patient_ctx = new PatientContext(@library,p,@codeService,@parameters,executionDateTime)
for key,expr of @library.expressions when expr.context is "Patient"
r.recordPatientResult(patient_ctx, key, expr.execute(patient_ctx))
patientSource.nextPatient()
r
{ Results } = require './results'
{ PopulationContext,PatientContext } = require './context' |