Help
Importing the NSMI into a site can be done in a variety of ways. Below are some tips for the formats offered on the site: CSV, XML, and Drupal. For additional help, please visit LSNTAP.
Drupal Imports
The Drupal export is setup to use the Feeds module to assist in importing the items into a Taxonomy. You can import the full or partial NSMI through the following method:
- Step 1: Create a new Taxonomy Vocabulary for the NSMI
- Step 2 (Optional): In the new Taxonomy, create a new Text Field for the NSMI Problem Code
- Step 3: Download and enable the Feeds module
- Step 4: Import the Feeds Importer with the import code below
- Step 5: In the new importer, change the Taxonomy term processor settings to target the new NSMI Taxonomy vocabulary you created in Step 1
- Step 6 (Optional): If importing the NSMI Problem Codes, setup the mapping in the importer. The source will be "nsmi_code"
- Step 7: Navigate to the Feeds Import page and use the Drupal CSV file to begin the import process
Feeds version: 7.x-2.0-alpha8 currently has an issue with importing a new Importer. Please use the latest Dev release.
View Feeds importer code
$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'nsmi_csv';
$feeds_importer->config = array(
'name' => 'NSMI CSV',
'description' => '',
'fetcher' => array(
'plugin_key' => 'FeedsFileFetcher',
'config' => array(
'allowed_extensions' => 'txt csv tsv xml opml',
'direct' => FALSE,
'directory' => 'public://feeds',
'allowed_schemes' => array(
0 => 'public',
),
),
),
'parser' => array(
'plugin_key' => 'FeedsCSVParser',
'config' => array(
'delimiter' => ',',
'no_headers' => 0,
),
),
'processor' => array(
'plugin_key' => 'FeedsTermProcessor',
'config' => array(
'vocabulary' => 0,
'mappings' => array(
0 => array(
'source' => 'name',
'target' => 'name',
'unique' => FALSE,
),
1 => array(
'source' => 'uuid',
'target' => 'guid',
'unique' => 1,
),
2 => array(
'source' => 'parent_uuid',
'target' => 'parentguid',
'unique' => FALSE,
),
),
'update_existing' => '0',
'input_format' => 'plain_text',
'skip_hash_check' => 0,
'bundle' => 'nsmi',
),
),
'content_type' => '',
'update' => 0,
'import_period' => '-1',
'expire_period' => 3600,
'import_on_create' => 1,
'process_in_background' => 0,
);
CSV / XML Imports
The CSV and XML formats can be used to import the NSMI in a variety of applications.
The CSV and XML exports both contain the following data:
- UUID: The unique ID of the entry
- NSMI_CODE: The Problem Code of the entry
- TOP_LEVEL: The top level in the hierarchy
- LEVEL_2: The second level in the hierarchy
- LEVEL_3: The third level in the hierarchy
- LEVEL_4: The fourth level in the hierarchy