InseeFr / stromae-dsfr

https://inseefr.github.io/stromae-dsfr/
MIT License
0 stars 2 forks source link

Affichage Identifiant Unité Enquêtée sur toutes les pages #81

Open AnneHuSKa opened 2 months ago

AnneHuSKa commented 2 months ago

Affichage de l'identifiant, du type, voire de la raison sociale de l'unité enquêtée Exemple : entreprise, groupe, établissement // 123456789 // Sanzo image

A coordonner avec format échantillon.

Stand-by

ddecrulle commented 2 months ago

Cette issue dépend d'un sujet plus profond, les métadonnées reçues par stromae.

Ce sujet doit être porté par les métiers Concevoir x Collecter.

Une modélisation intéressante pour stromae serait que l'endpoint api/survey-unit/{id}/metadata de l'API Queen Back Office renvoie un objet au format suivant :

type Content = {
  type: 'paragraph' | 'list'
  textItems: string[]
}
type Metadata = {
  context: 'household' | 'business' //ok
  label: string // ok
  logos?: {
    main: {
      label: string
      url: string
    }
    secondaries?: {
      label: string
      url: string
    }[]
  } //ok
  objectives: string //ok
  campaignInfo: { title?: string; contentBlocks: Content[] }[] //Not implemented yet and not planed
  surveyUnitInfo: { title?: string; contentBlocks: Content[] }[] //Not implemented yet and not planed
  surveyUnitIdentifier: string //Not implemented yet and not planed
}
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "Content": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["paragraph", "list"]
        },
        "textItems": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["type", "textItems"]
    },
    "Logos": {
      "type": "object",
      "properties": {
        "main": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": ["label", "url"]
        },
        "secondaries": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": ["label", "url"]
          }
        }
      },
      "required": ["main"]
    }
  },
  "type": "object",
  "properties": {
    "context": {
      "type": "string",
      "enum": ["household", "business"]
    },
    "label": {
      "type": "string"
    },
    "logos": {
      "$ref": "#/definitions/Logos"
    },
    "objectives": {
      "type": "string"
    },
    "campaignInfo": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "contentBlocks": {
            "type": "array",
            "items": {
              "$ref": "#/definitions/Content"
            }
          }
        },
        "required": ["contentBlocks"]
      }
    },
    "surveyUnitInfo": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "contentBlocks": {
            "type": "array",
            "items": {
              "$ref": "#/definitions/Content"
            }
          }
        },
        "required": ["contentBlocks"]
      }
    },
    "surveyUnitIdentifier": {
      "type": "string"
    }
  },
  "required": ["context", "label", "objectives"]
}

Ce schéma décrit la structure des métadonnées que l’API devrait renvoyer et permet de valider les données pour s’assurer qu’elles respectent ce format.