Skip to content

Commit

Permalink
Merge pull request #276 from KPMP/KPMP-5395_add_adjudicated_cat_to_re…
Browse files Browse the repository at this point in the history
…port

KPMP-5395: add primary adjudicated category to participant report
  • Loading branch information
zwright authored Nov 13, 2024
2 parents 42a51e8 + b6c4126 commit fbc8df4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/ReportCard/ReportCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ReportCard extends Component {
getDefaultColumnWidths = () => {
return [
{ columnName: 'key', width: 215 },
{ columnName: 'value', width: 180 },
{ columnName: 'value', width: 200 },
]
};
getDefaultLinkColumnWidths = () => {
Expand Down
1 change: 1 addition & 0 deletions src/helpers/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const fetchParticipantSummaryDataset = async (redcapId) => {
participantSummaryDataset(redcapId: $redcapId){
enrollmentCategory
redcapId
adjudicatedCategory
}
}`;
const response = await apolloClient.query({
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/dataHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const mapSummaryKeysToPresentationStyle = (data) => {
const result = {};
result['Participant ID'] = "";
result['Enrollment Category'] = "";
result['Primary Adjudicated Category'] = "";
if (!data || data === {}) {
return result;
}
Expand All @@ -51,6 +52,9 @@ export const mapSummaryKeysToPresentationStyle = (data) => {
if (data['enrollmentCategory']) {
result['Enrollment Category'] = data['enrollmentCategory'] ? data['enrollmentCategory'] : "";
}
if (data['adjudicatedCategory']) {
result['Primary Adjudicated Category'] = data['adjudicatedCategory'] ? data['adjudicatedCategory'] : "";
}
return result;
};

Expand Down
27 changes: 18 additions & 9 deletions src/helpers/dataHelper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,42 @@ describe('dataHelper', () => {
it('should return remapped values when object params given', () => {
let summaryUnmapped = {
redcapId: "test-redcapId",
enrollmentCategory: "test-enrollmentCategory"
enrollmentCategory: "test-enrollmentCategory",
adjudicatedCategory: "test-adjudicatedCategory"
};
let summaryMappingResult = mapSummaryKeysToPresentationStyle(summaryUnmapped);
let expectedSummaryMapping = {
'Participant ID': "test-redcapId",
'Enrollment Category': "test-enrollmentCategory"
'Enrollment Category': "test-enrollmentCategory",
'Primary Adjudicated Category': "test-adjudicatedCategory"
}
expect(summaryMappingResult).toEqual(expectedSummaryMapping);
}),
it('should return remapped values when some values from object params given', () => {
let summaryUnmapped = {
redcapId: "test-redcapId",
enrollmentCategory: ""
enrollmentCategory: "",
adjudicatedCategory: ""
};
let summaryMappingResult = mapSummaryKeysToPresentationStyle(summaryUnmapped);
let expectedSummaryMapping = {
'Participant ID': "test-redcapId",
'Enrollment Category': ""
'Enrollment Category': "",
'Primary Adjudicated Category': ""
}
expect(summaryMappingResult).toEqual(expectedSummaryMapping);
}),
it('should return remapped values when some values from object params given', () => {
let summaryUnmapped = {
redcapId: "",
enrollmentCategory: "test-enrollmentCategory"
enrollmentCategory: "test-enrollmentCategory",
adjudicatedCategory: ""
};
let summaryMappingResult = mapSummaryKeysToPresentationStyle(summaryUnmapped);
let expectedSummaryMapping = {
'Participant ID': "",
'Enrollment Category': "test-enrollmentCategory"
'Enrollment Category': "test-enrollmentCategory",
'Primary Adjudicated Category': ""
}
expect(summaryMappingResult).toEqual(expectedSummaryMapping);
}),
Expand All @@ -43,7 +49,8 @@ describe('dataHelper', () => {
let summaryMappingResult = mapSummaryKeysToPresentationStyle(summaryUnmapped);
let expectedSummaryMapping = {
'Participant ID': "",
'Enrollment Category': ""
'Enrollment Category': "",
'Primary Adjudicated Category': ""
}
expect(summaryMappingResult).toEqual(expectedSummaryMapping);
}),
Expand All @@ -52,15 +59,17 @@ describe('dataHelper', () => {
let summaryMappingResult = mapSummaryKeysToPresentationStyle(summaryUnmapped);
let expectedSummaryMapping = {
'Participant ID': "",
'Enrollment Category': ""
'Enrollment Category': "",
'Primary Adjudicated Category': ""
}
expect(summaryMappingResult).toEqual(expectedSummaryMapping);
});
it('should return empty values when no params given', () => {
let summaryMappingResult = mapSummaryKeysToPresentationStyle();
let expectedSummaryMapping = {
'Participant ID': "",
'Enrollment Category': ""
'Enrollment Category': "",
'Primary Adjudicated Category': ""
}
expect(summaryMappingResult).toEqual(expectedSummaryMapping);
});
Expand Down

0 comments on commit fbc8df4

Please sign in to comment.