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

PEPPER-1364 . Additional PHI Manifest changes #2931

Merged
merged 1 commit into from
Aug 27, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class PhiManifestService {
public static final String SOMATIC_CONSENT_TUMOR_PEDIATRIC_QUESTION_STABLE_ID = "SOMATIC_CONSENT_TUMOR_PEDIATRIC";
public static final String SOMATIC_ASSENT_ADDENDUM_QUESTION_STABLE_ID = "SOMATIC_ASSENT_ADDENDUM";

public static final String CONSENT_SUSPENDED = "CONSENT_SUSPENDED";
public static final String CONSENT_ACTIVITY_CODE = "CONSENT";
public static final String CONSENT_ADDENDUM_ACTIVITY_ACTIVITY_CODE = "CONSENT_ADDENDUM";
public static final String LMS_QUESTION_SOMATIC_CONSENT_ADDENDUM_TUMOR_STABLE_ID = "SOMATIC_CONSENT_ADDENDUM_TUMOR";
public static final String OS2_QUESTION_SOMATIC_CONSENT_ADDENDUM_TUMOR_STABLE_ID = "SOMATIC_CONSENT_TUMOR";
Expand Down Expand Up @@ -73,7 +75,7 @@ public PhiManifestReportRoute.PhiManifestResponse generateReport(String ddpParti
* Creates a PhiManifest from the information in participant and in a clinical order
*/
public static PhiManifest generateDataForReport(@NonNull ElasticSearchParticipantDto participant, @NonNull List<MercuryOrderDto> orders,
@NonNull DDPInstanceDto ddpInstanceDto) {
@NonNull DDPInstanceDto ddpInstanceDto) {
//This method assumes that each order has at most 1 Tumor and at most 1 Normal sample, which is a correct assumption based on
// clinical ordering criteria currently in place
PhiManifest phiManifest = new PhiManifest();
Expand Down Expand Up @@ -166,7 +168,7 @@ private static String convertBooleanToYesNo(boolean b) {
*/
public static String convertBooleanActivityAnswerToString(Optional<Object> answer) {
if (answer.isPresent() && answer.get() instanceof Boolean) {
return convertBooleanToYesNo((Boolean)answer.get());
return convertBooleanToYesNo((Boolean) answer.get());
} else {
if (answer.isPresent()) {
return answer.get().toString();
Expand Down Expand Up @@ -209,15 +211,23 @@ private boolean hasParticipantConsentedToSharedLearning(ElasticSearchParticipant
}
String dateOfBirth = participant.getDsm().get().getDateOfBirth();
String dateOfMajority = (String) participant.getDsm().get().getDateOfMajority();
if (StringUtils.isBlank(dateOfMajority) || DateTimeUtil.isAdult(dateOfMajority)) {
return (Boolean)getAdultParticipantConsentedToTumorAnswer(participant, ddpInstanceDto.getStudyGuid())
String participantStatus = participant.getStatus().orElse("");
if (StringUtils.isBlank(dateOfMajority) || participant.hasCompletedActivity(CONSENT_ACTIVITY_CODE)) {
Copy link
Contributor Author

@ssettipalli ssettipalli Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicitly checking for SELF CONSENT will make sure aged-up and self enrolled fall into this category

//self adult enrollment
return (Boolean) getAdultParticipantConsentedToTumorAnswer(participant, ddpInstanceDto.getStudyGuid())
.orElse(false);
} else {
//pediatric or aged-up in lost to followup
return isPediatricValidForPHI(participant, dateOfBirth, participantStatus);
}
}

private static boolean isPediatricValidForPHI(ElasticSearchParticipantDto participant, String dateOfBirth, String participantStatus) {
int age = DateTimeUtil.calculateAgeInYears(dateOfBirth);
boolean hasCompletedPediatricConsentAddendum = participant.hasCompletedActivity(CONSENT_ADDENDUM_PEDIATRICS_ACTIVITY_CODE);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be an edge case in existing code base ... if child was enrolled when < 7 and after few years current age will be > 7.. and the child might not have this question: SOMATIC_ASSENT_ADDENDUM_QUESTION_STABLE_ID answered ! (Need to test this scenario later & might need to fix it) .


if (hasCompletedPediatricConsentAddendum) {
if (age >= 7) {
if (age >= 7 || participantStatus.equalsIgnoreCase(CONSENT_SUSPENDED)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agedup participants should fall into this >7 age for sure any way but explicitly checking for CONSENT_SUSPENDED will help just incase DOB isn't in ES DSM document.
Doesnt hurt to include in OR , hence added

return participant.checkAnswerToActivity(CONSENT_ADDENDUM_PEDIATRICS_ACTIVITY_CODE,
SOMATIC_CONSENT_TUMOR_PEDIATRIC_QUESTION_STABLE_ID, true) && participant.checkAnswerToActivity(
CONSENT_ADDENDUM_PEDIATRICS_ACTIVITY_CODE, SOMATIC_ASSENT_ADDENDUM_QUESTION_STABLE_ID, true);
Expand Down
Loading