Problem Service
Overview
The ProblemService is used to retrieve problems and problem comments from Cerner.
To use this service, you must import the service, assign it to an object, execute a data collection operation (either with the load method on this or any other MPage Developer service, or with the MPage Service executeCCL method). Finally, you need to do something with the data you have retrieved.
Import
import {Component, inject, OnInit, ...etc...} from '@angular/core';
import {ProblemService} from '@clinicaloffice/mpage-developer';
Object Assignment
Using the Angular inject command, assign the ProblemService to a new object. It is recommended that you scope your object as "protected" to allow access to your component HTML.
@Component({...
...})
export class YourComponent implements OnInit {
protected problemService = inject(ProblemService);
....remaining code...
Data Collection
The examples below demonstrate data collection methods you can use.
// Load the problems for the current patient default payload of "PROBLEM_ACTIVE"
this.problemService.load();
// Use the MPage Service to load multiple payload items
this.MPageService.executeCCL({
payload: {
patientSource: [{personId: 0, encntrId: 0}],
person: true,
problem: {
comments: true
}
});
Payload Options
The problem service offers payload options to problem comments.
The skipJSON option allows skipping generating JSON output. This functionality is useful if you are creating a custom CCL script after everything else has run where you want to summarize specific information.
{
problem: {
comments: true,
skipJSON: true
}
}
Default Payload Tags that Reference the Problem Service
| PROBLEM_ALL | {
problem: {
comments: true
}
}
|
| PROBLEM_ACTIVE | {
problem: {
comments: true
},
typeList: [
{codeSet: 12030, type: 'ACTIVE', typeCd: 0}
]
}
|
Using Callbacks
Both the service load method and MPageService executeCCL methods offer a callback parameter as the final parameter. You can use this callback or another option of your choosing to work with the data returned from Cerner.
this.MPageService.executeCCL({
payload: {
...
}
}, () => { ...do something here... }
Accessing from HTML
The problems() or get() methods in the problem service can be accessed directly from HTML. The problems() method will return all loaded problem information for all patients where the get() method returns an array of problems for a specific person id.
<b>Problems:</b>
<ul>
@for (problem of problemService.get(); track problem) {
<li>{{ problem.probSourceString }}</li>
}
</ul>
Methods / Usable Objects
clear(personId: number): voidClears problems from memory for a specific personId. If 0 is passed as the personId, all problems for all patients are removed from memory.
get(personId: number): IProblem[]Returns array of problems by personId.
length(): numberReturns a count containing the number of problems values loaded in memory.
load( payload: any = 'PROBLEM_ACTIVE', patientSource: IPatientSource[] = [{personId: 0, encntrId: 0}], callback: any = undefined ): voidLoads problem information for patients identified in the patientSource array. The payload can be any valid payload string or default payload (see payload tab).
putLog(text: string, type: string = 'info', processId: number = -1, statusText: string = ''): voidWrites a line of text to the MPage Developer log. Valid values for type include 'info', 'error', 'payload', and 'debug'. You should only use the values 'info' or 'error' as 'payload' and 'debug' are reserved for system use. The processId and statusText values can safely be ignored.
problems(): IProblem[]Returns and array of all loaded IProblem values.
values(): IterableIterator<IProblem>Returns an iterable iterator representation of all loaded problems values.
typeList Filtering
You can limit the amount of data collected in CCL by optionally adding a typeList object to your payload. For example, if you only wanted to load "ACTIVE" problems for patients and, you never plan on using the other types, simply add a typeList entry for code set 12030 to your payload. Simply include the codeSet value, type or typeCd where type represents a cdf_meaning or display_key value and typeCd represents the actual code value you want to filter by. Additionally, you can also filter on code set 400 to limit the problems to specific nomenclature source vocabularies.
{
payload: {
patientSource [{personId: 0, encntrId: 0}],
problem: true,
typeList: [
{codeSet: 400, type: 'CPT4', typeCd: 0}
{codeSet: 12030, type: 'ACTIVE', typeCd: 0}
]
}
}
Interfaces
IProblem {
personId: number;
problemInstanceId: number;
problemId: number;
nomenclatureId: number;
probSourceString: string;
probSourceIdentifier: number;
probSourceVocab: string;
problemFtDesc: string;
estimatedResolutionDtTm: Date;
actualResolutionDtTm: Date;
classification: string;
persistence: string;
confirmationStatus: string;
lifeCycleStatus: string;
lifeCycleStatusMeaning: string;
lifeCycleDtTm: Date;
onsetDt: string;
onsetDtTm: Date;
ranking: string;
certainty: string;
probability: number;
personAware: string;
prognosis: string;
personAwarePrognosis: string;
familyAware: string;
sensitivity: number;
course: string;
cancelReason: string;
onsetDtFlag: number;
statusUpdtPrecision: string;
statusUpdtFlag: number;
statusUpdtDtTm: Date;
qualifier: string;
annotatedDisplay: string;
severityClass: string;
severity: string;
severityFtDesc: string;
lifeCycleDt: string;
lifeCycleDtFlag: number;
problemTypeFlag: number;
laterality: string;
originatingNomenclature: number;
origProbSourceString: string;
origProbSourceIdentifier: number;
origProbSourceVocab: string;
probSourceVocabCd: number;
classificationCd: number;
persistenceCd: number;
confirmationStatusCd: number;
lifeCycleStatusCd: number;
onsetDtCd: number;
rankingCd: number;
certaintyCd: number;
personAwareCd: number;
prognosisCd: number;
personAwarePrognosisCd: number;
familyAwareCd: number;
courseCd: number;
cancelReasonCd: number;
statusUpdtPrecisionCd: number;
qualifierCd: number;
severityClassCd: number;
severityCd: number;
lifeCycleDtCd: number;
lateralityCd: number;
origProbSourceVocabCd: number;
comments: IProblemComment[];
}
IProblemComment {
commentDtTm: Date;
commentPrsnlId: number;
comment: string;
}