Write new Csv, Fixed Width, Xml, or formatted files that comply with other system's formatting and structure requirements. Modeling transforms the namespace in your data recipe and writes it into a new set of files based on your instructions.

Concepts

Run Model - Prefixing an instruction with RunModel (or ‘SetModel’), will execute the instruction once per Model command. The instruction’s name must match a feature the model supports, below is a list of all Model types and features for your reference. Example: “data/Model SimpleCsv/RunModel Header.scala”

Row Model - Prefixing an instruction with a RowModel (or ‘AddModel’), will execute the instruction for each namespace row present when the Model command starts. The instruction’s name must match a feature the model supports. Example: “data/Model SimpleCsv/RowModel Rows.scala”

Values/Headers - Prefixing an instruction with Set, SetValue, or SetHeader, will execute the instruction once per Model command and returns model specific configuration options, like filenames or separator characters, configuration flags. Output of these instructions is typically strings.

Case Classes - Models are built with companion Scala case classes that must be returned from the Row and Run instructions.

Each Model’s implementation is different, but instructions are always expressed as ‘RowModel ${Feature}’ and ‘RunModel ${Feature}’

Specifics

20.4 Model implementations:

SimpleCsv

  • Value Feature: filename, quote, separator

  • Row Features: row, rows, header, footer, filename, filenames

  • Run Features: heaer, footer

  • Case Classes:

    case class SimpleCsv(values : Any*)
    

SimpleFixedWidth

  • Value Features: filename, quote

  • Row Features: row, rows, header, footer, filename, filenames

  • Run Features: header, footer

  • Case Classes: ``` case class SimpleFixedWidth(values : (Int,Any)*)

trait FixedFormat { def value: Any

def alignLeft: Boolean

def padZero: Boolean

def decimals : Int }

case class Left( override val value : Any ) extends FixedFormat { def alignLeft = true; def padZero = false; def decimals = 0}

case class Right( override val value : Any ) extends FixedFormat { def alignLeft = false; def padZero = false; def decimals = 0}

case class ZeroRight( override val value : Any ) extends FixedFormat { def alignLeft = false; def padZero = true; def decimals = 0}

case class RightZero( override val value : Any ) extends FixedFormat { def alignLeft = false; def padZero = true; def decimals = 0}

case class Decimal( override val value : Any, override val decimals: Int ) extends FixedFormat { def alignLeft = false; def padZero = false }

case class DecimalZero( override val value : Any, override val decimals: Int ) extends FixedFormat { def alignLeft = false; def padZero = true }


## PaymaxV8

- Value Features: 

```scala

  def setValue(key: String, value: String) = {

    key.toLowerCase() match {
      case "filename" =>
        filenameO = Some(value)
      case "quote" =>
        quoteO = Some(value.trim)
      case "filetype" =>
        headerFileType = value.trim
      case "safeguardusage" =>
        headerSafeguardUsage = value.trim
      case "autoapprovebenefits" =>
        headerAutoApproveBenefits = value.trim
      case "loginidmethod" =>
        headerLoginIdMethod = value.trim
      case "passwordmethod" =>
        headerPasswordMethod = value.trim
      case "version" =>
        headerVersion = value.trim
      case _ =>
        fmrc.printer.println(s"[Model:PaymaxV8] ${Emoji.warning} Unrecognized SetValue: ${key} = ${value}")
    }
  }

  • Row Features:

  • Row Features:

  • Case Classes:


case class HeaderRow(
  var sponsorOid: String,
  var overrideDate: Option[DateTime] = None
)

case class DemographicRow(
  var demographic: Demographic,
  var address: Address,
  var emergencyContact: EmergencyContact,
  var work: Work,
  var customCategories: Seq[CategoryTrait],
  var customCategoryEffectiveDate: Option[DateTime] = None
)

case class Demographic(
  var ssn: String,
  var lastName: String,
  var firstName: String,
  var middleName: Option[String] = None,
  var suffix: Option[String] = None,
  var dateOfBirth: DateTime,
  var gender: String,
  var maritalStatus: String,
  var ethnicity: Option[String] = None,
  var homePhone: Option[String] = None,
  var cellPhone: Option[String] = None,
  var personalEmail: Option[String] = None
)

case class Address(
  var addressLine1: String,
  var addressLine2: Option[String] = None,
  var city: String,
  var state: String,
  var zip: String,
  var countryCode: String,
  var nameAddressChangeDate: Option[DateTime] = None
)

case class EmergencyContact(
  var name: Option[String] = None,
  var relationship: Option[String] = None,
  var phone: Option[String] = None,
  var alternatePhone: Option[String] = None,
  var addressLine1: Option[String] = None,
  var addressLine2: Option[String] = None,
  var city: Option[String] = None,
  var state: Option[String] = None,
  var zip: Option[String] = None,
  var countryCode: Option[String] = None
)

case class Work(
  var dateOfHire: DateTime,
  var adjustedServiceDate: Option[DateTime] = None,
  var otherDate: Option[DateTime] = None,
  var terminationDate: Option[DateTime] = None,
  var terminationReason: Option[String] = None,
  var retiredIndicator: Option[String] = None,
  var salary: String,
  var earningUnitOfMeasure: String,
  var payFrequency: String,
  var earningAmountEffectiveDate: Option[DateTime] = None,
  var salaryOverrideAmount: Option[String] = None,
  var salaryOverrideEarningUnitofMeasure: Option[String] = None,
  var earningAmountEffectiveDateForTheSalaryOverrideAmount: Option[String] = None,
  var eeoc: Option[String] = None,
  var occupation: Option[String] = None,
  var employeeId: Option[String] = None,
  var workPhone: Option[String] = None,
  var workCellPhone: Option[String] = None,
  var workPager: Option[String] = None,
  var workEmail: Option[String] = None,
  var scheduledWorkHours: Option[String] = None
)

// 2018May30 - Added so that custom Paymax columns can easily be added in by the modeler

trait CategoryTrait {
  def columns: Int
  def categoryType: String
  def categoryValue: String
}


case class CustomCategory (
  var categoryType : String,
  var categoryValue: String
) extends CategoryTrait {
  def columns = 2
}

case class SingleColumnCategory( var categoryValue: String ) extends CategoryTrait {
  def columns = 1
  def categoryType = ""
}

TO DOCUMENT

AdpAca301

TO DOCUMENT