Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch is a proposal it works and returns the same as the old function (with a change of order) but is mostly just for debate.
1. I just want to add a bunch of csvs... you can declare extract_rule.ExtractRule.
This is initialised with the list of episodes and the user.
Add a
write_to_file
(which takes the directory to write to as an argument and returns a list of the file names that you wrote, or None)Add a
get_data_dictionary
method which returns2. I want to change the fields that are in every csv.
You can declare a function in settings called EXTRACT_BASE_FIELDS that takes a user and returns the fields that the user should see in all files.
Cookbook
1. Rather than have an extract rule for allergies I want 1 row per patient with the allergy.drugs as a comma seperated list.
Add
_exclude_from_extract=True
to allergies2. I want to add the field 'within the last week' to PatientConsultation
Add
_exclude_from_extract=True
to PatientConsulation. This is not strictly necessary as the rule will run after the subrecord extract is done, but it stops additional computation.Then add the extract rule.
3. I want to remove the field
drug
from allergiesIn the models.py change
4. I want to add first_name, surname for all users
settings.py
extract_rule.py