diff --git a/apps/analysis/migrations/0016_auto_20240709_1541.py b/apps/analysis/migrations/0016_auto_20240716_0943.py similarity index 62% rename from apps/analysis/migrations/0016_auto_20240709_1541.py rename to apps/analysis/migrations/0016_auto_20240716_0943.py index e9ce4eb83f..8574feebbc 100644 --- a/apps/analysis/migrations/0016_auto_20240709_1541.py +++ b/apps/analysis/migrations/0016_auto_20240716_0943.py @@ -1,8 +1,13 @@ -# Generated by Django 3.2.25 on 2024-07-09 15:41 +# Generated by Django 3.2.25 on 2024-07-16 09:43 from django.db import migrations, models +def delete_ids(apps, schema_editor): + AutomaticSummary = apps.get_model('analysis', 'AutomaticSummary') + AutomaticSummary.objects.all().delete() + + class Migration(migrations.Migration): dependencies = [ @@ -10,14 +15,18 @@ class Migration(migrations.Migration): ] operations = [ + migrations.RunPython( + delete_ids, + reverse_code=migrations.RunPython.noop, + ), migrations.AddField( model_name='automaticsummary', - name='information_gap', + name='analytical_statement', field=models.TextField(blank=True), ), migrations.AddField( model_name='automaticsummary', - name='analytical_statement', + name='information_gap', field=models.TextField(blank=True), ), ] diff --git a/apps/analysis/migrations/0017_auto_20240709_1707.py b/apps/analysis/migrations/0017_auto_20240709_1707.py deleted file mode 100644 index 5017bb2503..0000000000 --- a/apps/analysis/migrations/0017_auto_20240709_1707.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.2.25 on 2024-07-09 17:07 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('analysis', '0016_auto_20240709_1541'), - ] - - operations = [ - migrations.AddField( - model_name='analyticalstatement', - name='is_information_gaps_nlp_triggered', - field=models.BooleanField(default=False), - ), - migrations.AddField( - model_name='analyticalstatement', - name='is_statement_nlp_triggered', - field=models.BooleanField(default=False), - ), - ] diff --git a/apps/analysis/migrations/0017_auto_20240716_1050.py b/apps/analysis/migrations/0017_auto_20240716_1050.py new file mode 100644 index 0000000000..8506c94422 --- /dev/null +++ b/apps/analysis/migrations/0017_auto_20240716_1050.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.25 on 2024-07-16 10:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('analysis', '0016_auto_20240716_0943'), + ] + + operations = [ + migrations.AlterField( + model_name='automaticsummary', + name='analytical_statement', + field=models.TextField(), + ), + migrations.AlterField( + model_name='automaticsummary', + name='information_gap', + field=models.TextField(), + ), + ] diff --git a/apps/analysis/models.py b/apps/analysis/models.py index b64b658b87..4292313f39 100644 --- a/apps/analysis/models.py +++ b/apps/analysis/models.py @@ -403,8 +403,6 @@ class AnalyticalStatement(UserResource): order = models.IntegerField() report_text = models.TextField(blank=True) information_gaps = models.TextField(blank=True) - is_statement_nlp_triggered = models.BooleanField(default=False) - is_information_gaps_nlp_triggered = models.BooleanField(default=False) # added to keep the track of cloned analysisstatement cloned_from = models.ForeignKey( 'AnalyticalStatement', @@ -528,8 +526,8 @@ def save(self, *args, **kwargs): class AutomaticSummary(EntriesCollectionNlpTriggerBase): summary = models.TextField() - analytical_statement = models.TextField(blank=True) - information_gap = models.TextField(blank=True) + analytical_statement = models.TextField() + information_gap = models.TextField() widget_tags = ArrayField(models.CharField(max_length=100), default=list) diff --git a/apps/analysis/serializers.py b/apps/analysis/serializers.py index 1dd119d840..fbc4a41654 100644 --- a/apps/analysis/serializers.py +++ b/apps/analysis/serializers.py @@ -308,8 +308,6 @@ class Meta: 'include_in_report', 'order', 'cloned_from', - 'is_statement_nlp_triggered', - 'is_information_gaps_nlp_triggered', # Custom 'entries', 'client_id', diff --git a/apps/analysis/tests/test_mutations.py b/apps/analysis/tests/test_mutations.py index b520c5e46a..5e00373901 100644 --- a/apps/analysis/tests/test_mutations.py +++ b/apps/analysis/tests/test_mutations.py @@ -90,6 +90,8 @@ class TestAnalysisNlpMutationSchema(GraphQLTestCase): id status summary + informationGap + analyticalStatement } } } @@ -539,11 +541,15 @@ def _query_check(_id): a_summary.refresh_from_db() assert a_summary.status == AutomaticSummary.Status.SUCCESS.value assert a_summary.summary == SAMPLE_SUMMARY_JSON['summary'] + assert a_summary.information_gap == SAMPLE_SUMMARY_JSON['info_gaps'] + assert a_summary.analytical_statement == SAMPLE_SUMMARY_JSON['analytical_statement'] # -- Check existing instance if provided until threshold is over response_result = _mutation_check(minput, okay=True)['data']['project']['triggerAnalysisAutomaticSummary']['result'] assert response_result['id'] == a_summary_id assert response_result['summary'] == SAMPLE_SUMMARY_JSON['summary'] + assert response_result['informationGap'] == SAMPLE_SUMMARY_JSON['info_gaps'] + assert response_result['analyticalStatement'] == SAMPLE_SUMMARY_JSON['analytical_statement'] a_summary.created_at = self.PATCHER_NOW_VALUE -\ datetime.timedelta(hours=AutomaticSummary.CACHE_THRESHOLD_HOURS + 1) diff --git a/schema.graphql b/schema.graphql index d06fd753cd..78207cc6d7 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1498,8 +1498,6 @@ input AnalyticalStatementGqlInputType { includeInReport: Boolean order: Int! clonedFrom: ID - isStatementNlpTriggered: Boolean - isInformationGapsNlpTriggered: Boolean entries: [AnalyticalEntriesGqlInputType!] clientId: String }