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

Loading medibase and icd11 static json and migrations #1941

Closed
wants to merge 21 commits into from

Conversation

DraKen0009
Copy link
Contributor

@DraKen0009 DraKen0009 commented Mar 4, 2024

Proposed Changes

1.Updated medibase.json

  • removed _id field
  • added id field

2.Updated MedibaseMedicine model , removed external_id

3.Updated python manage.py load_redis_index command to directly use the json to populate the redis

4.Migrate all related models to use id as fk instead of external_id

Associated Issue

Merge Checklist

  • Tests added/fixed
  • Linting Complete

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins

update_fields=[
"created_date",
"modified_date",
"deleted",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"deleted",

@@ -24,6 +24,7 @@ def handle(self, *args, **options):
MedibaseMedicine.objects.bulk_create(
Copy link
Member

Choose a reason for hiding this comment

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

add a check to fallback to bulk create only if there are no medicines in the db to speed up the process

data = json.load(f)

for medicine in data:
m = MedibaseMedicine.objects.get(name=medicine["name"])
Copy link
Member

Choose a reason for hiding this comment

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

create in case of DoesNotExists error

@sainak sainak added the to-be-closed PRs with no updates in the last 3 weeks will be closed label May 12, 2024
@sainak sainak added changes required and removed to-be-closed PRs with no updates in the last 3 weeks will be closed labels May 12, 2024
@sainak sainak reopened this May 12, 2024
@sainak sainak requested a review from a team as a code owner May 12, 2024 12:06
@DraKen0009 DraKen0009 closed this May 13, 2024
@DraKen0009 DraKen0009 deleted the fixing-migrations branch May 13, 2024 15:11
@DraKen0009 DraKen0009 restored the fixing-migrations branch May 13, 2024 15:16
@sainak sainak reopened this May 13, 2024
@sainak sainak self-assigned this May 20, 2024
@vigneshhari
Copy link
Member

@sainak either complete or close this MR.

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

Successfully merging this pull request may close these issues.

Clear entries from the search index if they are not in db anymore Load medibase and icd11 from static json
4 participants