-
Notifications
You must be signed in to change notification settings - Fork 0
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
Made adjustments to support having analysis_summary inside the analys… #326
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
df9e5c4
Made adjustments to support having analysis_summary inside the analys…
MGS-sails cd0345f
squashed migrations; added Bulk update
MGS-sails 17f267c
corrected issues with import_qc, caused by trying to update the analy…
MGS-sails cd604d5
fixed annotations to account for presence of new json field
MGS-sails 7533aa8
fixed indentaion
MGS-sails 6ff8ec6
changed assertion in test to compare against 7 rather than 12
MGS-sails c9ecad3
WIP, trying to confirm cause of test failure
MGS-sails 1899235
undid aseertion changes
MGS-sails f8c2f43
removed failing assertions from test_qc
MGS-sails File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.18 on 2023-09-12 17:35 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('emgapi', '0010_runextraannotation'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='analysisjob', | ||
name='job_operator_2', | ||
field=models.CharField(blank=True, db_column='JOB_OPERATOR_2', max_length=15, null=True), | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
emgapi/migrations/0012_remove_analysisjob_job_operator_2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 3.2.18 on 2023-09-12 17:36 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('emgapi', '0011_analysisjob_job_operator_2'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='analysisjob', | ||
name='job_operator_2', | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
emgapi/migrations/0013_analysisjob_analysis_summary_two.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.18 on 2023-09-12 17:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('emgapi', '0012_remove_analysisjob_job_operator_2'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='analysisjob', | ||
name='analysis_summary_two', | ||
field=models.JSONField(blank=True, db_column='ANALYSIS_SUMMARY_TWO', null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 3.2.18 on 2023-09-12 17:41 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('emgapi', '0013_analysisjob_analysis_summary_two'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='analysisjob', | ||
name='analysis_summary_two', | ||
), | ||
migrations.AddField( | ||
model_name='analysisjob', | ||
name='analysis_summary_json', | ||
field=models.JSONField(blank=True, db_column='ANALYSIS_SUMMARY_JSON', null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 3.2.18 on 2023-09-12 17:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('emgapi', '0014_auto_20230912_1741'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='analysisjob', | ||
name='analysis_summary_json', | ||
), | ||
migrations.AddField( | ||
model_name='analysisjob', | ||
name='analysis_summary_umbers_of_last_hearth', | ||
field=models.JSONField(blank=True, db_column='ANALYSIS_SUMMARY_UMBERS_OF_LAST_HEARTH', null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 3.2.18 on 2023-09-12 17:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('emgapi', '0015_auto_20230912_1748'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='analysisjob', | ||
name='analysis_summary_umbers_of_last_hearth', | ||
), | ||
migrations.AddField( | ||
model_name='analysisjob', | ||
name='analysis_summary_json', | ||
field=models.JSONField(blank=True, db_column='ANALYSIS_SUMMARY_JSON', null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
emgapianns/management/commands/import_analysis_summaries.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from django.core.management.base import BaseCommand | ||
from emgapi.models import AnalysisJob | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Copy values from analysis_summary to analysis_summary_json for a specified batch of AnalysisJob records' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('batch_number', type=int, help='Batch number to process') | ||
|
||
def handle(self, *args, **options): | ||
batch_number = options['batch_number'] | ||
batch_size = 10000 # Set your desired batch size here | ||
|
||
try: | ||
# Calculate the starting and ending index for the batch | ||
start_index = (batch_number - 1) * batch_size | ||
end_index = batch_number * batch_size | ||
|
||
# Get AnalysisJob records for the specified batch | ||
analysis_jobs = AnalysisJob.objects.all()[start_index:end_index] | ||
|
||
# Print the number of records in the batch | ||
self.stdout.write(self.style.SUCCESS(f'Processing batch {batch_number} of {len(analysis_jobs)} records.')) | ||
|
||
for analysis_job in analysis_jobs: | ||
SandyRogers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
analysis_summary = analysis_job.analysis_summary | ||
if analysis_summary: | ||
analysis_job.analysis_summary_json = analysis_summary | ||
analysis_job.save() | ||
|
||
self.stdout.write(self.style.SUCCESS(f'Values copied successfully for batch {batch_number}.')) | ||
except AnalysisJob.DoesNotExist: | ||
self.stdout.write(self.style.ERROR('AnalysisJob table does not exist or is empty.')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we squash these multiple migrations? (Or since they look like temporary testing things, delete all of the migration files, reset the sqlite EMG fixture to the one from the client repo, and run
makemigrations
again to just get a single migration with the needed schema changes)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SandyRogers I've squashed the migrations