-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #793 from FluxNotes/summary-section-reorg
Summary section reorg
- Loading branch information
Showing
15 changed files
with
473 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import MetadataSection from "./MetadataSection"; | ||
import _ from 'lodash'; | ||
|
||
export default class ActiveConditionsSubsection extends MetadataSection { | ||
getMetadata(preferencesManager, patient, condition, roleType, role, specialty) { | ||
return { | ||
name: "Active Conditions", | ||
itemsFunction: this.getItemListForConditions | ||
}; | ||
} | ||
|
||
// Returns conditions in the correct format to be displayed in the summary section | ||
getItemListForConditions = (patient, currentConditionEntry) => { | ||
if (_.isNull(patient) || _.isNull(currentConditionEntry)) return []; | ||
|
||
const conditions = patient.getActiveConditions(); | ||
|
||
return conditions.map(c => { | ||
const value = this.getValue(c,patient); | ||
const name = c.type; | ||
return { | ||
name, | ||
value | ||
}; | ||
}); | ||
} | ||
|
||
// Returns the supplementary info for the condition (i.e. location and diagnosis date) | ||
getValue = (condition, patient) => { | ||
const val = condition.bodySite; | ||
const unsigned = patient.isUnsigned(condition); | ||
const source = this.determineSource(patient, condition); | ||
const when = condition.diagnosisDate; | ||
return { | ||
source, | ||
when, | ||
value: val, | ||
isUnsigned: unsigned, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import MetadataSection from './MetadataSection'; | ||
import ActiveTreatmentSummaryObjectFactory from '../activeTreatmentSummary/ActiveTreatmentSummaryObjectFactory'; | ||
import _ from 'lodash'; | ||
|
||
export default class ActiveTreatmentsSubsection extends MetadataSection { | ||
getMetadata(preferencesManager, patient, condition, roleType, role, specialty) { | ||
return { | ||
name: "Treatment", | ||
itemsFunction: this.getItemListForTreatments | ||
}; | ||
} | ||
|
||
// Returns toxicites in the correct format to be displayed in the summary section | ||
getItemListForTreatments = (patient, currentConditionEntry) => { | ||
if (_.isNull(patient) || _.isNull(currentConditionEntry)) return []; | ||
|
||
const activeTreatmentSummaryObject = ActiveTreatmentSummaryObjectFactory.createInstance(patient, currentConditionEntry); | ||
const activeTreatmentSummaryJson = activeTreatmentSummaryObject.getActiveTreatmentSummary(patient, currentConditionEntry); | ||
|
||
if (_.isNull(activeTreatmentSummaryJson) || _.isUndefined(activeTreatmentSummaryJson.displayText)) return []; | ||
|
||
// Always use the displayText provided back from the summaryObject | ||
const treatmentSummaryValue = activeTreatmentSummaryJson.displayText; | ||
const treatments = []; | ||
|
||
// If there are medications, push mediations to treatments array | ||
if (activeTreatmentSummaryJson.medications) { | ||
activeTreatmentSummaryJson.medications.forEach((med) => { | ||
const name = `${treatmentSummaryValue} ${med.medication}`; | ||
const value = this.getMedValue(med, patient); | ||
treatments.push({ | ||
name, | ||
value, | ||
shortcut: null | ||
}); | ||
}); | ||
} | ||
|
||
// TO DO: Support adding relevant procedures into treatments table | ||
|
||
return treatments; | ||
} | ||
|
||
// Returns the value for the toxicity which includes grade, unsigned, source, and date | ||
getMedValue = (med, patient) => { | ||
const val = `${med.startDate} - ${med.endDate}`; | ||
const unsigned = patient.isUnsigned(med); | ||
const source = this.determineSource(patient, med); | ||
|
||
return { | ||
source, | ||
value: val, | ||
isUnsigned: unsigned, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.