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

fix: changes to form save validations for duplicate facilities #93

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

MatiasArriola
Copy link
Contributor

@MatiasArriola MatiasArriola commented Feb 19, 2025

📌 References

📝 Implementation

  • Updated SaveFormDataUseCase:
    • Extracted validation to validate method
    • Check for duplication only for current SurveyId
  • Added also a condition for PPSHospitalForm, to avoid Hospital duplicates in the same Survey
  • Added getParentSurveyId method to Questionnaire.
  • While I looked up SURVEY_ID_FACILITY_LEVEL_DATAELEMENT_ID I saw the opportunity to refactor and reuse the new parentPrevalenceSurveyIdList.
  • Tried to do the same with patientIdList, but as Ids were different, I kept the same behavior but just left a TODO comment.

📹 Screenshots/Screen capture

2025-02-19.13-29-07.mp4

@ifoche
Copy link
Member

ifoche commented Feb 19, 2025

@MatiasArriola MatiasArriola marked this pull request as draft February 20, 2025 17:20
@ifoche
Copy link
Member

ifoche commented Feb 20, 2025

@MatiasArriola MatiasArriola changed the title fix: Change Prevalence Facility save validation to allow same facility in different surveys fix: changes to form save validations for duplicate facilities Feb 20, 2025
@MatiasArriola MatiasArriola marked this pull request as ready for review February 21, 2025 18:09
Copy link
Contributor

@9sneha-n 9sneha-n left a comment

Choose a reason for hiding this comment

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

Thanks @MatiasArriola , looks good.

currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_DF ||
currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_COH ||
(parentPrevalenceSurveyIdList.includes(currentQuestion.id) ||
// TODO: check if patientIdList can be used here (not all IDs overlap)
Copy link
Contributor

Choose a reason for hiding this comment

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

@MatiasArriola maybe we can check with Miquel if all the ids in patientIdList should be disabled. Maybe we have missed out a few and they should ideally overlap?

Copy link
Contributor

Choose a reason for hiding this comment

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

@9sneha-n what do you mean by disabled? That the field in a detail is not editable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think It could be a good idea to handle this refactor in a separate task/PR.
It is related to the list of metadata IDs that disable a question (e.g. survey id, patient id). Recently parentPrevalenceSurveyIdList and patientIdList were introduced as a code improvement to group these Ids. Although unrelated to this PR, I noticed an opportunity to reuse these lists, but it wasn't straightforward for patientIdList. We would need to review the IDs first.
As Sneha mentioned, reviewing this list might reveal some inconsistent behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Noted. We can add this backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants