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

7492 additional ai fields #7513

Merged
merged 3 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by Django 3.1.11 on 2021-09-26 21:56

from django.db import migrations, models
import networkapi.wagtailpages.fields


class Migration(migrations.Migration):

dependencies = [
('wagtailpages', '0038_auto_20210924_2002'),
]

operations = [
migrations.AddField(
model_name='generalproductpage',
name='ai_can_user_control',
field=networkapi.wagtailpages.fields.ExtendedYesNoField(help_text='Does the user have control over the AI features?'),
),
migrations.AddField(
model_name='generalproductpage',
name='ai_can_user_control_helptext',
field=models.TextField(blank=True, help_text='Helptext that will appear in the can user control section.', max_length=5000),
),
migrations.AddField(
model_name='generalproductpage',
name='ai_is_transparent_helptext',
field=models.TextField(blank=True, help_text='Helptext that will appear in the AI is transparent section.', max_length=5000),
),
migrations.AddField(
model_name='generalproductpage',
name='ai_is_untrustworthy_helptext',
field=models.TextField(blank=True, help_text='Helptext that will appear in the AI is untrustworthy section.', max_length=5000),
),
migrations.AlterField(
model_name='generalproductpage',
name='ai_is_untrustworthy',
field=networkapi.wagtailpages.fields.ExtendedYesNoField(help_text='Is the AI untrustworthy?'),
),
]
60 changes: 45 additions & 15 deletions network-api/networkapi/wagtailpages/pagemodels/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,24 +1108,18 @@ class GeneralProductPage(ProductPage):
uses_ai = ExtendedYesNoField(
help_text='Does the product use AI?'
)

ai_uses_personal_data = ExtendedYesNoField(
help_text='Does the AI use your personal data to make decisions about you?'
)

ai_is_transparent = ExtendedYesNoField(
help_text='Does the company allow users to see how the AI works?'
)

ai_helptext = models.TextField(
max_length=5000,
blank=True,
help_text='Helpful text around AI to show on the product page',
)
ai_is_untrustworthy = models.BooleanField(
null=True,
ai_is_untrustworthy = ExtendedYesNoField(
help_text='Is the AI untrustworthy?'
)
ai_is_untrustworthy_helptext = models.TextField(
max_length=5000,
blank=True,
help_text='Is the AI untrustworthy?',
help_text='Helptext that will appear in the AI is untrustworthy section.',
)
ai_is_untrustworthy_ding = models.BooleanField(
help_text='Tick this box if the AI invades privacy or behaves unethically.',
Expand All @@ -1135,6 +1129,25 @@ class GeneralProductPage(ProductPage):
blank=True,
help_text='What kind of decisions does this AI make about you or for you?'
)
ai_is_transparent = ExtendedYesNoField(
help_text='Does the company allow users to see how the AI works?'
)
ai_is_transparent_helptext = models.TextField(
max_length=5000,
blank=True,
help_text='Helptext that will appear in the AI is transparent section.',
)
ai_can_user_control = ExtendedYesNoField(
help_text='Does the user have control over the AI features?'
)
ai_can_user_control_helptext = models.TextField(
max_length=5000,
blank=True,
help_text='Helptext that will appear in the can user control section.',
)
ai_uses_personal_data = ExtendedYesNoField(
help_text='Does the AI use your personal data to make decisions about you?'
)

@classmethod
def map_import_fields(cls):
Expand All @@ -1158,9 +1171,13 @@ def map_import_fields(cls):
"AI uses personal data": "ai_uses_personal_data",
"AI help text": "ai_helptext",
"AI is transparent": "ai_is_transparent",
"AI is transparent help text": "ai_is_transparent_helptext",
"AI is untrustworthy": "ai_is_untrustworthy",
"AI is untrustworthy help text": "ai_is_untrustworthy_helptext",
"AI is untrustworthy ding": "ai_is_untrustworthy_ding",
"AI What can it do": "ai_what_can_it_do",
"AI can user control": "ai_can_user_control",
"AI can user control help text": "ai_can_user_control_helptext",
}
# Return the merged fields
return {**generic_product_import_fields, **general_product_mappings}
Expand Down Expand Up @@ -1188,11 +1205,15 @@ def get_export_fields(self):
"Offline use": self.offline_use_description,
"Uses AI": self.uses_ai,
"AI uses personal data": self.ai_uses_personal_data,
"AI is transparent": self.ai_uses_personal_data,
"AI is transparent": self.ai_is_transparent,
"AI is transparent help text": self.ai_is_transparent_helptext,
"AI help text": self.ai_helptext,
"AI is untrustworthy": self.ai_is_untrustworthy,
"AI is untrustworthy help text": self.ai_is_untrustworthy_helptext,
"AI is untrustworthy ding": self.ai_is_untrustworthy_ding,
"AI What can it do": self.ai_what_can_it_do,
"AI can user control": self.ai_can_user_control,
"AI can user control help text": self.ai_can_user_control_helptext,
}
# Merge the two dicts together.
data = {**generic_product_data, **general_product_data}
Expand Down Expand Up @@ -1274,12 +1295,17 @@ def get_export_fields(self):
MultiFieldPanel(
[
FieldPanel('uses_ai'),
FieldPanel('ai_uses_personal_data'),
FieldPanel('ai_is_transparent'),
FieldPanel('ai_helptext'),
FieldPanel('ai_is_untrustworthy'),
FieldPanel('ai_is_untrustworthy_helptext'),
FieldPanel('ai_is_untrustworthy_ding'),
FieldPanel('ai_what_can_it_do'),
FieldPanel('ai_is_transparent'),
FieldPanel('ai_is_transparent_helptext'),
FieldPanel('ai_can_user_control'),
FieldPanel('ai_can_user_control_helptext'),
FieldPanel('ai_uses_personal_data'),

],
heading='Artificial Intelligence',
classname='collapsible'
Expand All @@ -1301,10 +1327,14 @@ def get_export_fields(self):
SynchronizedField('uses_ai'),
SynchronizedField('ai_uses_personal_data'),
SynchronizedField('ai_is_transparent'),
TranslatableField('ai_is_transparent_helptext'),
TranslatableField('ai_helptext'),
SynchronizedField('ai_is_untrustworthy'),
TranslatableField('ai_is_untrustworthy_helptext'),
SynchronizedField('ai_is_untrustworthy_ding'),
TranslatableField('ai_what_can_it_do'),
SynchronizedField('ai_can_user_control'),
TranslatableField('ai_can_user_control_helptext'),
]

@property
Expand Down