Skip to content

Commit

Permalink
Merge pull request #3317 from responsible-ai-collaborative/staging
Browse files Browse the repository at this point in the history
Deploy to Production
  • Loading branch information
kepae authored Jan 27, 2025
2 parents 21f341d + 6b9b7fd commit 516a900
Show file tree
Hide file tree
Showing 74 changed files with 1,513 additions and 318 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/db-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ jobs:
sudo apt install -y mongodb-database-tools
- name: Generate public backup
# TODO: Unfix the version of boto3 and use the latest version
# - Github issue related: https://github.com/boto/boto3/issues/4400#issuecomment-2605715606
run: |
python3 -m venv venv
source venv/bin/activate
pip install boto3
pip install boto3==1.35.97
./bin/backup.sh
./bin/prune.sh
./bin/list.sh
Expand Down
1 change: 1 addition & 0 deletions site/gatsby-site/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const plugins = [
'classifications',
'reports',
'entities',
'entity_relationships',
],
connectionString: config.mongodb.connectionString,
extraParams: {
Expand Down
8 changes: 8 additions & 0 deletions site/gatsby-site/i18n/locales/en/popovers.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@
"title": "Quiet",
"text": "Quiet reports are those that will not be published in the 'Latest Reports' section of the homepage. Quiet reports are used for reports that are useful for internal data but do not need to be promoted. If you are unsure, leave this field blank."
},
"relatedEntities": {
"title": "Related Entities",
"text": "Other entities that are related to the same incident. For example, if the developer of an incident is this entity but the deployer is another entity, they are marked as related entities."
},
"entityRelationships": {
"title": "Entity Relationships",
"text": "To what other entities this entity has a direct relationship. For example, 'Amazon' and 'Amazon Workers' could be linked entities."
},
"implicated_systems": {
"title": "Implicated Systems",
"text": "The AI systems involved in the incident. If multiple, press “enter” to begin a new item."
Expand Down
5 changes: 4 additions & 1 deletion site/gatsby-site/i18n/locales/es/entities.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
"Editing Entity": "Editando Entidad",
"Back to Entity: {{name}}": "Volver a Entidad: {{name}}",
"Entity updated successfully.": "Entidad actualizada con éxito.",
"Error updating Entity.": "Error al actualizar la Entidad."
"Error updating Entity.": "Error al actualizar la Entidad.",
"Entity Relationships": "Relaciones de Entidad",
"Add or remove relationships to other entities": "Agregar o eliminar relaciones con otras entidades",
"Loading related entities...": "Cargando entidades relacionadas..."
}
8 changes: 8 additions & 0 deletions site/gatsby-site/i18n/locales/es/popovers.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@
"title": "¿Es un informe silencioso?",
"text": "Los informes silenciosos son aquellos que no se publicarán en la sección 'Últimos informes' de la página de inicio. Los informes silenciosos se utilizan para informes que son útiles para datos internos pero que no necesitan promocionarse. Si no está seguro, deje este campo en blanco."
},
"relatedEntities": {
"title": "Entidades relacionadas",
"text": "Otras entidades que están relacionadas con el mismo incidente. Por ejemplo, si el desarrollador de un incidente es esta entidad pero el implementador es otra entidad, se marcan como entidades relacionadas."
},
"entityRelationships": {
"title": "Relaciones de entidades",
"text": "¿Con qué otras entidades tiene esta entidad una relación directa? Por ejemplo, 'Amazon' y 'Trabajadores de Amazon' podrían ser entidades vinculadas."
},
"implicated_systems": {
"title": "Sistemas implicados",
"text": "Los sistemas de IA involucrados en el incidente. Si son múltiples, presione “enter” después del elemento para ingresar uno nuevo."
Expand Down
6 changes: 5 additions & 1 deletion site/gatsby-site/i18n/locales/es/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@
"Alleged implicated AI Systems can't be longer than 200 characters": "Los sistemas implicados no pueden tener más de 200 caracteres",
"*Alleged Implicated AI Systems is required": "Se requieren los sistemas de IA presuntamente implicados",
"Implicated AI systems must have at least 3 characters": "Los sistemas de IA implicados deben tener al menos 3 caracteres",
"Implicated AI systems can't be longer than 200 characters": "Los sistemas de IA implicados no pueden tener más de 200 caracteres"
"Implicated AI systems can't be longer than 200 characters": "Los sistemas de IA implicados no pueden tener más de 200 caracteres",
"Each alleged Developer must have at least 3 characters and less than 200": "Cada desarrollador presunto debe tener al menos 3 caracteres y menos de 200",
"Each alleged Deployer must have at least 3 characters and less than 200": "Cada implementador presunto debe tener al menos 3 caracteres y menos de 200",
"Each alleged Harmed parties must have at least 3 characters and less than 200": "Cada parte perjudicada presunta debe tener al menos 3 caracteres y menos de 200",
"Each alleged Implicated AI system must have at least 3 characters and less than 200": "Cada sistema de IA implicado presunto debe tener al menos 3 caracteres y menos de 200"
}
5 changes: 5 additions & 0 deletions site/gatsby-site/i18n/locales/fr/entities.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
"Back to Entity: {{name}}": "Retour à l'entité: {{name}}",
"Entity updated successfully.": "Entité mise à jour avec succès.",
"Error updating Entity.": "Erreur lors de la mise à jour de l'entité.",
"Entity Relationships": "Relations d'entité",
"Add or remove relationships to other entities": "Ajouter ou supprimer des relations avec d'autres entités",
"Loading related entities...": "Chargement des entités associées...",
"The AI implicated system is": "Le système d'IA impliqué est",
"The AI implicated systems are": "Les systèmes d'IA impliqués sont",
"Alleged implicated AI system:": "Systèmes d'IA présumés impliqués:",
"Alleged implicated AI systems:": "Systèmes d'IA présumés impliqués:",
"Incident Responses": "Réponses aux incidents",
Expand Down
8 changes: 8 additions & 0 deletions site/gatsby-site/i18n/locales/fr/popovers.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
"title": "Est-ce un rapport silencieux ?",
"text": "Les rapports silencieux sont ceux qui ne seront pas publiés dans la section « Derniers rapports » de la page d'accueil. Les rapports silencieux sont utilisés pour les rapports utiles pour les données internes mais qui n'ont pas besoin d'être promus. Si vous n'êtes pas sûr, laissez ce champ vide."
},
"relatedEntities": {
"title": "Entités liées",
"text": "Autres entités liées au même incident. Par exemple, si le développeur d'un incident est cette entité mais que le responsable de la mise en œuvre est une autre entité, ils sont marqués comme entités liées."
},
"entityRelationships": {
"title": "Relations d'entité",
"text": "Avec quelles autres entités cette entité entretient-elle une relation directe ? Par exemple, « Amazon » et « Amazon Workers » pourraient être des entités liées."
},
"implicated_systems": {
"title": "Systèmes d'IA impliqués dans l'incident",
"text": "Si plusieurs, appuyez sur « entrée » pour commencer un nouvel élément"
Expand Down
6 changes: 5 additions & 1 deletion site/gatsby-site/i18n/locales/fr/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
"Some data is missing.": "Certaines données manquent.",
"Please review. Some data is missing.": "Veuillez vérifier. Certaines données manquent.",
"Implicated Systems must have at least 3 characters": "Les systèmes impliqués doivent comporter au moins 3 caractères",
"Implicated Systems can't be longer than 200 characters": "Les systèmes impliqués ne peuvent pas comporter plus de 200 caractères"
"Implicated Systems can't be longer than 200 characters": "Les systèmes impliqués ne peuvent pas comporter plus de 200 caractères",
"Each alleged Developer must have at least 3 characters and less than 200": "Chaque développeur présumé doit comporter au moins 3 caractères et moins de 200",
"Each alleged Deployer must have at least 3 characters and less than 200": "Chaque implémenteur présumé doit comporter au moins 3 caractères et moins de 200",
"Each alleged Harmed parties must have at least 3 characters and less than 200": "Chaque partie lésée présumée doit comporter au moins 3 caractères et moins de 200",
"Each alleged Implicated AI system must have at least 3 characters and less than 200": "Chaque système d'IA impliqué présumé doit comporter au moins 3 caractères et moins de 200"
}
7 changes: 7 additions & 0 deletions site/gatsby-site/i18n/locales/ja/entities.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
"Back to Entity: {{name}}": "組織に戻る: {{name}}",
"Entity updated successfully.": "組織が正常に更新されました。",
"Error updating Entity.": "組織の更新中にエラーが発生しました。",
"Entity Relationships": "組織関係",
"Add or remove relationships to other entities": "他の組織との関係を追加または削除",
"Loading related entities...": "関連する組繹を読み込み中...",
"The AI implicated system is": "関連するAIシステムは です",
"The AI implicated systems are": "関連するAIシステムは です",
"Implicated AI system:": "AI関連システム:",
"Implicated AI systems:": "AI関連システム:",
"Alleged implicated AI system:": "関与が疑われるAIシステム:",
"Alleged implicated AI systems:": "関与が疑われるAIシステム:"
}
8 changes: 8 additions & 0 deletions site/gatsby-site/i18n/locales/ja/popovers.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@
"title": "あなたです!",
"text": "現在ログイン中なのでこの投稿は自動的にあなたのアカウントに関連づけられます。匿名で投稿するには、ブラウザウィンドウを匿名モードで開いて投稿してください。"
},
"relatedEntities": {
"title": "関連団体",
"text": "同じインシデントに関連するその他のエンティティ。たとえば、インシデントの開発者がこのエンティティで、デプロイヤーが別のエンティティである場合、それらは関連エンティティとしてマークされます。"
},
"entityRelationships": {
"title": "エンティティ関係",
"text": "このエンティティが他のどのエンティティと直接関係しているか。たとえば、「Amazon」と「Amazon Workers」はリンクされたエンティティである可能性があります。"
},
"implicated_systems": {
"title": "インシデントに関与したAIシステム",
"text": "複数ある場合は、新しい項目を入力するためにEnterキーを押してください"
Expand Down
6 changes: 5 additions & 1 deletion site/gatsby-site/i18n/locales/ja/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
"*Incident Date required": "*インシデント日は必須です",
"*Incident ID(s) must be a number": "*インシデントIDは数字でなければいけません",
"Implicated Systems must have at least 3 characters": "関連システムは3文字以上でなければいけません",
"Implicated Systems can't be longer than 200 characters": "関連システムは200文字を超えることはできません"
"Implicated Systems can't be longer than 200 characters": "関連システムは200文字を超えることはできません",
"Each alleged Developer must have at least 3 characters and less than 200": "推定される開発者は3文字以上200文字以下でなければいけません",
"Each alleged Deployer must have at least 3 characters and less than 200": "推定されるデプロイヤーは3文字以上200文字以下でなければいけません",
"Each alleged Harmed parties must have at least 3 characters and less than 200": "推定される被害グループは3文字以上200文字以下でなければいけません",
"Each alleged Implicated AI system must have at least 3 characters and less than 200": "推定される関連AIシステムは3文字以上200文字以下でなければいけません"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const config = require('../config');

/**
*
* @param {{context: {client: import('mongodb').MongoClient}}} context
*/

exports.up = async ({ context: { client } }) => {
await client.connect();

await client.db(config.realm.production_db.db_name).createCollection('entity_relationships');
};
/**
*
* @param {{context: {client: import('mongodb').MongoClient}}} context
*/

exports.down = async ({ context: { client } }) => {
await client.connect();

try {
await client.db(config.realm.production_db.db_name).dropCollection('entity_relationships');
} catch (e) {
console.log(e.message);
}
};
21 changes: 20 additions & 1 deletion site/gatsby-site/page-creators/createEntitiesPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { computeEntities } = require('../src/utils/entities');

const createEntitiesPages = async (graphql, createPage) => {
const {
data: { incidents, entities: entitiesData, responses },
data: { incidents, entities: entitiesData, responses, entityRelationships },
} = await graphql(`
{
incidents: allMongodbAiidprodIncidents {
Expand Down Expand Up @@ -32,20 +32,37 @@ const createEntitiesPages = async (graphql, createPage) => {
title
}
}
entityRelationships: allMongodbAiidprodEntityRelationships(
filter: { pred: { eq: "related" } }
) {
nodes {
sub
obj
is_symmetric
pred
}
}
}
`);

const entities = computeEntities({
incidents: incidents.nodes,
entities: entitiesData.nodes,
responses: responses.nodes,
entityRelationships: entityRelationships.nodes,
});

for (const entity of entities) {
const { id } = entity;

const pagePath = `/entities/${id}`;

const currentEntityRelationships =
entityRelationships.nodes.filter(
(rel) => (rel.sub === id || rel.obj === id) && rel.is_symmetric
) || [];

createPage({
path: pagePath,
component: path.resolve('./src/templates/entity.js'),
Expand All @@ -59,6 +76,7 @@ const createEntitiesPages = async (graphql, createPage) => {
incidentsImplicatedSystems: entity.incidentsImplicatedSystems,
relatedEntities: entity.relatedEntities,
responses: entity.responses,
entityRelationships: currentEntityRelationships,
},
});
}
Expand All @@ -68,6 +86,7 @@ const createEntitiesPages = async (graphql, createPage) => {
component: path.resolve('./src/templates/entities.js'),
context: {
entities,
entityRelationships: entityRelationships.nodes,
},
});
};
Expand Down
20 changes: 15 additions & 5 deletions site/gatsby-site/playwright/e2e-full/api/lookupbyurl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,24 @@ test.describe('/api/lookupbyurl endpoint', () => {
title: "Kronos shift scheduling software a grind for Starbucks worker",
url: "https://searchhrsoftware.techtarget.com/news/4500252451/Kronos-shift-scheduling-software-a-grind-for-Starbucks-worker",
},
],
incidents: [
{
incident_id: 3,
title: "Kronos Scheduling Algorithm Allegedly Caused Financial Issues for Starbucks Employees",
url: "https://incidentdatabase.ai/cite/3",
report_number: 9,
title: "Response Issue Report 9",
url: "https://searchhrsoftware.techtarget.com/news/4500252451/Kronos-shift-scheduling-software-a-grind-for-Starbucks-worker",
},
],
incidents: [
{
incident_id: 3,
title: "Kronos Scheduling Algorithm Allegedly Caused Financial Issues for Starbucks Employees",
url: "https://incidentdatabase.ai/cite/3",
},
{
incident_id: 4,
title: "Test title 4",
url: "https://incidentdatabase.ai/cite/4",
},
],
},
{
url: "https://www.nytimes.com/interactive/2014/08/13/us/starbucks-workers-scheduling-hours.html",
Expand Down
4 changes: 2 additions & 2 deletions site/gatsby-site/playwright/e2e-full/apps/incidents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.describe('Incidents App', () => {

test('Should display a list of incidents', async ({ page }) => {
await page.goto(url);
await expect(page.locator('[data-cy="row"]')).toHaveCount(3);
await expect(page.locator('[data-cy="row"]')).toHaveCount(4);
});

test('Should display an empty list of incidents on Empty environment', async ({ page, runOnlyOnEmptyEnvironment }) => {
Expand Down Expand Up @@ -262,7 +262,7 @@ test.describe('Incidents App', () => {
await page.locator('[data-cy="table-view"] button:has-text("Issue Reports")').click();

await page.waitForSelector('[data-cy="row"]');
await expect(page.locator('[data-cy="row"]')).toHaveCount(1);
await expect(page.locator('[data-cy="row"]')).toHaveCount(2);

const firstRowLink = await page.locator('[data-cy="row"] td a').first().getAttribute('href');
expect(firstRowLink).toMatch(/^\/reports\/\d+$/);
Expand Down
Loading

0 comments on commit 516a900

Please sign in to comment.