Prompt Structure

The prompts are structured in a specific way to provide the generative AI tool with the script context, available methods and bindings, and identifies the documentation requirements.

Script Context

This section indicates:

  • Script purpose and functionality
  • Integration points with the Student Financial Planning
  • Compliance requirements
  • The business impact

Available Methods and Bindings

In this section, these elements are indicated:

  • Platform-specific methods
  • Integration points
  • Required validations
  • Business rules

Documentation Requirements

And in this section, these elements are indicated:

  • File-level documentation format
  • Section-level documentation structure
  • Comment standards and expectations
  • Required aspects (conditionals, boundary checks, arithmetic)

Example Output

Here's an example of the output that the generative AI tool produces if you were to copy and paste the prompt for GradeLevelProgression (financial aid calculation script xref).

//file:noinspection UnnecessaryQualifiedReference

@groovy.transform.BaseScript(com.oracle.sfp.scripting.api.sdk.autocomplete.GradeLevelProgressionScript)

package CHANGE_ME // this should be updated to your actual package name


import com.oracle.sfp.scripting.api.*

import com.oracle.sfp.scripting.api.util.*


/**

 * Script Name: gradeLevelProgression

 * Version: 1.0

 * 

 * Primary Purpose and Functionality:

 * - Calculates the student's grade level based on completed credits, program type, and academic year progression.

 * - Ensures compliance with institutional and federal financial aid requirements.

 * 

 * Key Calculations:

 * - Summation of completed credits from prior academic years and current academic year.

 * - Division of total credit units by academic year duration units (AYD).

 * - Grade level determination based on credit thresholds and program type.

 * 

 * Critical Business Rules Enforced:

 * - Credits earned prior to the program start date are appropriately included or excluded.

 * - Certificate and Associate programs have unique grade level limits.

 * - Financial aid regulations and academic progress requirements are enforced.

 * 

 * Boundary Conditions:

 * - Actual start date and academic year start date must be valid.

 * - Completed credit calculations must exclude canceled periods.

 * 

 * Financial Aid Implications:

 * - Grade level directly impacts loan eligibility and Pell grant disbursement limits.

 * 

 * Required Inputs:

 * - Program type, total completed units, academic year units, and start dates.

 * 

 * Expected Outputs:

 * - An integer representing the grade level.

 * 

 * Error Handling:

 * - Logs debug information for each calculation step.

 * - Ensures invalid or null data is handled gracefully.

 * 

 * Integration Points:

 * - Relies on methods from acy, acys, program, and term bindings.

 * 

 * Compliance Considerations:

 * - Ensures compliance with federal aid requirements and academic progress policies.

 */


// CONDITIONALS:

// Check 1: Reference Date Determination

// Variables: program.isTerm(), term.getStartDate(), acy.getStartDate()

// Purpose: Determine the reference date based on whether the program is term-based.

// Logic:

//   - If the program is term-based, use the term start date.

//   - Otherwise, use the academic year start date.

// Success Path: Assigns the correct reference date for calculations.

// Failure Path: N/A

// Business Rules: Reference date is critical for filtering credits in current academic year.

// Error Handling: N/A

// Financial Impact: Ensures credits are correctly included in financial aid eligibility.

def referenceDate = program.isTerm() ? term.getStartDate() : acy.getStartDate();


// ARITHMETIC:

// Operation 1: Total Completed Units from Previous Academic Years

// Formula: sum(acys.findAll { it.getNumber() < acyNo }.collect { it.getStatus() == "ACTUAL" ? it.getCompletedUnits() : it.getUnits() })

// Variables:

//   - acys: List of academic years.

//   - acyNo: Current academic year number.

// Steps:

//   1. Filter academic years with a number less than the current year.

//   2. Sum completed units for "ACTUAL" status or total units otherwise.

// Business Context: Ensures all prior academic year credits are counted.

// Result: Total units from previous academic years.

// Financial Impact: Impacts progression and loan eligibility.

def totalPrevAcyUnits = acys

        .findAll { it.getNumber() < acyNo }

        .collect { it.getStatus() == "ACTUAL" ? it.getCompletedUnits() : it.getUnits() }

        .sum(0.0);


// CONDITIONALS:

// Check 2: Valid Loan Payment Periods

// Variables: acy.getLoanPaymentPeriods(), referenceDate

// Purpose: Include only valid loan payment periods in the current academic year.

// Logic:

//   - Exclude canceled payment periods.

//   - Include periods with a start date before the reference date.

// Success Path: Filters and includes valid loan payment periods.

// Failure Path: Excludes invalid periods.

// Business Rules: Only valid payment periods affect financial aid calculations.

// Error Handling: Skips invalid periods and logs any issues.

// Financial Impact: Impacts total credits counted for grade level calculation.

def totalCurAcyUnits = acy.getLoanPaymentPeriods()

        .findAll { it.getStatus() != "CANCELED" && it.getStartDate() < referenceDate }

        .collect { it.getUnits() }

        .sum(0.0);


// ARITHMETIC:

// Operation 2: Total Credits Completed Before Program Start Date

