SU-HKKU/cardinal_service_profile

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

Summary

Maintainability
Test Coverage
uuid: d3961043-6561-413f-ab82-833655a44fb0
langcode: en
status: false
dependencies: {  }
_core:
  default_config_hash: zO08rG4j8Ebfjjir-Yj3gO1PZ8jZVhQiiO63YIRMmxs
id: stanford_courses
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: {  }
migration_group: stanford_courses
label: 'Course importer'
source:
  track_changes: true
  plugin: url
  data_fetcher_plugin: http
  urls: {  }
  data_parser_plugin: simple_xml
  item_selector: //courses/course
  fields:
    -
      name: title
      label: 'Course Title'
      selector: title
    -
      name: description
      label: Description
      selector: description
    -
      name: year
      label: 'Course Academic Year'
      selector: year
    -
      name: course_id
      label: 'Course ID'
      selector: administrativeInformation/courseId
    -
      name: subject
      label: 'Course Subject'
      selector: subject
    -
      name: code
      label: 'Course Code'
      selector: code
    -
      name: units_min
      label: 'Units Min'
      selector: unitsMin
    -
      name: units_max
      label: 'Units Max'
      selector: unitsMax
    -
      name: tags
      label: 'Course Tags'
      selector: tags
    -
      name: sections
      label: Sections
      selector: sections
  ids:
    course_id:
      type: string
  constants:
    status: 1
    type: stanford_course
    stanford_html: stanford_html
    link: 'http://explorecourses.stanford.edu/search?q='
    one: 1
process:
  status: constants/status
  type: constants/type
  title: title
  body/value: description
  body/format: constants/stanford_html
  su_course_code: code
  su_course_id: course_id
  su_course_subject:
    -
      plugin: entity_generate
      source: subject
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: su_course_subjects
      value_key: name
  su_course_section_units:
    -
      plugin: concat
      source:
        - units_min
        - units_max
      delimiter: '-'
    -
      plugin: explore_courses_units
  su_course_academic_year: year
  link_query:
    -
      plugin: concat
      source:
        - subject
        - code
    -
      plugin: urlencode
  su_course_link:
    -
      plugin: concat
      source:
        - constants/link
        - '@link_query'
  su_course_quarters:
    -
      plugin: explore_courses_quarters
      source: sections
    -
      plugin: entity_generate
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: su_course_quarters
      value_key: name
  su_course_instructors:
    -
      plugin: explore_courses_instructors
      source: sections
  su_course_tags_array:
    -
      plugin: explore_courses_tags
      source: tags
    -
      plugin: explode
      delimiter: ;
  chunked_course_tags_array:
    -
      plugin: callback
      callable: array_chunk
      unpack_source: true
      source:
        - '@su_course_tags_array'
        - constants/one
  su_course_tags:
    -
      plugin: sub_process
      include_source: true
      source: '@chunked_course_tags_array'
      process:
        target_id:
          plugin: entity_generate
          entity_type: taxonomy_term
          bundle_key: vid
          bundle: su_course_tags
          value_key: name
          source: '0'
destination:
  plugin: 'entity:node'
migration_dependencies: {  }