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

#4040 Map Enterprise Attributes during Trellis Events import #4053

Open
wants to merge 16 commits into
base: issue/4039-add-enterprise-attributes-to-events
Choose a base branch
from

Conversation

trackleft
Copy link
Member

@trackleft trackleft commented Feb 8, 2025

Description

This pull request adds updates existing configuration to account for config drift and a new migrate process plugin to process enterprise attributes called AZEnterpriseAttributesArrayFlatten.php

This plugin takes API data in the form of

  "az_enterprise_attributes" => array:1 [
    0 => array:3 [
      "Audiences" => array:1 [
        0 => "Community Member"
      ]
      "Topic" => array:1 [
        0 => "Science & Research"
      ]
      "Category" => array:1 [
        0 => "Lectures, Workshops & Panels"
      ]
    ]
  ]

And transforms it to

  "pseudo_az_enterprise_attributes" => array:1 [
    0 => array:7 [

        0 => "Audiences"
        1 => "Topic"
        2 => "Category"
        3 => "Community Member"
        4 => "Science & Research"
        5 => "Lectures"
        6 => "Workshops & Panels"
  ]
]

This then needs to be flattened again, in order to be used.

  "pseudo_az_enterprise_attributes" => array:7 [
    0 => "Audiences"
    1 => "Topic"
    2 => "Category"
    3 => "Community Member"
    4 => "Science & Research"
    5 => "Lectures"
    6 => "Workshops & Panels"
  ]

In the migration for field_az_enterprise_attributes on events, we use entity_lookup (not entity_generate) to find existing enterprise attributes and map them up. These can be entered manually, or imported using the import module. (Note: this is not a migration lookup)

  field_az_enterprise_attributes:
    -
      plugin: entity_lookup
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: az_enterprise_attributes
      value_key: name
      ignore_case: true
      source: '@pseudo_az_enterprise_attributes'

Release notes

For automated enterprise attribute management in events, enable and configure
- Quickstart Enterprise Attributes Import
- Quickstart Event - Trellis Event Importer
- Quickstart Http

Related issues

Close #4040

How to test

Enable:

  • Quickstart Enterprise Attributes Import
  • Quickstart Event - Trellis Event Importer
  • Quickstart Http

Go to /admin/structure/taxonomy/manage/az_enterprise_attributes/overview to ensure enterprise attributes have been enabled.

Go to /admin/trellis-event-importer and import some events.

Now you can check that the imported events have the appropriate enterprise attributes.

Types of changes

Arizona Quickstart (install profile, custom modules, custom theme)

  • Patch release changes
    • Bug fix
    • Accessibility, performance, or security improvement
    • Critical institutional link or brand change
    • Adding experimental module
    • Update experimental module
  • Minor release changes
    • New feature
    • Breaking or visual change to existing behavior
    • Upgrade experimental module to stable
    • Enable existing module by default or database update
    • Non-critical brand change
    • New internal API or API improvement with backwards compatibility
    • Risky or disruptive cleanup to comply with coding standards
    • High-risk or disruptive change (requires upgrade path, risks regression, etc.)
  • Other or unknown
    • Other or unknown

Drupal core

  • Patch release changes
    • Security update
    • Patch level release (non-security bug-fix release)
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major or minor level update
  • Other or unknown
    • Other or unknown

Drupal contrib projects

  • Patch release changes
    • Security update
    • Patch or minor level update
    • Add new module
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major level update
  • Other or unknown
    • Other or unknown

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My change requires release notes.

@trackleft trackleft changed the base branch from main to issue/4039-add-enterprise-attributes-to-events February 8, 2025 05:09
@trackleft
Copy link
Member Author

Here's a up to date copy of the output from migrate_devel

