0" nz-col nzSpan="12">
+ Loinc codes (Order)
- ICD Codes
- @for (icdCode of selectedICdCodes; track $index) {
+ @for (loincCode of selectedLoincCodes; track $index) {
{{ icdCode.name }}{{ loincCode.name }}
}
@@ -111,54 +135,57 @@
-
+
0"
+ *ngIf="selectedICdCodes.length > 0 || selectedMsdCodes.length > 0"
nz-row
+ nzGutter="16"
style="margin-top: 16px; margin-bottom: 16px"
>
-
- @for (loincCode of selectedLoincCodes; track $index) {
- {{ loincCode.name }}
- }
-
+
0" nz-col nzSpan="12">
+
+ ICD Codes
+ @for (icdCode of selectedICdCodes; track $index) {
+ {{ icdCode.name }}
+ }
+
+
+
0" nz-col nzSpan="12">
+ Msd Codes
+
+ @for (msdCode of selectedMsdCodes; track $index) {
+ {{ msdCode.name }}
+ }
+
+
diff --git a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/containers/dataset-mapping/dataset-mapping.component.ts b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/containers/dataset-mapping/dataset-mapping.component.ts
index f2629048..9dca5f72 100644
--- a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/containers/dataset-mapping/dataset-mapping.component.ts
+++ b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/containers/dataset-mapping/dataset-mapping.component.ts
@@ -143,6 +143,20 @@ export class DatasetMappingComponent implements OnInit {
selectedLoincCode?: { name: string; code: string };
loincCodeOptionList: any[] = [];
+ selectedLoincCodesObs: { name: string; code: string }[] = [];
+ searchLoincCodeChangeObs$ = new BehaviorSubject('');
+ placeHolderForLoincCodeSelectObs: string = 'Select LOINC Code (Obs)';
+ isLoadingLoincCodesObs: boolean = false;
+ selectedLoincCodeObs?: { name: string; code: string };
+ loincCodeOptionListObs: any[] = [];
+
+ selectedMsdCodes: { name: string; code: string }[] = [];
+ searchMsdCodesChange$ = new BehaviorSubject('');
+ placeHolderForMsdCodes: string = 'Select Msd Codes';
+ isLoadingMsdCodes: boolean = false;
+ selectedMsdCode?: { name: string; code: string };
+ msdCodesOptionList: any[] = [];
+
onSearchLoincCode(value: string): void {
this.isLoadingLoincCodes = true;
this.searchLoincCodeChange$.next(value);
@@ -158,13 +172,6 @@ export class DatasetMappingComponent implements OnInit {
);
}
- selectedLoincCodesObs: { name: string; code: string }[] = [];
- searchLoincCodeChangeObs$ = new BehaviorSubject('');
- placeHolderForLoincCodeSelectObs: string = 'Select LOINC Code (Obs)';
- isLoadingLoincCodesObs: boolean = false;
- selectedLoincCodeObs?: { name: string; code: string };
- loincCodeOptionListObs: any[] = [];
-
onSearchLoincCodeObs(value: string): void {
this.isLoadingLoincCodesObs = true;
this.searchLoincCodeChangeObs$.next(value);
@@ -195,6 +202,21 @@ export class DatasetMappingComponent implements OnInit {
);
}
+ onSearchMsdCode(value: string): void {
+ this.isLoadingMsdCodes = true;
+ this.searchMsdCodesChange$.next(value);
+ }
+
+ onMsdCodeSelect(value: { name: string; code: string }) {
+ this.selectedMsdCodes = [...this.selectedMsdCodes, value];
+ }
+
+ onRemoveMsdCode(tag: { name: string; code: string }) {
+ this.selectedMsdCodes = this.selectedMsdCodes.filter(
+ (item) => item.code !== tag.code
+ );
+ }
+
constructor(
private route: ActivatedRoute,
private dataSetManagementService: DatasetManagementService,
@@ -216,6 +238,7 @@ export class DatasetMappingComponent implements OnInit {
this.searchConfigurations();
this.searchLoincCodes();
this.searchLoincCodesObs();
+ this.searchMsdCodes();
this.loadDatasetByIdFromServer(this.dataSetIds.uuid);
}
@@ -253,6 +276,7 @@ export class DatasetMappingComponent implements OnInit {
this.selectedICdCodes = [];
this.selectedLoincCodes = [];
this.selectedLoincCodesObs = [];
+ this.selectedMsdCodes = [];
this.mappingUuid = undefined;
this.getCategoryOptionCombos(this.selectedInputId);
}
@@ -305,36 +329,40 @@ export class DatasetMappingComponent implements OnInit {
next: (data: any) => {
if (data.uuid === null) return;
this.mappingUuid = data.uuid;
- if (data.mapping.type !== '') {
+ if (data.mapping?.type !== '') {
this.selectedDataTemplateBlock = data.mapping.type;
}
- if (data.mapping.icdMappings.length > 0) {
+ if (data?.mapping?.icdMappings?.length > 0) {
this.selectedICdCodes = data?.mapping?.icdMappings.map(
(item: any) => item
);
}
- if (data.mapping.loincMappings.length > 0) {
+ if (data?.mapping?.loincMappings?.length > 0) {
this.selectedLoincCodes = data?.mapping?.loincMappings.map(
(item: any) => item
);
}
- if (data.mapping.loincObsMappings.length > 0) {
+ if (data?.mapping?.loincObsMappings?.length > 0) {
this.selectedLoincCodesObs = data?.mapping?.loincObsMappings.map(
(item: any) => item
);
}
- if (data.mapping.params.length > 0) {
+ if (data?.mapping?.msdMappings?.length > 0) {
+ this.selectedMsdCodes = data?.mapping?.msdMappings.map(
+ (item: any) => item
+ );
+ }
+
+ if (data?.mapping?.params?.length > 0) {
// Consider taking one param, every param have the same number and type of configuration
// Find respective configurations against the prefetched list of configurations
const param = data.mapping.params[0];
- let configurations: any[] = [];
-
Object.keys(param).forEach((key) => {
if (key === 'startAge') {
const configuration = this.configurationOptionList.find(
@@ -343,7 +371,6 @@ export class DatasetMappingComponent implements OnInit {
this.assignConfigurationToSelectedDisaggregation(
configuration.value
);
- configurations = [configuration];
} else if (key === 'endAge' || key === 'co') {
return;
} else {
@@ -355,7 +382,6 @@ export class DatasetMappingComponent implements OnInit {
configuration.value
);
}
- configurations = [...configurations, configuration];
}
});
@@ -364,7 +390,7 @@ export class DatasetMappingComponent implements OnInit {
if (key === 'endAge' || key === 'co') {
return;
} else if (key === 'startAge') {
- const configuration = configurations.find(
+ const configuration = this.configurationOptionList.find(
(item: any) => item.value.keyToUseInMappings === 'ageGroup'
);
const selectedOption = configuration.value.options.find(
@@ -379,7 +405,7 @@ export class DatasetMappingComponent implements OnInit {
keyToUseInMappings: configuration.value.keyToUseInMappings,
});
} else {
- const configuration = configurations.find(
+ const configuration = this.configurationOptionList.find(
(item: any) => item.value.keyToUseInMappings === key
);
if (configuration) {
@@ -493,7 +519,6 @@ export class DatasetMappingComponent implements OnInit {
loincList$.subscribe({
next: (data: any) => {
this.isLoadingLoincCodesObs = false;
- console.log('Loinc Obs: ', data);
this.loincCodeOptionListObs =
data?.listOfLoincCodes?.map((item: any) => {
return {
@@ -509,6 +534,35 @@ export class DatasetMappingComponent implements OnInit {
});
}
+ searchMsdCodes() {
+ const msdList$: Observable
= this.searchMsdCodesChange$
+ .asObservable()
+ .pipe(debounceTime(500))
+ .pipe(
+ switchMap((value: string) => {
+ return this.dataSetManagementService.getMsdCodes(1, 10, [
+ { key: 'q', value: [value] },
+ ]);
+ })
+ );
+ msdList$.subscribe({
+ next: (data: any) => {
+ this.isLoadingMsdCodes = false;
+ this.msdCodesOptionList =
+ data?.listOfMsdCodes?.map((item: any) => {
+ return {
+ value: {
+ code: item.code,
+ name: item.name,
+ },
+ label: `${item.code}-${item.name}`,
+ };
+ }) ?? [];
+ },
+ error: (error: any) => {},
+ });
+ }
+
searchConfigurations() {
const configurationsList$: Observable =
this.searchConfigurationChange$
@@ -590,6 +644,13 @@ export class DatasetMappingComponent implements OnInit {
};
}),
+ msdMappings: this.selectedMsdCodes.map((item) => {
+ return {
+ code: item.code,
+ name: item.name,
+ };
+ }),
+
dataElement: {
id: this.selectedInputId,
name: '',
diff --git a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/constants/mappings-urls.ts b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/constants/mappings-urls.ts
index 3614906f..f31626d1 100644
--- a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/constants/mappings-urls.ts
+++ b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/constants/mappings-urls.ts
@@ -5,6 +5,7 @@ export enum MappingsUrls {
CONFIGURATIONS = 'hduApi/configurations',
GET_ICD_CODES = 'hduApi/codeSystems/icd/codes',
GET_LOINC_CODES = 'hduApi/codeSystems/loinc',
+ GET_MSD_CODES = 'hduApi/codeSystems/msd',
SELECT_DATASET_FOR_MAPPING = 'dataSets',
REMOVE_DATASET_FROM_MAPPING = 'dataSets',
GET_CATEGORY_OPTION_COMBO = 'dataElements',
diff --git a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/index.ts b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/index.ts
index 1e8b2945..cd821a5a 100644
--- a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/index.ts
+++ b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/index.ts
@@ -11,3 +11,4 @@ export * from './icd-code.model';
export * from './loinc-code.model';
export * from './responses/loinc-code-page';
export * from './data-template-blocks';
+export * from './msd-code.model'
diff --git a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/msd-code.model.ts b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/msd-code.model.ts
new file mode 100644
index 00000000..d41388f2
--- /dev/null
+++ b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/msd-code.model.ts
@@ -0,0 +1,11 @@
+export class MsdCode {
+ code!: string;
+ name!: string;
+
+ static fromJson(json: any): MsdCode {
+ const msdCode = new MsdCode();
+ msdCode.code = json.code;
+ msdCode.name = json.name;
+ return msdCode;
+ }
+}
diff --git a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/responses/msd-code-page.ts b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/responses/msd-code-page.ts
new file mode 100644
index 00000000..c35982e1
--- /dev/null
+++ b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/models/responses/msd-code-page.ts
@@ -0,0 +1,19 @@
+import { MsdCode } from '../';
+
+export class MsdCodePage {
+ total!: number;
+ pageIndex!: number;
+ pageSize!: number;
+ listOfMsdCodes!: MsdCode[];
+
+ static fromJson(json: any): MsdCodePage {
+ const msdCodePage = new MsdCodePage();
+ msdCodePage.total = json?.pager?.total ?? 0;
+ msdCodePage.pageIndex = json?.pager?.page ?? 0;
+ msdCodePage.pageSize = json?.pager?.pageSize ?? 0;
+ msdCodePage.listOfMsdCodes = (json?.results ?? []).map((item: any) =>
+ MsdCode.fromJson(item)
+ );
+ return msdCodePage;
+ }
+}
diff --git a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/services/dataset-management.service.ts b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/services/dataset-management.service.ts
index 831f7e8c..cf066727 100644
--- a/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/services/dataset-management.service.ts
+++ b/iadapter-applications/apps/mapping-and-data-extraction/src/app/modules/mappings/services/dataset-management.service.ts
@@ -142,6 +142,24 @@ export class DatasetManagementService {
);
}
+
+ getMsdCodes(
+ pageIndex: number,
+ pageSize: number,
+ filters: Array<{ key: string; value: string[] }>
+ ): Observable {
+ const params = this.buildHttpParams(pageIndex, pageSize, true, filters);
+
+ return this.httpClient
+ .get(MappingsUrls.GET_LOINC_CODES, { params })
+ .pipe(
+ map((response: { results: any }) => {
+ return LoincCodePage.fromJson(response);
+ }),
+ catchError((error: any) => this.handleError(error))
+ );
+ }
+
selectDatasetForMapping(
instanceUuid: string,
datasetUuid: string