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 #1927

Conversation

DraKen0009
Copy link
Contributor

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 [ working on it ]

Associated Issue

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete
  • Any other necessary step

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

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

@DraKen0009
Copy link
Contributor Author

please let me know if i missed any use of external_id in reference to MedibaseMedicine model

ICD11(
id=icd11_id_to_int(diagnosis.get("ID")),
label=diagnosis.get("label"),
chapter=diagnosis.get("meta_chapter_short", ""),
Copy link
Member

Choose a reason for hiding this comment

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

@DraKen0009
Copy link
Contributor Author

  • made some changes to load_icd11_diagnose_data file.
  • updated migrations field for removing external_id before populating data

@sainak
Copy link
Member

sainak commented Feb 29, 2024

@DraKen0009 extract the logic from the management command to a common utils file

the migrations will be complex

  1. clear the migration where we are loading the medicines
  2. create the unique id fields but dont make them primary key
  3. add the load_medicine_data migration, make sure the external_id remains consistent
  4. create new nullable foreign key relations to the id field wherever we are referencing the external_id
  5. populate the new foreign key fields
  6. remove the old fk fields
  7. rename the new fk fields to the old name so the other code does not break
  8. make id primary key
  9. remove external_id

@DraKen0009
Copy link
Contributor Author

contd. #1941

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.

2 participants