1^ "---------------------------------------------------------------------"
2^ "|                             $Source                               |"
3^ "---------------------------------------------------------------------"
4^ array:14 [
  "id" => "a3U6R000003C2r2UAC"
  "name" => "WSIP Workshop: 'AI and Academic Writing'"
  "url" => "https://events.trellis.arizona.edu/f44lNu67/5a3U6R3C2r2"
  "summary" => "We'll address the growing popularity of Artificial Intelligence tools available among academic writers and some common benefits and dangers with their use."
  "timezone" => "America/Phoenix"
  "start_date_time" => "2025-02-10T19:00:00.000Z"
  "end_date_time" => "2025-02-10T19:50:00.000Z"
  "publish" => true
  "az_enterprise_attributes" => array:1 [
    0 => array:3 [
      "Audiences" => array:1 [
        0 => "Staff, Community Member, Undergraduate Student, Graduate Student, Research & Teaching Faculty/Postdoc"
      ]
      "Topic" => array:1 [
        0 => "Student Success"
      ]
      "Category" => array:1 [
        0 => "Lectures, Workshops & Panels"
      ]
    ]
  ]
  "plugin" => "az_trellis_events_api"
  "trellis_ids" => []
  "track_changes" => true
  "fields" => array:10 [
    0 => array:3 [
      "name" => "id"
      "label" => "ID"
      "selector" => "Id"
    ]
    1 => array:3 [
      "name" => "name"
      "label" => "Name"
      "selector" => "Name"
    ]
    2 => array:3 [
      "name" => "url"
      "label" => "URL"
      "selector" => "Branded_Event_URL"
    ]
    3 => array:3 [
      "name" => "summary"
      "label" => "Summary"
      "selector" => "Summary"
    ]
    4 => array:3 [
      "name" => "owner"
      "label" => "Owner NetID"
      "selector" => "Owner_NetID"
    ]
    5 => array:3 [
      "name" => "timezone"
      "label" => "Time Zone"
      "selector" => "tz_name"
    ]
    6 => array:3 [
      "name" => "start_date_time"
      "label" => "Start Date and Time"
      "selector" => "Start_DateTime"
    ]
    7 => array:3 [
      "name" => "end_date_time"
      "label" => "End Date and Time"
      "selector" => "End_DateTime"
    ]
    8 => array:3 [
      "name" => "publish"
      "label" => "Publish"
      "selector" => "Publish_Formula"
    ]
    9 => array:3 [
      "name" => "az_enterprise_attributes"
      "label" => "Enterprise Attributes"
      "selector" => "Attributes"
    ]
  ]
  "ids" => array:1 [
    "id" => array:1 [
      "type" => "string"
    ]
  ]
]
5^ "---------------------------------------------------------------------"
6^ "|                           $Destination                            |"
7^ "---------------------------------------------------------------------"
8^ array:8 [
  "pseudo_az_enterprise_attributes" => array:11 [
    0 => "Audiences"
    1 => "Topic"
    2 => "Category"
    3 => "Staff"
    4 => "Community Member"
    5 => "Undergraduate Student"
    6 => "Graduate Student"
    7 => "Research & Teaching Faculty/Postdoc"
    8 => "Student Success"
    9 => "Lectures"
    10 => "Workshops & Panels"
  ]
  "field_az_enterprise_attributes" => array:9 [
    0 => "72"
    1 => "2"
    2 => "42"
    3 => "71"
    4 => "70"
    5 => "65"
    6 => "61"
    7 => "4"
    8 => "5"
  ]
  "title" => "WSIP Workshop: 'AI and Academic Writing'"
  "field_az_trellis_id" => "a3U6R000003C2r2UAC"
  "field_az_link" => array:2 [
    "uri" => "https://events.trellis.arizona.edu/f44lNu67/5a3U6R3C2r2"
    "title" => "Event details"
  ]
  "field_az_summary" => "We'll address the growing popularity of Artificial Intelligence tools available among academic writers and some common benefits and dangers with their use."
  "status" => true
  "field_az_event_date" => array:2 [
    "value" => "1739214000"
    "end_value" => "1739217000"
  ]
]
9^ "---------------------------------------------------------------------"
10^ "|                       $DestinationIdValues                        |"
11^ "---------------------------------------------------------------------"
12^ array:1 [
  0 => "516"
]
1^ "---------------------------------------------------------------------"
2^ "|                             $Source                               |"
3^ "---------------------------------------------------------------------"
4^ array:14 [
  "id" => "a3U6R000003C2rWUAS"
  "name" => "Drop-in Crafting: Make Your Own Victorian Valentine"
  "url" => "https://events.trellis.arizona.edu/f44lNu67/5a3U6R3C2rW"
  "summary" => "Make a card or two at CATalyst Studios."
  "timezone" => "America/Phoenix"
  "start_date_time" => "2025-02-13T22:30:00.000Z"
  "end_date_time" => "2025-02-14T00:00:00.000Z"
  "publish" => true
  "az_enterprise_attributes" => array:1 [
    0 => array:3 [
      "Audiences" => array:1 [
        0 => "Staff, Community Member, Undergraduate Student, Graduate Student, Research & Teaching Faculty/Postdoc, Designated Campus Colleague (DCC)"
      ]
      "Topic" => array:1 [
        0 => "Arts & Culture"
      ]
      "Category" => array:1 [
        0 => "Lectures, Workshops & Panels"
      ]
    ]
  ]
  "plugin" => "az_trellis_events_api"
  "trellis_ids" => []
  "track_changes" => true
  "fields" => array:10 [
    0 => array:3 [
      "name" => "id"
      "label" => "ID"
      "selector" => "Id"
    ]
    1 => array:3 [
      "name" => "name"
      "label" => "Name"
      "selector" => "Name"
    ]
    2 => array:3 [
      "name" => "url"
      "label" => "URL"
      "selector" => "Branded_Event_URL"
    ]
    3 => array:3 [
      "name" => "summary"
      "label" => "Summary"
      "selector" => "Summary"
    ]
    4 => array:3 [
      "name" => "owner"
      "label" => "Owner NetID"
      "selector" => "Owner_NetID"
    ]
    5 => array:3 [
      "name" => "timezone"
      "label" => "Time Zone"
      "selector" => "tz_name"
    ]
    6 => array:3 [
      "name" => "start_date_time"
      "label" => "Start Date and Time"
      "selector" => "Start_DateTime"
    ]
    7 => array:3 [
      "name" => "end_date_time"
      "label" => "End Date and Time"
      "selector" => "End_DateTime"
    ]
    8 => array:3 [
      "name" => "publish"
      "label" => "Publish"
      "selector" => "Publish_Formula"
    ]
    9 => array:3 [
      "name" => "az_enterprise_attributes"
      "label" => "Enterprise Attributes"
      "selector" => "Attributes"
    ]
  ]
  "ids" => array:1 [
    "id" => array:1 [
      "type" => "string"
    ]
  ]
]
5^ "---------------------------------------------------------------------"
6^ "|                           $Destination                            |"
7^ "---------------------------------------------------------------------"
8^ array:8 [
  "pseudo_az_enterprise_attributes" => array:12 [
    0 => "Audiences"
    1 => "Topic"
    2 => "Category"
    3 => "Staff"
    4 => "Community Member"
    5 => "Undergraduate Student"
    6 => "Graduate Student"
    7 => "Research & Teaching Faculty/Postdoc"
    8 => "Designated Campus Colleague (DCC)"
    9 => "Arts & Culture"
    10 => "Lectures"
    11 => "Workshops & Panels"
  ]
  "field_az_enterprise_attributes" => array:10 [
    0 => "72"
    1 => "2"
    2 => "71"
    3 => "70"
    4 => "65"
    5 => "62"
    6 => "61"
    7 => "4"
    8 => "5"
    9 => "31"
  ]
  "title" => "Drop-in Crafting: Make Your Own Victorian Valentine"
  "field_az_trellis_id" => "a3U6R000003C2rWUAS"
  "field_az_link" => array:2 [
    "uri" => "https://events.trellis.arizona.edu/f44lNu67/5a3U6R3C2rW"
    "title" => "Event details"
  ]
  "field_az_summary" => "Make a card or two at CATalyst Studios."
  "status" => true
  "field_az_event_date" => array:2 [
    "value" => "1739485800"
    "end_value" => "1739491200"
  ]
]
9^ "---------------------------------------------------------------------"
10^ "|                       $DestinationIdValues                        |"
11^ "---------------------------------------------------------------------"
12^ array:1 [
  0 => "517"
]
1^ "---------------------------------------------------------------------"
2^ "|                             $Source                               |"
3^ "---------------------------------------------------------------------"
4^ array:14 [
  "id" => "a3U6R000003C2sFUAS"
  "name" => "Doctoral Oral Examination – Second Language Acquisition and Teaching"
  "url" => "https://events.trellis.arizona.edu/f44lNu67/5a3U6R3C2sF"
  "summary" => """
    Hanyu Jia\n
    "Exploring the Affordances of Immersive Virtual Reality for Chinese L2 Pragmatics Learning"
    """
  "timezone" => "America/Phoenix"
  "start_date_time" => "2025-02-26T17:00:00.000Z"
  "end_date_time" => "2025-02-26T20:00:00.000Z"
  "publish" => true
  "az_enterprise_attributes" => array:1 [
    0 => array:3 [
      "Audiences" => array:1 [
        0 => "Graduate Student, Research & Teaching Faculty/Postdoc"
      ]
      "Topic" => array:1 [
        0 => "Social Sciences & Education"
      ]
      "Category" => array:1 [
        0 => "Thesis/Doctoral Performances & Defenses"
      ]
    ]
  ]
  "plugin" => "az_trellis_events_api"
  "trellis_ids" => []
  "track_changes" => true
  "fields" => array:10 [
    0 => array:3 [
      "name" => "id"
      "label" => "ID"
      "selector" => "Id"
    ]
    1 => array:3 [
      "name" => "name"
      "label" => "Name"
      "selector" => "Name"
    ]
    2 => array:3 [
      "name" => "url"
      "label" => "URL"
      "selector" => "Branded_Event_URL"
    ]
    3 => array:3 [
      "name" => "summary"
      "label" => "Summary"
      "selector" => "Summary"
    ]
    4 => array:3 [
      "name" => "owner"
      "label" => "Owner NetID"
      "selector" => "Owner_NetID"
    ]
    5 => array:3 [
      "name" => "timezone"
      "label" => "Time Zone"
      "selector" => "tz_name"
    ]
    6 => array:3 [
      "name" => "start_date_time"
      "label" => "Start Date and Time"
      "selector" => "Start_DateTime"
    ]
    7 => array:3 [
      "name" => "end_date_time"
      "label" => "End Date and Time"
      "selector" => "End_DateTime"
    ]
    8 => array:3 [
      "name" => "publish"
      "label" => "Publish"
      "selector" => "Publish_Formula"
    ]
    9 => array:3 [
      "name" => "az_enterprise_attributes"
      "label" => "Enterprise Attributes"
      "selector" => "Attributes"
    ]
  ]
  "ids" => array:1 [
    "id" => array:1 [
      "type" => "string"
    ]
  ]
]
5^ "---------------------------------------------------------------------"
6^ "|                           $Destination                            |"
7^ "---------------------------------------------------------------------"
8^ array:8 [
  "pseudo_az_enterprise_attributes" => array:7 [
    0 => "Audiences"
    1 => "Topic"
    2 => "Category"
    3 => "Graduate Student"
    4 => "Research & Teaching Faculty/Postdoc"
    5 => "Social Sciences & Education"
    6 => "Thesis/Doctoral Performances & Defenses"
  ]
  "field_az_enterprise_attributes" => array:7 [
    0 => "2"
    1 => "58"
    2 => "41"
    3 => "70"
    4 => "65"
    5 => "4"
    6 => "5"
  ]
  "title" => "Doctoral Oral Examination – Second Language Acquisition and Teaching"
  "field_az_trellis_id" => "a3U6R000003C2sFUAS"
  "field_az_link" => array:2 [
    "uri" => "https://events.trellis.arizona.edu/f44lNu67/5a3U6R3C2sF"
    "title" => "Event details"
  ]
  "field_az_summary" => """
    Hanyu Jia\n
    "Exploring the Affordances of Immersive Virtual Reality for Chinese L2 Pragmatics Learning"
    """
  "status" => true
  "field_az_event_date" => array:2 [
    "value" => "1740589200"
    "end_value" => "1740600000"
  ]
]
9^ "---------------------------------------------------------------------"
10^ "|                       $DestinationIdValues                        |"
11^ "---------------------------------------------------------------------"
12^ array:1 [
  0 => "518"
]
 [notice] Processed 518 items (0 created, 518 updated, 0 failed, 0 ignored) - done with 'az_trellis_events'

@trackleft trackleft changed the title #4039 Add Enterprise Attributes to az_events #4040 Map Enterprise Attributes during Trellis Events import Feb 10, 2025
@trackleft trackleft added release notes documentation Improvements or additions to documentation labels Feb 10, 2025
@trackleft trackleft marked this pull request as ready for review February 10, 2025 19:01
@trackleft trackleft requested a review from a team as a code owner February 10, 2025 19:01
@trackleft trackleft linked an issue Feb 10, 2025 that may be closed by this pull request
@tadean
Copy link
Contributor

tadean commented Feb 12, 2025

One oddity I notice about the Event search API is that the Format attribute is available, but it is as a top level field and not in the attributes array:

"Format" : "In-Person",

…sue/4040-map-enterprise-attributes-during-trellis-event-import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map Enterprise Attributes during Trellis Events import
2 participants