Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KPMP-5702: Remove value labels #282

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/helpers/dataHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ export const mapSummaryKeysToPresentationStyle = (data) => {

export const mapClinicalKeysToPresentationStyle = (data) => {
const result = {};
result['A1c %']= "";
result['Albuminuria (mg)'] = "";
result['Baseline eGFR (ml/min/1.73m2)'] = "";
result['Diabetes Duration (Years)'] = "";
result['A1c']= "";
result['Albuminuria'] = "";
result['Baseline eGFR'] = "";
result['Diabetes Duration'] = "";
result['Diabetes History'] = "";
result['Hypertension Duration (years)'] = "";
result['Hypertension Duration'] = "";
result['Hypertension History'] = "";
result['KDIGO Stage'] = "";
result['RAAS Blockade'] = "";
result['Proteinuria (mg)'] = "";
result['Proteinuria'] = "";
result['Race'] = "";
result['Age (Years)'] = "";
result['Age'] = "";
result['Sample Type'] = "";
result['Sex'] = "";
result['Protocol'] = "";
Expand All @@ -81,22 +81,22 @@ export const mapClinicalKeysToPresentationStyle = (data) => {
return result;
}
if (data.a1c) {
result['A1c %'] = data.a1c ? data.a1c : "";
result['A1c'] = data.a1c ? data.a1c : "";
}
if (data.albuminuria) {
result['Albuminuria (mg)'] = data.albuminuria ? data.albuminuria : "";
result['Albuminuria'] = data.albuminuria ? data.albuminuria : "";
}
if (data.baselineEgfr) {
result['Baseline eGFR (ml/min/1.73m2)'] = data.baselineEgfr ? data.baselineEgfr.replace(' ml/min/1.73m2', '') : "";
result['Baseline eGFR'] = data.baselineEgfr ? data.baselineEgfr : "";
}
if (data.diabetesDuration) {
result['Diabetes Duration (Years)'] = data.diabetesDuration ? data.diabetesDuration.replace(' Years', '') : "";
result['Diabetes Duration'] = data.diabetesDuration ? data.diabetesDuration : "";
}
if (data.diabetesHistory) {
result['Diabetes History'] = data.diabetesHistory ? data.diabetesHistory : "";
}
if (data.hypertensionDuration) {
result['Hypertension Duration (years)'] = data.hypertensionDuration ? data.hypertensionDuration.replace(' Years', '') : "";
result['Hypertension Duration'] = data.hypertensionDuration ? data.hypertensionDuration : "";
}
if (data.hypertensionHistory) {
result['Hypertension History'] = data.hypertensionHistory ? data.hypertensionHistory : "";
Expand All @@ -108,13 +108,13 @@ export const mapClinicalKeysToPresentationStyle = (data) => {
result['RAAS Blockade'] = data.onRaasBlockade ? data.onRaasBlockade : "";
}
if (data.proteinuria) {
result['Proteinuria (mg)'] = data.proteinuria ? data.proteinuria : "";
result['Proteinuria'] = data.proteinuria ? data.proteinuria : "";
}
if (data.race) {
result['Race'] = data.race ? data.race : "";
}
if (data.ageBinned) {
result['Age (Years)'] = data.ageBinned ? data.ageBinned.replace(' Years', '') : "";
result['Age'] = data.ageBinned ? data.ageBinned : "";
}

if (data.sampleType) {
Expand Down
68 changes: 32 additions & 36 deletions src/helpers/dataHelper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,22 @@ describe('dataHelper', () => {
};
const clinicalMappingResult = mapClinicalKeysToPresentationStyle(clinicalUnmapped);
const expectedClinicalMapping = {
'A1c %': "test-a1c",
'Albuminuria (mg)': 'test-albuminuria',
'Baseline eGFR (ml/min/1.73m2)': 'test-baseline_egfr',
'Diabetes Duration (Years)': 'test-diabetes_duration',
'A1c': "test-a1c",
'Albuminuria': 'test-albuminuria',
'Baseline eGFR': 'test-baseline_egfr',
'Diabetes Duration': 'test-diabetes_duration',
'Diabetes History': 'test-diabetes_history',
'Hypertension Duration (years)': 'test-hypertension_duration',
'Hypertension Duration': 'test-hypertension_duration',
'Hypertension History': 'test-hypertension_history',
'KDIGO Stage': 'testdkigo_stage',
'RAAS Blockade': 'test-on_raas_blockade',
'Proteinuria (mg)': 'proteinuria',
'Proteinuria': 'proteinuria',
'Race': 'test-race',
'Age (Years)': 'test-Age',
'Age': 'test-age',
'Sample Type': 'test-sample_type',
'Sex': 'test-sex',
'Protocol': 'test-protocol',
'Tissue Source': 'test-tissue_source',
'Age (Years)': 'test-age'
'Tissue Source': 'test-tissue_source'
}
expect(clinicalMappingResult).toEqual(expectedClinicalMapping);
}),
Expand All @@ -125,71 +124,68 @@ describe('dataHelper', () => {
};
const clinicalMappingResult = mapClinicalKeysToPresentationStyle(clinicalUnmapped);
const expectedClinicalMapping = {
'A1c %': "test-a1c",
'Albuminuria (mg)': 'test-albuminuria',
'Baseline eGFR (ml/min/1.73m2)': '',
'Diabetes Duration (Years)': '',
'A1c': "test-a1c",
'Albuminuria': 'test-albuminuria',
'Baseline eGFR': '',
'Diabetes Duration': '',
'Diabetes History': '',
'Hypertension Duration (years)': '',
'Hypertension Duration': '',
'Hypertension History': '',
'KDIGO Stage': '',
'RAAS Blockade': '',
'Proteinuria (mg)': '',
'Proteinuria': '',
'Race': '',
'Age (Years)': '',
'Age': '',
'Sample Type': '',
'Sex': '',
'Protocol': '',
'Tissue Source': '',
'Age (Years)': ''
'Tissue Source': ''
};
expect(clinicalMappingResult).toEqual(expectedClinicalMapping);
}),
it('should return remapped values when empty object params given', () => {
let clinicalUnmapped = {};
const clinicalMappingResult = mapClinicalKeysToPresentationStyle(clinicalUnmapped);
const expectedClinicalMapping = {
'A1c %': "",
'Albuminuria (mg)': '',
'Baseline eGFR (ml/min/1.73m2)': '',
'Diabetes Duration (Years)': '',
'A1c': "",
'Albuminuria': '',
'Baseline eGFR': '',
'Diabetes Duration': '',
'Diabetes History': '',
'Hypertension Duration (years)': '',
'Hypertension Duration': '',
'Hypertension History': '',
'KDIGO Stage': '',
'RAAS Blockade': '',
'Proteinuria (mg)': '',
'Proteinuria': '',
'Race': '',
'Age (Years)': '',
'Age': '',
'Sample Type': '',
'Sex': '',
'Protocol': '',
'Tissue Source': '',
'Age (Years)': ''
'Tissue Source': ''
};
expect(clinicalMappingResult).toEqual(expectedClinicalMapping);
}),
it('should return remapped values when null params given', () => {
let clinicalUnmapped = null;
const clinicalMappingResult = mapClinicalKeysToPresentationStyle(clinicalUnmapped);
const expectedClinicalMapping = {
'A1c %': "",
'Albuminuria (mg)': '',
'Baseline eGFR (ml/min/1.73m2)': '',
'Diabetes Duration (Years)': '',
'A1c': "",
'Albuminuria': '',
'Baseline eGFR': '',
'Diabetes Duration': '',
'Diabetes History': '',
'Hypertension Duration (years)': '',
'Hypertension Duration': '',
'Hypertension History': '',
'KDIGO Stage': '',
'RAAS Blockade': '',
'Proteinuria (mg)': '',
'Proteinuria': '',
'Race': '',
'Age (Years)': '',
'Age': '',
'Sample Type': '',
'Sex': '',
'Protocol': '',
'Tissue Source': '',
'Age (Years)': ''
'Tissue Source': ''
};
expect(clinicalMappingResult).toEqual(expectedClinicalMapping);
})
Expand Down
Loading