SU-HKKU/cardinal_service_profile

View on GitHub
config/sync/migrate_plus.migration.su_stanford_person.yml

Summary

Maintainability
Test Coverage
uuid: cd2aa68d-2559-468a-81e4-2a78a180d44b
langcode: en
status: true
dependencies: {  }
id: su_stanford_person
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: {  }
migration_group: su_stanford_person
label: 'Stanford Person Importer'
source:
  plugin: url
  constants:
    status: 1
    type: stanford_person
    basic_html: stanford_html
    minimal_html: stanford_minimal_html
    link_domain: 'https://profiles.stanford.edu'
    link_text: 'View Full Stanford Profile'
    file_destination: 'public://media/person/'
    file_extension: .jpg
  urls: {  }
  item_selector: values
  fields:
    -
      name: sunetid
      label: sunetid
      selector: uid
    -
      name: display_name
      label: 'Display Name'
      selector: displayName
    -
      name: last_name
      label: 'Last Name'
      selector: names/preferred/lastName
    -
      name: first_name
      label: 'First Name'
      selector: names/preferred/firstName
    -
      name: short_title
      label: 'CAP Short Title'
      selector: shortTitle/title
    -
      name: long_title
      label: 'CAP Long Title'
      selector: longTitle/title
    -
      name: bio_html
      label: Biography
      selector: bio/html
    -
      name: email
      label: Email
      selector: primaryContact/email
    -
      name: mailcode
      label: 'Mail Code'
      selector: ldapAdditionalInfo/mailCode
    -
      name: alias
      label: Alias
      selector: alias
    -
      name: profile_photo
      label: 'Profile Photo'
      selector: profilePhotos/bigger/url
    -
      name: appointments
      label: 'Administrative Appointments'
      selector: longTitle/label/text
    -
      name: links
      label: 'Internet Links'
      selector: internetLinks
    -
      name: phone
      label: 'Phone Numbers'
      selector: primaryContact/phoneNumbers
    -
      name: office
      label: 'Office Locations'
      selector: contacts
    -
      name: profile_id
      label: 'Profile ID'
      selector: profileId
    -
      name: education
      label: Education
      selector: education
    -
      name: current_research_interests
      label: 'Research Interests'
      selector: currentResearchInterests/shortText.html
    -
      name: etag
      label: 'CAP API Etag'
      selector: meta/etag
    -
      name: academic_appts
      label: 'Academic Appointments'
      selector: academicOffices/0/position
    -
      name: admin_appts
      label: 'Administrative Appointments'
      selector: administrativeAppointments
    -
      name: research_interest_topics
      label: 'Research Interest Topics'
      selector: researchInterestTopics
    -
      name: scholarly_interests_fulltext
      label: 'Scholarly and Research Interests'
      selector: currentResearchInterests/fullText/html
    -
      name: scholarly_interests_tersetext
      label: 'Scholarly and Research Interests'
      selector: currentResearchInterests/terseText/html
    -
      name: community
      label: community
      selector: community
  ids:
    sunetid:
      type: string
process:
  title: display_name
  revision_timestamp:
    -
      plugin: callback
      callable: _stanford_migrate_get_time
  revision_translation_affected:
    -
      plugin: default_value
      default_value: 1
  status: constants/status
  type: constants/type
  su_person_first_name: first_name
  su_person_last_name: last_name
  su_person_full_title/value: long_title
  su_person_full_title/format: constants/basic_html
  su_person_short_title: short_title
  body/value: bio_html
  body/format: constants/basic_html
  su_person_email: email
  su_person_mobile_phone: phone
  su_person_education:
    -
      plugin: skip_on_empty
      source: education
      method: process
    -
      plugin: sub_process
      process:
        value:
          plugin: substr
          start: 0
          length: 255
          source: label/text
  su_person_profile_link/uri:
    -
      plugin: skip_on_empty
      source: profile_id
      method: process
    -
      plugin: concat
      delimiter: /
      source:
        - constants/link_domain
        - community
        - profile_id
    -
      plugin: str_replace
      search:
        - stanford/
        - hidden/
        - public/
      replace:
        - intranet/
        - intranet/
        - ''
  su_person_profile_link/title: constants/link_text
  image_timestamp:
    -
      plugin: skip_on_empty
      method: process
      source: profile_photo
    -
      plugin: explode
      delimiter: '&'
    -
      plugin: str_replace
      regex: true
      search: '/^(?!ts=).+/'
      replace: ''
    -
      plugin: str_replace
      search: ts=
      replace: ''
    -
      plugin: concat
  image_path:
    plugin: concat
    source:
      - constants/file_destination
      - alias
      - separator
      - '@image_timestamp'
      - constants/file_extension
  image_file:
    -
      plugin: skip_on_empty
      method: process
      source: profile_photo
    -
      plugin: image_dimension_skip
      method: process
      width: 10
      height: 10
    -
      plugin: file_import
      destination: '@image_path'
      id_only: true
      reuse: true
  su_person_photo/target_id:
    -
      plugin: skip_on_empty
      method: process
      source: '@image_file'
    -
      plugin: entity_generate
      source: '@image_file'
      value_key: field_media_image
      bundle_key: bundle
      bundle: image
      entity_type: media
      ignore_case: true
      values:
        name: '@title'
        field_media_image/target_id: '@image_file'
        field_media_image/alt: '@title'
  su_person_links:
    -
      plugin: skip_on_empty
      method: process
      source: links
    -
      plugin: sub_process
      process:
        uri:
          plugin: str_replace
          source: url
          search: '/^(?![a-z][a-z0-9]*:\/\/).*?$/i'
          replace: ''
          regex: true
        title: label/text
  su_person_mail_code: mailcode
  su_person_academic_appt: academic_appts
  su_person_admin_appts:
    -
      source: admin_appts
      plugin: sub_process
      process:
        value: label/text
  su_person_research_interests:
    -
      source: research_interest_topics
      plugin: sub_process
      process:
        value: label/text
  su_person_scholarly_interests/format: constants/minimal_html
  su_person_scholarly_interests/value:
    -
      plugin: null_coalesce
      source:
        - scholarly_interests_fulltext
        - scholarly_interests_tersetext
destination:
  plugin: 'entity:node'
  overwrite_properties:
    - body/format
    - body/value
    - cap_token
    - image_file
    - image_timestamp
    - photo_destination
    - photo_source
    - revision_timestamp
    - revision_translation_affected
    - su_person_academic_appt
    - su_person_admin_appts
    - su_person_education
    - su_person_email
    - su_person_first_name
    - su_person_full_title/format
    - su_person_full_title/value
    - su_person_last_name
    - su_person_links
    - su_person_mail_code
    - su_person_mobile_phone
    - su_person_photo/target_id
    - su_person_profile_link/title
    - su_person_profile_link/uri
    - su_person_research_interests
    - su_person_scholarly_interests/format
    - su_person_scholarly_interests/value
    - su_person_short_title
    - title
    - type
migration_dependencies:
  required: {  }