Skip to content

Chore/find patients pagination#760

Open
petroskayange wants to merge 1269 commits intodevelopmentfrom
chore/find_patients_pagination
Open

Chore/find patients pagination#760
petroskayange wants to merge 1269 commits intodevelopmentfrom
chore/find_patients_pagination

Conversation

@petroskayange
Copy link
Copy Markdown
Contributor

No description provided.

petroskayange and others added 30 commits September 2, 2025 11:37
  - add sync_record_to_couchdb to sync patient records after creation
  - ensure new patient records are synchronized with couchdb
- Refactor `get_patient_record` to fetch records using `CouchdbPatientService`
- Handle single and multiple patient ID requests
- Add error handling for missing patient ID, CouchDB connection, and other errors
- Remove the Sync module namespace
- Remove unnecessary base class inheritance
- Improve logging for better monitoring
- Process patient IDs in batches to avoid memory issues
- Queue PatientRecordSyncJob directly within the batch processing loop
- Remove unused methods and dependencies
- add CouchdbPatientService for managing patient records in CouchDB
- include methods to:
  - ensure the patient database exists
  - retrieve single/multiple patient records
  - build patient records using BuildPatientRecordService
  - save patient records to CouchDB, handling both new and existing documents
  - bulk update patients
  - sync patient data from external sources to CouchDB
- handle missing patient records by creating them on the fly
- use RestClient for HTTP requests to CouchDB
- configure CouchDB URL and database name via application.yml
- move BatchPatientSyncJob under Sync module
- this is to improve code organization and prevent naming conflicts【namespace】
- remove patient sync service
- remove sync patient records controller
- replace patient record sync job with batch patient sync job
- 【Stages】
  - implement couchdb sync on stage creation
  - use `sync_to_couchdb` method to push new stages to couchdb
- 【Visits】
  - implement couchdb sync on visit creation
  - generate a composite document id from identifier and start date
  - use `sync_to_couchdb` to push new visits to couchdb
- add `encounter_date_changed` to patient records
- create couchdb index on `encounter_date_changed`
- fetch latest `encounter_date_changed` to sync patients incrementally
- remove patient sync
- remove processed data
- introduce 'sync_offline_data' queue to handle background synchronization of offline data
- include skipped count to provide more detailed sync status
- include skipped count in the sync completion log for better visibility
- update handle_sync_completion to accept a 'skipped' parameter
- rescue ActiveRecord::RecordInvalid exception and render errors
- fix bug where global property was being created instead of updated
- use find_by instead of find_or_initialize_by to find existing record
- update existing record if found, otherwise create a new record
- use find_or_initialize_by to streamline property creation/update
- remove redundant begin/rescue blocks for cleaner error handling
- return errors from model for unprocessable entity responses
- remove primary key definition to fix the error caused by missing id column
…alProperty

✨ feat(global_property): change property column type to string with utf8mb4 encoding
- add endpoint to retrieve a list of patients
- implement patient record building service
- update sync job to include synced_at timestamp
- fix site prefix retrieval by location.... adding missing drugs, programs, lab test and diagnosis
🐛 fix(global_property): retrieve site prefix by location
- Add endpoint to retrieve HTS referral orders
- Create referral observation for HTS orders
✨ feat(lab): implement HTS referral orders
modified:   app/services/save_patient_record_service.rb
evance-mose and others added 30 commits March 11, 2026 14:27
…others metric and updating related calculations
…ple enrollments

Previously, the enrollment step was commented out and only handled a single program. Now it is active and processes multiple unsaved enrollments from the record data. The method now iterates over an array of enrollments, skips existing ones, and creates new PatientProgram records within a transaction for data integrity.
feat(patient-enrollment): enable program enrollment and support multi…
feat(medication-order-saver): enhance medication order processing with normalization and error handling
…service

- Centralize error logging and collection in BaseSaver for consistent error handling
- Add real-time broadcasting of patient record and stage updates via ActionCable
- Improve user resolution in PatientProgramService to handle various user input types
- Wrap operation results in structured OperationResult objects with error tracking
- Fix location ID resolution in stages creation and encounter service
- Ensure proper error propagation and transaction safety in SavePatientRecordService
feat: enhance error handling and real-time updates in patient record …
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.

8 participants