Skip to content

Commit

Permalink
Remove Nlp trigger field from Analytical Statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Jul 17, 2024
1 parent 143bfe7 commit c8f9415
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
# 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 = [
('analysis', '0015_auto_20240531_0504'),
]

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),
),
]
23 changes: 0 additions & 23 deletions apps/analysis/migrations/0017_auto_20240709_1707.py

This file was deleted.

23 changes: 23 additions & 0 deletions apps/analysis/migrations/0017_auto_20240716_1050.py
Original file line number Diff line number Diff line change
@@ -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(),
),
]
6 changes: 2 additions & 4 deletions apps/analysis/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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)


Expand Down
2 changes: 0 additions & 2 deletions apps/analysis/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions apps/analysis/tests/test_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class TestAnalysisNlpMutationSchema(GraphQLTestCase):
id
status
summary
informationGap
analyticalStatement
}
}
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1498,8 +1498,6 @@ input AnalyticalStatementGqlInputType {
includeInReport: Boolean
order: Int!
clonedFrom: ID
isStatementNlpTriggered: Boolean
isInformationGapsNlpTriggered: Boolean
entries: [AnalyticalEntriesGqlInputType!]
clientId: String
}
Expand Down

0 comments on commit c8f9415

Please sign in to comment.