avniproject / avni-server

Backend APIs for Avni
https://avniproject.org
GNU Affero General Public License v3.0
7 stars 25 forks source link

Instead of blocking report card saving in production, any other solutions? #802

Closed mahalakshme closed 1 month ago

mahalakshme commented 1 month ago

AC:

himeshr commented 1 month ago

On discussion we found that the approach specified in #801 is not clean and could open up more issues than resolve. Therefore, we have decided to take a fall-forward approach and do the following:

For any further issues encountered during bundle upload or entity modifications, we'll follow a similar approach to fall forward through code fix and data migrations.

himeshr commented 1 month ago

Sample Error Responses as required after fix done in this card:

ReportCardBundleUploadError.csv

Screenshot 2024-10-09 at 2 32 47 PM Screenshot 2024-10-09 at 2 31 16 PM
himeshr commented 1 month ago

Code fix done

Code fix and DB migration done to update the existing database records to to use {"programs": [], "subjectTypes": [], "encounterTypes": []} instead of {} without updating the lastModifiedDateTime while ensuring we dont change the reportCards in-case there is no change.

Metabase Alerts have to be setup using below checks

select last_modified_date_time, age(last_modified_date_time, created_date_time) from dashboard_filter order by last_modified_date_time desc;
select last_modified_date_time, age(last_modified_date_time, created_date_time) from dashboard_section order by last_modified_date_time desc;
select last_modified_date_time, age(last_modified_date_time, created_date_time) from dashboard_section_card_mapping order by last_modified_date_time desc;
select last_modified_date_time, age(last_modified_date_time, created_date_time) from dashboard order by last_modified_date_time desc;
select last_modified_date_time, age(last_modified_date_time, created_date_time) from report_card order by last_modified_date_time desc;

Action need for Issue resolution

Fix the last modified date time for updated report cards (or other entities) to created date time value, if it is greater than our end of life date.

mahalakshme commented 1 month ago

@petmongrels one issue I see here is when we update the last_modified_date_time for an org, we need to keep track of it, so that next time when we need to update for the same org, it needs to be later than what was updated before

mahalakshme commented 1 month ago

@petmongrels may be not an issue, we can just keep track of minutes, independent of org, next day when we update, we can add some minutes and update

1t5j0y commented 1 month ago

QA

@AchalaBelokar

mahalakshme commented 1 month ago