Test Data for a Plugin

In order to test the script that is the core of the plugin, you need input cBases. This is tricky if those cBases are only created when the factory runs. For each of the inputs you list in the cgf.factory-plugin file, you can create a temporary Spectre Build script in your plugin folder that looks like the following:

build {
  cbase-input "/factory-output/__internal/data-sets/<data-set>.cbase"  {
    // add all the columns you decided you needed from this data-set
    keep "xxx" "xxx"
  }
  output "<input name specified in cfg.factory-plugin>.cbase"
}

Here you are accessing the final data set from the last build of the factory and selecting just the columns you need for the plugin script to work with. These columns are then built into a temporary cBase for testing purposes. There are other ways to achieve the same results, but this temporary Build, within the plugin folder, keeps testing and future edits straightforward and contained.

For example, for this plugin definition:

factory-plugin { 
  name "Charge-Rooms Plugin" 
  description "Plugin to determine departments with bed charges for Accounts"
  input "Bed-Charges" { 
    column "Account ID" type="string"
    column "Facility Code" type="string" 
    column "Charge Department name" type="string"
    column "Charge Quantity" type="double"
    column "Revenue Code" type="string"
    column "Service Date" type="date"
    
  } 
  integrator-script "charge-rooms.int" 
  
  output { 
    dimension "Account ID" 
    dimension "Facility Code" 
    column "Bed Departments" type="string" 
  } 
}

The temporary Spectre Build could look like this:

build {
  cbase-input "/factory-output/_internal/data-sets/charges.cbase" {
    keep "Account ID" "Facility Code" "Charge Department Name" "Charge Quantity" "Revenue Code" "Service  Date"
  }
  output "Bed-Charges.cbase"
}

TIPS:

  • Locate and run the temporary build in the plugins folder. This creates the cBase to test with in this folder as well.

  • Write and test your transformation script, charge-rooms.int in this example, to read the test cBase, perform the necessary data manipulations, and output what the factory-plugin is expecting for dimensions and columns.

  • Always specify the data types when building a cBase. This is required when using a Spectre Build script, but might be overlooked when using an Integrator script.

  • Be sure to open the output from your transformation script using ProDiver to examine the data and verify it is working properly.

  • When the transformation script has been verified as working, edit the script in text mode and remove any pathing specified for the input and output objects—the script needs to do its work within the plugin folder.