// Formula: sum(program.getCourses().findAll { conditions }.collect { it.getUnits() })

// Variables:

//   - program.getCourses(): List of courses.

//   - actualStartDate: The program's actual start date.

// Steps:

//   1. Filter courses that are passed and completed before the program start date.

//   2. Sum their credit units.

// Business Context: Ensures pre-program credits are correctly included.

// Result: Total credits earned before program start date.

// Financial Impact: Ensures accurate grade level determination.

def totalCreditsCompletedBeforeProgramStartDate = program.getCourses()

        .findAll {

                it.getSchedulingStatus() == "PASSED" &&

                        it.getEndDate() < actualStartDate &&

                        (it.getIncompleteResolutionDate() == null || it.getIncompleteResolutionDate() < actualStartDate)

        }

        .collect { it.getUnits() }

        .sum(0.0);


// ARITHMETIC:

// Operation 3: Total Credit Units

// Formula: sum(transfer units, assessed units, previous academic year units, current academic year units, pre-program units)

// Variables:

//   - program.getTotalAcceptedTransferUnits()

//   - program.getAssessedUnits()

//   - totalPrevAcyUnits

//   - totalCurAcyUnits

//   - totalCreditsCompletedBeforeProgramStartDate

// Steps:

//   1. Add all sources of credit units.

//   2. Store the result in totalCreditUnits.

// Business Context: Provides the total units for grade level calculation.

// Result: Total completed credit units.

// Financial Impact: Determines eligibility for grade level progression.

def totalCreditUnits = (program.getTotalAcceptedTransferUnits() +

        program.getAssessedUnits() +

        totalPrevAcyUnits +

        totalCurAcyUnits +

        totalCreditsCompletedBeforeProgramStartDate);


// ARITHMETIC:

// Operation 4: Credits Per Academic Year Duration (AYD) Unit

// Formula: totalCreditUnits / program.getAydUnits()

// Variables:

//   - totalCreditUnits

//   - program.getAydUnits(): Units representing academic year duration.

// Steps:

//   1. Divide total credits by AYD units.

// Business Context: Normalizes credits to academic year duration for progression.

// Result: Credits per AYD unit.

// Financial Impact: Impacts grade level calculation for financial aid.

def creditPerAydUnit = totalCreditUnits / program.getAydUnits();


// CONDITIONALS:

// Check 3: Base Grade Level Determination

// Variables: program.isGraduate(), program.getProgramType()

// Purpose: Determine the base grade level based on program type.

// Logic:

//   - Graduate programs start at grade level 6.

//   - Post-baccalaureate certificate programs start at grade level 5.

//   - Other programs start at grade level 1.

// Success Path: Assigns the correct base grade level.

// Failure Path: N/A

// Business Rules: Program type dictates initial grade level.

// Error Handling: N/A

// Financial Impact: Ensures accurate starting point for progression.

def baseGradeLevel = (program.isGraduate()

        ? 6

        : program.getProgramType() == "CERTIFICATE_POST_BACCALAUREATE"

        ? 5

        : 1);


// ARITHMETIC:

// Operation 5: Unbounded Grade Level

// Formula: baseGradeLevel + creditPerAydUnit.intValue()

// Variables:

//   - baseGradeLevel

//   - creditPerAydUnit

// Steps:

//   1. Add the integer value of credits per AYD unit to the base grade level.

// Business Context: Calculates progression without upper limits.

// Result: Unbounded grade level.

// Financial Impact: Determines progression threshold.

def unboundedGradeLevel = baseGradeLevel + creditPerAydUnit.intValue();


// CONDITIONALS:

// Check 4: Program Type and Upper Bound Grade Level

// Variables: program.getProgramType(), program.isUndergraduate()

// Purpose: Determine the maximum grade level based on program type.

// Logic:

//   - Associate programs have a maximum grade level of 2.

//   - Undergraduate programs have a maximum grade level of 5.

//   - Graduate programs have a maximum grade level of 7.

// Success Path: Assigns the correct upper bound grade level.

// Failure Path: N/A

// Business Rules: Grade level limits depend on program type.

// Error Handling: N/A

// Financial Impact: Ensures compliance with financial aid policies.

def isAssociate = program.getProgramType() == "ASSOCIATE";

def gradeLevelUb = (isAssociate

        ? 2

        : program.isUndergraduate()

        ? 5

        : 7);


// CONDITIONALS:

// Check 5: Final Grade Level Calculation

// Variables: unboundedGradeLevel, gradeLevelUb

// Purpose: Determine the final grade level based on upper bounds.

// Logic:

//   - Take the minimum of the unbounded grade level and the upper bound.

// Success Path: Assigns the final grade level.

// Failure Path: N/A

// Business Rules: Grade level must not exceed program-specific limits.

// Error Handling: N/A

// Financial Impact: Ensures accurate financial aid reporting.

def gradeLevel = [unboundedGradeLevel, gradeLevelUb].min();


// Logging all calculated variables for traceability

log.debug("actualStartDate={}, referenceDate={}, totalPrevAcyUnits={}, totalCurAcyUnits={}, totalCreditsCompletedBeforeProgramStart