public void Test_Complete_NullReport() { Procedure procedure = new Procedure(); InterpretationStep procedureStep = new InterpretationStep(procedure); procedureStep.Complete(); }
public void Test_Constructor_Procedure() { Procedure procedure = new Procedure(); InterpretationStep procedureStep = new InterpretationStep(procedure); Assert.IsNull(procedureStep.ReportPart); }
public void Test_Name() { Procedure procedure = new Procedure(); InterpretationStep procedureStep = new InterpretationStep(procedure); Assert.AreEqual("Interpretation", procedureStep.Name); }
/// <summary> /// Obtains a set of interpretation steps that are candidates for linked reporting to the specified interpretation step. /// </summary> /// <param name="step"></param> /// <param name="interpreter"></param> /// <returns></returns> public IList<InterpretationStep> GetLinkedInterpretationCandidates(InterpretationStep step, Staff interpreter) { var q = this.GetNamedHqlQuery("linkedInterpretationCandidates"); q.SetParameter(0, step); q.SetParameter(1, interpreter); return q.List<InterpretationStep>(); }
public void Test_LinkTo_NullReport() { InterpretationStep ps1 = new InterpretationStep(new Procedure()); InterpretationStep ps2 = new InterpretationStep(new Procedure()); ps1.LinkTo(ps2); }
public void Execute(InterpretationStep step, Staff executingStaff, List <InterpretationStep> linkInterpretations, IWorkflow workflow) { // if not assigned, assign if (step.AssignedStaff == null) { step.Assign(executingStaff); } // put in-progress step.Start(executingStaff); // if a report has not yet been created for this step, create now if (step.ReportPart == null) { var report = new Report(step.Procedure); var reportPart = report.ActivePart; workflow.AddEntity(report); step.ReportPart = reportPart; step.ReportPart.Interpreter = executingStaff; } // attach linked interpretations to this report foreach (var interpretation in linkInterpretations) { interpretation.LinkTo(step); } }
private InterpretationStep GetPendingInterpretationStep(Procedure procedure) { // bug #3859: don't want to create an interpretation step for a completed procedure // (migrated data may not have any interpretation steps even for a completed procedure) if (procedure.IsTerminated) { return(null); } var interpretationSteps = CollectionUtils.Select( procedure.ProcedureSteps, ps => ps.Is <InterpretationStep>()); // no interp step, so create one if (interpretationSteps.Count == 0) { var interpretationStep = new InterpretationStep(procedure); this.PersistenceContext.Lock(interpretationStep, DirtyState.New); return(interpretationStep); } // may be multiple interp steps (eg maybe one was started and discontinued), so find the one that is scheduled var pendingStep = CollectionUtils.SelectFirst( interpretationSteps, ps => ps.State == ActivityStatus.SC); return(pendingStep == null ? null : pendingStep.As <InterpretationStep>()); }
public void Execute(InterpretationStep step, Staff executingStaff, List<InterpretationStep> linkInterpretations, IWorkflow workflow) { // if not assigned, assign if (step.AssignedStaff == null) { step.Assign(executingStaff); } // put in-progress step.Start(executingStaff); // if a report has not yet been created for this step, create now if (step.ReportPart == null) { var report = new Report(step.Procedure); var reportPart = report.ActivePart; workflow.AddEntity(report); step.ReportPart = reportPart; step.ReportPart.Interpreter = executingStaff; } // attach linked interpretations to this report foreach (var interpretation in linkInterpretations) { interpretation.LinkTo(step); } }
public void Test_Constructor_PreviousStep() { InterpretationStep previousStep = new InterpretationStep(new Procedure()); PublicationStep newStep = new PublicationStep(previousStep); Assert.AreEqual(0, newStep.FailureCount); Assert.IsNull(newStep.LastFailureTime); }
/// <summary> /// Obtains a set of interpretation steps that are candidates for linked reporting to the specified interpretation step. /// </summary> /// <param name="step"></param> /// <param name="interpreter"></param> /// <returns></returns> public IList <InterpretationStep> GetLinkedInterpretationCandidates(InterpretationStep step, Staff interpreter) { var q = this.GetNamedHqlQuery("linkedInterpretationCandidates"); q.SetParameter(0, step); q.SetParameter(1, interpreter); return(q.List <InterpretationStep>()); }
public void Test_Reassign() { InterpretationStep previousStep = new InterpretationStep(new Procedure()); TranscriptionReviewStep reviewStep = new TranscriptionReviewStep(previousStep); TranscriptionReviewStep newStep = (TranscriptionReviewStep)reviewStep.Reassign(new Staff()); Assert.AreEqual(reviewStep, newStep); Assert.IsInstanceOfType(typeof(TranscriptionReviewStep), newStep); }
public void Test_Reassign() { InterpretationStep previousStep = new InterpretationStep(new Procedure()); TranscriptionStep procedureStep = new TranscriptionStep(previousStep); TranscriptionStep newStep = (TranscriptionStep)procedureStep.Reassign(new Staff()); Assert.AreEqual(procedureStep, newStep); Assert.IsInstanceOf(typeof(TranscriptionStep), newStep); }
public void Test_Reassign() { Procedure procedure = new Procedure(); InterpretationStep procedureStep = new InterpretationStep(procedure); InterpretationStep newStep = (InterpretationStep)procedureStep.Reassign(new Staff()); Assert.AreEqual(procedureStep, newStep); Assert.IsInstanceOfType(typeof(InterpretationStep), newStep); }
public void Test_Reassign() { InterpretationStep previousStep = new InterpretationStep(new Procedure()); PublicationStep procedureStep = new PublicationStep(previousStep); PublicationStep newStep = (PublicationStep)procedureStep.Reassign(new Staff()); Assert.AreEqual(procedureStep, newStep); Assert.IsInstanceOf(typeof(PublicationStep), newStep); }
public void Test_Suspend() { Procedure procedure = new Procedure(); InterpretationStep procedureStep = new InterpretationStep(procedure); Assert.AreEqual(ActivityStatus.SC, procedureStep.State); procedureStep.Suspend(); Assert.AreEqual(ActivityStatus.SU, procedureStep.State); }
public void Test_Complete_NullReportPart() { Procedure procedure = new Procedure(); Report report = new Report(procedure); ReportPart reportPart = new ReportPart(report, 0); Staff performer = new Staff(); InterpretationStep previousStep = new InterpretationStep(procedure); TranscriptionStep procedureStep = new TranscriptionStep(previousStep); procedureStep.Start(performer); procedureStep.Complete(); }
public void Test_Complete() { Procedure procedure = new Procedure(); Report report = new Report(procedure); ReportPart reportPart = new ReportPart(report, 0); Staff performer = new Staff(); InterpretationStep previousStep = new InterpretationStep(procedure); previousStep.ReportPart = reportPart; TranscriptionStep procedureStep = new TranscriptionStep(previousStep); procedureStep.Start(performer); procedureStep.Complete(); Assert.AreEqual(performer, procedureStep.ReportPart.Transcriber); }
public List <InterpretationStep> Execute(ReportingProcedureStep step, Staff executingStaff, Staff assignStaff, IWorkflow workflow) { step.Discontinue(); // cancel the report part if exists if (step.ReportPart != null) { step.ReportPart.Cancel(); } var interpretationSteps = new List <InterpretationStep>(); if (!IsAddendumStep(step)) { var procedures = new HashedSet <Procedure> { step.Procedure }; // if there are linked procedures, schedule a new interpretation for each procedure being reported if (step.ReportPart != null) { procedures.AddAll(step.ReportPart.Report.Procedures); } // schedule new interpretations foreach (var procedure in procedures) { var interpretationStep = new InterpretationStep(procedure); // Bug: #5128 - if the procedure is not document, do not schedule the replacement interpretation step, // since interpretation steps aren't scheduled until documentation is complete. if (procedure.IsDocumented) { interpretationStep.Schedule(procedure.PerformedTime); } if (assignStaff != null) { interpretationStep.Assign(assignStaff); } interpretationSteps.Add(interpretationStep); workflow.AddEntity(interpretationStep); } } return(interpretationSteps); }
public InterpretationStep Execute(VerificationStep step, Staff executingStaff, IWorkflow workflow) { // Cancel the current step step.Discontinue(); // Create a new interpreatation step that uses the same report part var interpretationStep = new InterpretationStep(step); // Reset the interpretator interpretationStep.ReportPart.Interpreter = executingStaff; // Assign the new step to the resident interpretationStep.Assign(executingStaff); interpretationStep.Start(executingStaff); workflow.AddEntity(interpretationStep); return(interpretationStep); }
public InterpretationStep Execute(PublicationStep step, Staff executingStaff, IWorkflow workflow) { // Discontinue the publication step step.Discontinue(); // Create a new interpreatation step that uses the same report part var interpretationStep = new InterpretationStep(step); // Reset the verifier interpretationStep.ReportPart.Verifier = null; // Assign the new step back to me interpretationStep.Assign(executingStaff); interpretationStep.Schedule(Platform.Time); workflow.AddEntity(interpretationStep); return(interpretationStep); }
public void Test_Complete() { Procedure procedure = new Procedure(); Report report = new Report(procedure); ReportPart reportPart = new ReportPart(report, 0); // This modality procedure step is created such that when the procedure tries to update its status // the detection of no ModalityProcedureSteps makes any procedure trying to update its status set itself // to discontinued, which for this test, is undesirable, this situation will probably never happen // in practice. ModalityProcedureStep modalityStep = new ModalityProcedureStep(procedure, "New modality.", new Modality()); InterpretationStep previousStep = new InterpretationStep(procedure); previousStep.ReportPart = reportPart; PublicationStep procedureStep = new PublicationStep(previousStep); procedureStep.Start(new Staff()); Assert.AreEqual(ActivityStatus.IP, procedureStep.State); Assert.AreEqual(0, procedureStep.ReportPart.Index); Assert.AreEqual(ReportPartStatus.D, procedureStep.ReportPart.Status); Assert.IsTrue(procedureStep.AllProcedures.TrueForAll( delegate(Procedure p) { return(p.Status == ProcedureStatus.IP); })); procedureStep.Complete(); Assert.AreEqual(ActivityStatus.CM, procedureStep.State); Assert.AreEqual(ReportPartStatus.F, procedureStep.ReportPart.Status); Assert.IsTrue(procedureStep.AllProcedures.TrueForAll( delegate(Procedure p) { return(p.Status == ProcedureStatus.CM); })); Assert.IsTrue(procedureStep.AllProcedures.TrueForAll( delegate(Procedure p) { return(p.EndTime == procedureStep.EndTime); })); }
public InterpretationStep Execute(ReportingProcedureStep step, IWorkflow workflow) { // Cancel the current step step.Discontinue(); // Create a new interpreatation step that uses the same report part var interpretationStep = new InterpretationStep(step); // Reset the verifier interpretationStep.ReportPart.Verifier = null; // Assign the new step to the interpreter var interpreter = interpretationStep.ReportPart.Interpreter; interpretationStep.Assign(interpreter); interpretationStep.Schedule(Platform.Time); workflow.AddEntity(interpretationStep); return(interpretationStep); }
public InterpretationStep Execute(Procedure procedure, Staff executingStaff, IWorkflow workflow) { // the procedure passed in may be any one of the procedures that this report covers // ideally, the new interpretation step should be created on the procedure that the // publication step was linked to (and only one of the reported procedures should have a publication step) procedure = CollectionUtils.SelectFirst( procedure.ActiveReport.Procedures, p => CollectionUtils.Contains( p.ReportingProcedureSteps, ps => ps.Is <PublicationStep>() && ps.State == ActivityStatus.CM)) // but if there are no publication steps (i.e. imported data), then just use the procedure that was provided. // See bug #3450 ?? procedure; var interpretation = new InterpretationStep(procedure); interpretation.Assign(executingStaff); interpretation.ReportPart = procedure.ActiveReport.AddAddendum(); interpretation.ReportPart.Interpreter = executingStaff; workflow.AddEntity(interpretation); return(interpretation); }
public InterpretationStep Execute(PublicationStep step, Staff executingStaff, IWorkflow workflow) { // Discontinue the publication step step.Discontinue(); // Create a new interpreatation step that uses the same report part var interpretationStep = new InterpretationStep(step); // Reset the verifier interpretationStep.ReportPart.Verifier = null; // Assign the new step back to me interpretationStep.Assign(executingStaff); interpretationStep.Schedule(Platform.Time); workflow.AddEntity(interpretationStep); return interpretationStep; }
public InterpretationStep Execute(ReportingProcedureStep step, IWorkflow workflow) { // Cancel the current step step.Discontinue(); // Create a new interpreatation step that uses the same report part var interpretationStep = new InterpretationStep(step); // Reset the verifier interpretationStep.ReportPart.Verifier = null; // Assign the new step to the interpreter var interpreter = interpretationStep.ReportPart.Interpreter; interpretationStep.Assign(interpreter); interpretationStep.Schedule(Platform.Time); workflow.AddEntity(interpretationStep); return interpretationStep; }
public InterpretationStep Execute(VerificationStep step, Staff executingStaff, IWorkflow workflow) { // Cancel the current step step.Discontinue(); // Create a new interpreatation step that uses the same report part var interpretationStep = new InterpretationStep(step); // Reset the interpretator interpretationStep.ReportPart.Interpreter = executingStaff; // Assign the new step to the resident interpretationStep.Assign(executingStaff); interpretationStep.Start(executingStaff); workflow.AddEntity(interpretationStep); return interpretationStep; }
public List<InterpretationStep> Execute(ReportingProcedureStep step, Staff executingStaff, Staff assignStaff, IWorkflow workflow) { step.Discontinue(); // cancel the report part if exists if (step.ReportPart != null) step.ReportPart.Cancel(); var interpretationSteps = new List<InterpretationStep>(); if (!IsAddendumStep(step)) { var procedures = new HashedSet<Procedure> { step.Procedure }; // if there are linked procedures, schedule a new interpretation for each procedure being reported if (step.ReportPart != null) { procedures.AddAll(step.ReportPart.Report.Procedures); } // schedule new interpretations foreach (var procedure in procedures) { var interpretationStep = new InterpretationStep(procedure); // Bug: #5128 - if the procedure is not document, do not schedule the replacement interpretation step, // since interpretation steps aren't scheduled until documentation is complete. if (procedure.IsDocumented) interpretationStep.Schedule(procedure.PerformedTime); if (assignStaff != null) interpretationStep.Assign(assignStaff); interpretationSteps.Add(interpretationStep); workflow.AddEntity(interpretationStep); } } return interpretationSteps; }
public void Test_Reassign() { Procedure procedure = new Procedure(); InterpretationStep procedureStep = new InterpretationStep(procedure); InterpretationStep newStep = (InterpretationStep)procedureStep.Reassign(new Staff()); Assert.AreEqual(procedureStep, newStep); Assert.IsInstanceOfType(typeof (InterpretationStep), newStep); }
public InterpretationStep Execute(Procedure procedure, Staff executingStaff, IWorkflow workflow) { // the procedure passed in may be any one of the procedures that this report covers // ideally, the new interpretation step should be created on the procedure that the // publication step was linked to (and only one of the reported procedures should have a publication step) procedure = CollectionUtils.SelectFirst( procedure.ActiveReport.Procedures, p => CollectionUtils.Contains( p.ReportingProcedureSteps, ps => ps.Is<PublicationStep>() && ps.State == ActivityStatus.CM)) // but if there are no publication steps (i.e. imported data), then just use the procedure that was provided. // See bug #3450 ?? procedure; var interpretation = new InterpretationStep(procedure); interpretation.Assign(executingStaff); interpretation.ReportPart = procedure.ActiveReport.AddAddendum(); interpretation.ReportPart.Interpreter = executingStaff; workflow.AddEntity(interpretation); return interpretation; }
public void Test_Complete() { Procedure procedure = new Procedure(); Report report = new Report(procedure); ReportPart reportPart = new ReportPart(report, 0); // This modality procedure step is created such that when the procedure tries to update its status // the detection of no ModalityProcedureSteps makes any procedure trying to update its status set itself // to discontinued, which for this test, is undesirable, this situation will probably never happen // in practice. ModalityProcedureStep modalityStep = new ModalityProcedureStep(procedure, "New modality.", new Modality()); InterpretationStep previousStep = new InterpretationStep(procedure); previousStep.ReportPart = reportPart; PublicationStep procedureStep = new PublicationStep(previousStep); procedureStep.Start(new Staff()); Assert.AreEqual(ActivityStatus.IP, procedureStep.State); Assert.AreEqual(0, procedureStep.ReportPart.Index); Assert.AreEqual(ReportPartStatus.D, procedureStep.ReportPart.Status); Assert.IsTrue(procedureStep.AllProcedures.TrueForAll( delegate(Procedure p) { return p.Status == ProcedureStatus.IP; })); procedureStep.Complete(); Assert.AreEqual(ActivityStatus.CM, procedureStep.State); Assert.AreEqual(ReportPartStatus.F, procedureStep.ReportPart.Status); Assert.IsTrue(procedureStep.AllProcedures.TrueForAll( delegate(Procedure p) { return p.Status == ProcedureStatus.CM; })); Assert.IsTrue(procedureStep.AllProcedures.TrueForAll( delegate(Procedure p) { return p.EndTime == procedureStep.EndTime; })); }