GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

migrate_plus.migration.doctor.yml 2.25 KB
Newer Older
Mike Ryan's avatar
Mike Ryan committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
id: doctor
migration_group: acme
label: 'Doctor nodes'
source:
  plugin: url
  # We want to reimport any doctors whose source data has changed.
  track_changes: true
  # Counting the available records requires fetching the whole feed - cache the
  # counts to minimize overhead.
  cache_counts: true
  data_fetcher_plugin: http
  data_parser_plugin: json
  item_selector: /providers
  # Note that the endpoint and actual credentials are not provided here, but are
  # merged in via the configuration form.
  authentication:
    plugin: oauth2
    grant_type: client_credentials
    token_url: /oauth2/token
  ids:
    id:
      type: integer
  fields:
    -
      name: id
      label: Provider ID
      selector: id
    -
      name: full_name
      label: Full Name
      selector: name/full_name
    -
      name: last_updated
      label: Last updated timestamp
      selector: metadata/last_updated
    -
      name: image_url
      label: Image URL
      selector: image_url
    -
      name: specialties
      label: Specialty data
      selector: specialties
    -
      name: external_id
      label: External ID
      selector: external_id
  constants:
    picture_directory: public://profile_images/
process:
  title: full_name
  status:
    plugin: default_value
    default_value: 1
  uid:
    plugin: default_value
    default_value: 1
  created: last_updated
  changed: last_updated
  field_cactus_id: external_id
  field_doctor_specialty:
    plugin: entity_generate
    source: specialty
  field_doctor_subspecialty:
    plugin: entity_generate
    source: subspecialty
  field_k_id: id
  field_k_url: k_url
  # From https://www.acme.com/profile_images/9629.jpg, generate a
  # destination_basename of 9629.jpg...
  destination_basename:
    plugin: callback
    callable: basename
    source: image_url
  # ...and on to a destination_path of public://profile_images/9629.jpg.
  destination_path:
    plugin: concat
    source:
      - 'constants/picture_directory'
      - '@destination_basename'
  field_picture:
    -
      plugin: skip_on_empty
      method: process
      source: image_url
    -
      plugin: file_copy
      source:
        - image_url
        - '@destination_path'
    -
      plugin: entity_generate
destination:
  plugin: 'entity:node'
  default_bundle: doctor