Skip to content

Deploy merge#5790

Open
sshinde-rtsl wants to merge 10 commits intomasterfrom
deploy-merge
Open

Deploy merge#5790
sshinde-rtsl wants to merge 10 commits intomasterfrom
deploy-merge

Conversation

@sshinde-rtsl
Copy link
Copy Markdown
Contributor

Story card: sc-XXXX

Because

Enter the reason for raising this PR...

This addresses

Enter the details of what all this covers...

Test instructions

Enter detailed instructions for how to test this PR...

- Add migration to create patient_scores table (with existence check)
- Add PatientScore model with Mergeable concern
- Add Api::V4::PatientScoresController with sync_to_user only
- Add PatientScoreTransformer for response transformation
- Add patient_score schema to Api::V4::Models
- Add GET route for /patient_scores/sync
- Add factory and controller spec for patient_scores (sync_to_user only)
…t line 9724, which terminated the INSERT INTO schema_migrations statement early. The migration

 versions on lines 9725-9729 were left as orphaned SQL, causing the syntax error.
 - Added filter_enabled? method that checks Flipper.enabled?(:patient_deduplication_filter, current_admin)
 - before_action :set_filter_options now only runs if filter is enabled
 - Filter logic in show action is conditional on feature flag
@igbanam
Copy link
Copy Markdown
Contributor

igbanam commented Mar 27, 2026

Hi @sshinde-rtsl

Could you please update the PR description with what this PR actually does?

Thanks

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

This PR is stale. Please review/update it or close it.

Copy link
Copy Markdown
Contributor

@igbanam igbanam left a comment

Choose a reason for hiding this comment

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

From what I gather looking through implementation here, it looks like we are trying to vend the patient_scores resource to the mobile somehow. If this is why we are doing this, please update the PR description and the JIRA ticket so it's clear.

A couple comments

  1. I think a simple GET endpoint will suffice here. Patient Scores don't need to be sync'd from the field. Think of it as a "materialized view" of sorts from data collected from the field.
  2. If you've been instructed to do this as a sync route, please do two things (1) document that instruction somewhere so future collaborators can understand the decision path here, and (2) fix the link to patients, because that causes an order bug.

Comment on lines +10 to +18
# Apply facility filter if selected and feature flag is enabled
filtered_facilities = if filter_enabled? && @selected_facility.present?
facilities.where(id: @selected_facility.id)
elsif filter_enabled? && @selected_district.present?
facilities.where(id: @selected_district.facilities)
else
facilities
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we still need #5789 if we have this here as well?

Comment on lines +75 to +77
scope :patient_scores do
get "sync", to: "patient_scores#sync_to_user"
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need a sync route for this? PatientScore is not data we collect from the field per se; it's calculated from the data collected. A simple GET route would suffice here. Am I missing something?

def change
unless table_exists?(:patient_scores)
create_table :patient_scores, id: :uuid do |t|
t.references :patient, null: false, foreign_key: true, type: :uuid
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a potential breakage. See the fixes in #5768 and #5795.

Please fix this

@igbanam
Copy link
Copy Markdown
Contributor

igbanam commented Apr 8, 2026

Oh and there's significant overlap with #5789. You may want to look into that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants