Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Observation } from '../models/patientModels';
import { environment } from '../../environments/environment';
import * as _ from 'lodash';
export function processObservationSummary(data: Observation[], dataType: string) {
let xdata: Observation = {};
// if we're in a development environment, manually filter results, returning the first match
// of selected vital type...
if (environment.sessionServices.appEnv === 'development') {
const measurementType = dataType.replace(/^(vital|lab)Summary\./, '');
const sortedData = _.orderBy(data, ['timeTaken'], ['desc']);
for (let i = 0; i < sortedData.length; i++) {
if ( sortedData[i].name && sortedData[i].name.match(new RegExp(measurementType, 'i'))) {
xdata = JSON.parse(JSON.stringify(sortedData[i]));
break;
}
}
} else {
if (data.length > 0) { xdata = JSON.parse(JSON.stringify(data[0])); }
}
return xdata;
}