@obe-loms/coms-parser 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DataTable/models/CoaepDT.d.ts +32 -0
- package/DataTable/models/DTValidator.d.ts +32 -0
- package/DataTable/models/DataTable.d.ts +129 -0
- package/DataTable/models/validators/coaep/ILOTaxoOrder.d.ts +20 -0
- package/DataTable/models/validators/coaep/LastILOtaxo.d.ts +20 -0
- package/DataTable/models/validators/coaep/MinCOtaxo.d.ts +19 -0
- package/DataTable/models/validators/coaep/MissingVals.d.ts +1 -0
- package/DataTable/types/DataTableException.d.ts +8 -0
- package/DataTable/types/ParserResult.d.ts +7 -0
- package/bundle.js +29 -33
- package/main.d.ts +2 -31
- package/package.json +1 -1
- package/test/coaep/coaepDataTable.test.d.ts +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { COAEP } from "../../types/coaep";
|
|
2
|
+
import { DataTable, DataTableInfo } from "./DataTable";
|
|
3
|
+
import { ParserResult } from "../types/ParserResult";
|
|
4
|
+
import DataTableException from "../types/DataTableException";
|
|
5
|
+
export declare class CoaepDT extends DataTable<COAEP> {
|
|
6
|
+
faculty: string | null;
|
|
7
|
+
course: string | null;
|
|
8
|
+
sy: string | null;
|
|
9
|
+
semester: number | null;
|
|
10
|
+
/**
|
|
11
|
+
* Initializes the DataTable for COAEP.
|
|
12
|
+
* Also sets up custom validators for the DataTable.
|
|
13
|
+
*/
|
|
14
|
+
constructor();
|
|
15
|
+
validateFields(validMsgs: string[], tableErrors: DataTableException[]): Promise<void>;
|
|
16
|
+
fromCSVString(csvString: string): Promise<ParserResult<DataTableInfo>>;
|
|
17
|
+
toJson(): Promise<ParserResult<{
|
|
18
|
+
jsonObj: COAEP | null;
|
|
19
|
+
validMsgs: string[];
|
|
20
|
+
tableErrors: DataTableException[];
|
|
21
|
+
}>>;
|
|
22
|
+
/**
|
|
23
|
+
* Local helper function that to validate grammar of a CO/ILO statement.
|
|
24
|
+
* Checks if the statement follows grammar to fetch the fields: cognitive level, taxonomy level, verb
|
|
25
|
+
*
|
|
26
|
+
* @param {string} stmt - The objective statement to validate.
|
|
27
|
+
* @param {number} row - The row of the statement in the table.
|
|
28
|
+
* @param {number} column - The column of the statement in the table.
|
|
29
|
+
* @param {DataTableException[]} tableErrors - The array of error messages to append to.
|
|
30
|
+
*/
|
|
31
|
+
validateObjectiveGrammar(stmt: string, row: number, column: number, tableErrors: DataTableException[]): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import DataTableException from "../types/DataTableException";
|
|
2
|
+
export declare abstract class DTValidator<DT, OBJ> {
|
|
3
|
+
protected name: string;
|
|
4
|
+
/**
|
|
5
|
+
* Constructor for the DTValidator class.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} name - The name of the validator.
|
|
8
|
+
*/
|
|
9
|
+
constructor(name: string);
|
|
10
|
+
/**
|
|
11
|
+
* @returns The name of the validator.
|
|
12
|
+
*/
|
|
13
|
+
getName(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Helper function that updates the validMsgs and tableErrors arrays with a given localError array.
|
|
16
|
+
*
|
|
17
|
+
* @param localErrors - Local DataTableException throws of the validate method.
|
|
18
|
+
* @param validMsgs - String array to append successful validation messages to.
|
|
19
|
+
* @param tableErrors - DataTableException array to append error messages to.
|
|
20
|
+
*/
|
|
21
|
+
report(localErrors: DataTableException[], validMsgs: string[], tableErrors: DataTableException[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Method to validate the DataTable and its JSON object conversion.
|
|
24
|
+
*
|
|
25
|
+
* @param validMsgs - An array of strings to append successful validation messages to.
|
|
26
|
+
* @param tableErrors - An array of DataTableException objects to append error messages to.
|
|
27
|
+
* @param dataTable - The DataTable object to validate.
|
|
28
|
+
* @param jsonObj - The associated JSON object to validate.
|
|
29
|
+
* @returns A Promise that resolves when the validation is complete.
|
|
30
|
+
*/
|
|
31
|
+
abstract validate(validMsgs: string[], tableErrors: DataTableException[], dataTable: DT, jsonObj: OBJ): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ParserResult } from "../types/ParserResult";
|
|
2
|
+
import DataTableException from "../types/DataTableException";
|
|
3
|
+
import { DTValidator } from "./DTValidator";
|
|
4
|
+
export type DataTableInfo = {
|
|
5
|
+
name: string;
|
|
6
|
+
table: (string | null)[][];
|
|
7
|
+
headers: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare abstract class DataTable<T> {
|
|
10
|
+
protected name: string;
|
|
11
|
+
protected table: (string | null)[][];
|
|
12
|
+
protected headers: string[];
|
|
13
|
+
protected validators: DTValidator<this, T>[];
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new DataTable, initializes default values.
|
|
16
|
+
* If no name is given, the name defaults to "DataTable".
|
|
17
|
+
*
|
|
18
|
+
* @param {string} _name - The name of the DataTable. Defaults to "DataTable".
|
|
19
|
+
*/
|
|
20
|
+
constructor(_name?: string);
|
|
21
|
+
/**
|
|
22
|
+
* Returns the name of the DataTable.
|
|
23
|
+
* @returns string
|
|
24
|
+
*/
|
|
25
|
+
getName(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the header names of the DataTable.
|
|
28
|
+
* @returns array of strings
|
|
29
|
+
*/
|
|
30
|
+
getHeaders(): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Gets the DataTable from the current object.
|
|
33
|
+
* @returns ParserResult<DataTableInfo>
|
|
34
|
+
*/
|
|
35
|
+
getTable(): ParserResult<DataTableInfo>;
|
|
36
|
+
/**
|
|
37
|
+
* Sets the DataTable from a given table.
|
|
38
|
+
* Asserts first if the DataTable is initialized,
|
|
39
|
+
* then checks if the number of columns matches the number of headers.
|
|
40
|
+
*
|
|
41
|
+
* @param table - Internal table of type (string | null)[][].
|
|
42
|
+
* @returns A Promise that resolves when the table has been set.
|
|
43
|
+
*/
|
|
44
|
+
setTable(table: (string | null)[][]): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Populates the internal table from a given File or CSV string.
|
|
47
|
+
*
|
|
48
|
+
* If the data is a File, it will be parsed using the fromXML method.
|
|
49
|
+
* If the data is a CSV string, it will be parsed using the fromCSVString method.
|
|
50
|
+
*
|
|
51
|
+
* @param {File | string} data - The File or CSV string to initialize the DataTable from.
|
|
52
|
+
* @returns A Promise that resolves to a ParserResult.
|
|
53
|
+
*/
|
|
54
|
+
initializeTable(data: File | string): Promise<ParserResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Asserts that the DataTable has been initialized.
|
|
57
|
+
* If not, it throws a DataTableException.
|
|
58
|
+
*
|
|
59
|
+
* @returns A Promise that resolves with a string message.
|
|
60
|
+
* @throws {DataTableException} If the DataTable has not been initialized.
|
|
61
|
+
*/
|
|
62
|
+
assertInitialized(): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Parses a CSV string into a DataTable.
|
|
65
|
+
*
|
|
66
|
+
* @param csvString - The CSV string to parse.
|
|
67
|
+
* @returns A Promise that resolves to a ParserResult when the parsing is complete.
|
|
68
|
+
*/
|
|
69
|
+
abstract fromCSVString(csvString: string): Promise<ParserResult<DataTableInfo>>;
|
|
70
|
+
/**
|
|
71
|
+
* Converts the DataTable to its JSON representation.
|
|
72
|
+
* The method will run all validators on the DataTable before conversion.
|
|
73
|
+
* If any validator fails, it will append the error message to the tableErrors array.
|
|
74
|
+
* If all validators pass, it will append the successful validation messages to the validMsgs array.
|
|
75
|
+
*
|
|
76
|
+
* @returns A Promise that resolves when the conversion is complete.
|
|
77
|
+
*/
|
|
78
|
+
abstract toJson(): Promise<ParserResult<{
|
|
79
|
+
jsonObj: T | null;
|
|
80
|
+
validMsgs: string[];
|
|
81
|
+
tableErrors: DataTableException[];
|
|
82
|
+
}>>;
|
|
83
|
+
/**
|
|
84
|
+
* Method to set the internal table from an Excel file (.xls).
|
|
85
|
+
* This converts the file to CSVstring and calls the fromCSVString method.
|
|
86
|
+
*
|
|
87
|
+
* @param xls - The Excel file (.xls) to set the DataTable from.
|
|
88
|
+
* @param sheetName - Optional sheetname to set the DataTable from. Defaults to 1st sheet.
|
|
89
|
+
* @returns A Promise that resolves to a ParserResult when the DataTable is set.
|
|
90
|
+
*/
|
|
91
|
+
fromXML(xls: File, sheetName?: string): Promise<ParserResult<DataTableInfo>>;
|
|
92
|
+
/**
|
|
93
|
+
* Finds the row and column index of a given string in the DataTable.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} str - The string to search for.
|
|
96
|
+
* @returns {Promise<{ row: number; column: number }>} - A promise resolving to the indices. Defaults to {row: -1, column: -1} if not found.
|
|
97
|
+
*/
|
|
98
|
+
findValue(str: string): Promise<{
|
|
99
|
+
row: number;
|
|
100
|
+
column: number;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Runs all validators on the DataTable.
|
|
104
|
+
* If any validator fails, it will append the error message to the tableErrors array.
|
|
105
|
+
* If all validators pass, it will append the successful validation messages to the validMsgs array.
|
|
106
|
+
*
|
|
107
|
+
* @returns A Promise that resolves with a ParserResult containing the validation results.
|
|
108
|
+
* The data object within the ParserResult contains the arrays of valid messages and table errors.
|
|
109
|
+
*/
|
|
110
|
+
validate(): Promise<ParserResult<{
|
|
111
|
+
validMsgs: string[];
|
|
112
|
+
tableErrors: DataTableException[];
|
|
113
|
+
}>>;
|
|
114
|
+
/**
|
|
115
|
+
* Adds a validator to the DataTable.
|
|
116
|
+
* This validator will be called when the validate method is called.
|
|
117
|
+
*
|
|
118
|
+
* @param validator - The validator to add to the DataTable.
|
|
119
|
+
*/
|
|
120
|
+
useValidator(validator: DTValidator<this, T>): void;
|
|
121
|
+
/**
|
|
122
|
+
* Validates all fields in the DataTable.
|
|
123
|
+
*
|
|
124
|
+
* @param {string[]} validMsgs - Array of valid messages.
|
|
125
|
+
* @param {DataTableException[]} tableErrors - Array of table errors.
|
|
126
|
+
* @returns {Promise<void>} - A promise that resolves when the validation is complete.
|
|
127
|
+
*/
|
|
128
|
+
abstract validateFields(validMsgs: string[], tableErrors: DataTableException[]): Promise<void>;
|
|
129
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { COAEP } from "../../../../types/coaep";
|
|
2
|
+
import DataTableException from "../../../types/DataTableException";
|
|
3
|
+
import { CoaepDT } from "../../CoaepDT";
|
|
4
|
+
import { DTValidator } from "../../DTValidator";
|
|
5
|
+
export declare class ILOTaxoOrder extends DTValidator<CoaepDT, COAEP> {
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Validate the COAEP object.
|
|
9
|
+
* Checks if every Course Outcome has its ILOs in order of taxonomy level.
|
|
10
|
+
* If not, it will throw an error.
|
|
11
|
+
*
|
|
12
|
+
* @param {string[]} validMsgs - Array of valid messages.
|
|
13
|
+
* @param {DataTableException[]} tableErrors - Array of table errors.
|
|
14
|
+
* @param {CoaepDT} coaepDT - COAEP DataTable.
|
|
15
|
+
* @param {COAEP | null} coaepObj - COAEP object.
|
|
16
|
+
* @returns {Promise<void>} - Promise that resolves when validation is complete.
|
|
17
|
+
*/
|
|
18
|
+
validate(validMsgs: string[], tableErrors: DataTableException[], coaepDT: CoaepDT, coaepObj: COAEP | null): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export default ILOTaxoOrder;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { COAEP } from "../../../../types/coaep";
|
|
2
|
+
import { CoaepDT } from "../../CoaepDT";
|
|
3
|
+
import DataTableException from "../../../types/DataTableException";
|
|
4
|
+
import { DTValidator } from "../../DTValidator";
|
|
5
|
+
export declare class LastILOTaxo extends DTValidator<CoaepDT, COAEP> {
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Validate the COAEP object.
|
|
9
|
+
* Checks if the last ILO of every CO has the same taxonomy level as the CO.
|
|
10
|
+
* If not, it will throw an error.
|
|
11
|
+
*
|
|
12
|
+
* @param {string[]} validMsgs - Array of valid messages.
|
|
13
|
+
* @param {DataTableException[]} tableErrors - Array of table errors.
|
|
14
|
+
* @param {CoaepDT} coaepDT - COAEP DataTable.
|
|
15
|
+
* @param {COAEP | null} coaepObj - COAEP object.
|
|
16
|
+
* @returns {Promise<void>} - Promise that resolves when validation is complete.
|
|
17
|
+
*/
|
|
18
|
+
validate(validMsgs: string[], tableErrors: DataTableException[], coaepDT: CoaepDT, coaepObj: COAEP | null): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export default LastILOTaxo;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { COAEP } from "../../../../types/coaep";
|
|
2
|
+
import { CoaepDT } from "../../CoaepDT";
|
|
3
|
+
import DataTableException from "../../../types/DataTableException";
|
|
4
|
+
import { DTValidator } from "../../DTValidator";
|
|
5
|
+
export declare class MinCOtaxo extends DTValidator<CoaepDT, COAEP> {
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Validate the COAEP object.
|
|
9
|
+
* Checks if every Course Outcome has a taxonomy level of "Applying" or higher.
|
|
10
|
+
* This is done by checking for "Remembering" and "Understanding" as errors.
|
|
11
|
+
*
|
|
12
|
+
* @param {string[]} validMsgs - Array of valid messages.
|
|
13
|
+
* @param {DataTableException[]} tableErrors - Array of table errors.
|
|
14
|
+
* @param {CoaepDT} coaepDT - COAEP DataTable.
|
|
15
|
+
* @param {COAEP | null} coaepObj - COAEP object.
|
|
16
|
+
* @returns {Promise<void>} - Promise that resolves when validation is complete.
|
|
17
|
+
*/
|
|
18
|
+
validate(validMsgs: string[], tableErrors: DataTableException[], coaepDT: CoaepDT, coaepObj: COAEP | null): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bundle.js
CHANGED
|
@@ -1,62 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import _0x5e5e77 from 'papaparse';
|
|
2
|
+
import * as _0x20aa0b from 'xlsx';
|
|
3
3
|
|
|
4
|
-
function parseCurriculum(
|
|
4
|
+
function parseCurriculum(_0x370b56){let _0xa921be='',_0x52226b='',_0x9be818=0x0,_0x3da1f6=null;const _0x42f915=[];return _0x5e5e77['parse'](_0x370b56,{'skipEmptyLines':!![],'complete':_0x444edf=>{_0x444edf['data']['forEach'](_0x1f55e2=>{const _0x4d5186=_0x1f55e2['map'](_0x20e5b8=>(_0x20e5b8??'')['toString']()['trim']()),_0x372d65=_0x4d5186[0x0]??'';if(_0x372d65['includes']('Rev#')){const _0x35b2b9=_0x372d65['match'](/([A-Z0-9]+)\s*-\s*.*:\s*(.*?)\s+Rev#\s*(\d+)/i);_0x35b2b9&&(_0xa921be=_0x35b2b9[0x1]?.['trim']()??'',_0x52226b=_0x35b2b9[0x2]?.['trim']()??'',_0x9be818=parseInt(_0x35b2b9[0x3]??'0',0xa));return;}if(/FIRST YEAR/i['test'](_0x372d65)){_0x3da1f6=0x1;return;}if(/SECOND YEAR/i['test'](_0x372d65)){_0x3da1f6=0x2;return;}if(/THIRD YEAR/i['test'](_0x372d65)){_0x3da1f6=0x3;return;}if(/FOURTH YEAR/i['test'](_0x372d65)){_0x3da1f6=0x4;return;}if(/FIFTH YEAR/i['test'](_0x372d65)){_0x3da1f6=0x5;return;}if(/First Semester/i['test'](_0x372d65)||/Second Semester/i['test'](_0x372d65)||/Summer/i['test'](_0x372d65))return;const _0x500950=[{'sem':0x1,'offset':0x0},{'sem':0x2,'offset':0x6},{'sem':0x3,'offset':0xc}];_0x500950['forEach'](({sem:_0x57d20b,offset:_0x14b83a})=>{const _0x47e695=_0x4d5186[_0x14b83a]??'',_0x3a3383=_0x4d5186[_0x14b83a+0x1]??'',_0x5e812e=_0x4d5186[_0x14b83a+0x2]??'',_0x186dc1=_0x4d5186[_0x14b83a+0x3]??'',_0x4e4f5a=_0x4d5186[_0x14b83a+0x4]??'';_0x47e695&&_0x3da1f6&&_0x42f915['push']({'curr_id':_0xa921be,'program_name':_0x52226b,'revision_no':_0x9be818,'year_level':_0x3da1f6,'sem':_0x57d20b,'course_id':_0x47e695,'course_desc':_0x3a3383,'total_units':_0x5e812e,'lec_unit':_0x186dc1,'lab_unit':_0x4e4f5a});});});}}),_0x42f915;}
|
|
5
5
|
|
|
6
|
-
function convertToCSVFile(
|
|
6
|
+
function convertToCSVFile(_0x5f0e30,_0xcf2c9b){return new Promise((_0x50dcdf,_0x335c0f)=>{const _0x4aa2ee=new FileReader();_0x4aa2ee['onload']=_0xb8fe59=>{const _0x5b4a21=_0xb8fe59['target']?.['result'];if(!_0x5b4a21){_0x335c0f(new Error('Failed\x20to\x20read\x20file'));return;}try{const _0x5c1e32=_0x20aa0b['read'](_0x5b4a21,{'type':'array'});!_0xcf2c9b&&(_0xcf2c9b=_0x5c1e32['SheetNames'][0x0]);if(!_0xcf2c9b){_0x335c0f(new Error('No\x20sheets\x20found\x20in\x20workbook'));return;}const _0x8d4647=_0x5c1e32['Sheets'][_0xcf2c9b];if(!_0x8d4647){_0x335c0f(new Error('No\x20sheets\x20found\x20in\x20worksheet'));return;}const _0x37cbd6=_0x20aa0b['utils']['sheet_to_csv'](_0x8d4647,{'strip':!![]}),_0x2f4804=_0x5f0e30['name']['replace'](/\.[^/.]+$/,'.csv'),_0x2ba963=new File([_0x37cbd6],_0x2f4804,{'type':'text/csv','lastModified':Date['now']()});_0x50dcdf(_0x2ba963);}catch(_0x3279d9){_0x335c0f(_0x3279d9);}},_0x4aa2ee['onerror']=()=>{_0x335c0f(new Error('File\x20reading\x20failed'));},_0x4aa2ee['readAsArrayBuffer'](_0x5f0e30);});}
|
|
7
7
|
|
|
8
|
-
async function uploadCurriculum(
|
|
8
|
+
async function uploadCurriculum(_0x429b41,_0x3aed4f){try{const _0x46f4bf=await convertToCSVFile(_0x3aed4f),_0x2adecb=await _0x46f4bf['text'](),_0x31b1a9=parseCurriculum(_0x2adecb),_0x260665=_0x5e5e77['unparse'](_0x31b1a9),_0x3f085c=new File([_0x260665],_0x46f4bf['name'],{'type':'text/csv'}),_0x4d77f1=new FormData();_0x4d77f1['append']('csvFile',_0x3f085c);const _0x588012=await fetch(_0x429b41+'/curr-courses/upload',{'method':'POST','body':_0x4d77f1});if(!_0x588012['ok']){const _0x580e1b=await _0x588012['json']();throw _0x580e1b;}return _0x588012['json']();}catch(_0x174b1d){throw _0x174b1d;}}
|
|
9
9
|
|
|
10
|
-
function parseCourseOffering(
|
|
10
|
+
function parseCourseOffering(_0x5c1d87){let _0x12b6f8='',_0x2b056d='';const _0x41519a=[],_0x2a897f=_0x5e5e77['parse'](_0x5c1d87,{'header':![],'skipEmptyLines':!![],'delimiter':','}),_0x467693=_0x2a897f['data'];for(let _0x55a8ff=0x0;_0x55a8ff<Math['min'](0x5,_0x467693['length']);_0x55a8ff++){const _0x14bb5b=_0x467693[_0x55a8ff];if(_0x14bb5b&&_0x14bb5b['length']>0x0){const _0x383ca7=_0x14bb5b[0x0]?.['toString']()||'',_0x3947aa=_0x383ca7['match'](/(First|Second)\s+Sem\s+S\/Y\s+(\d{4}-\d{4})/i);if(_0x3947aa){_0x12b6f8=_0x3947aa[0x1]?.['toLowerCase']()==='first'?'1':'2';if(_0x3947aa[0x2]){const _0x25b4bf=_0x3947aa[0x2]['match'](/(\d{2})(\d{2})-(\d{2})(\d{2})/);_0x25b4bf&&_0x25b4bf[0x2]&&_0x25b4bf[0x4]&&(_0x2b056d=_0x25b4bf[0x2]+_0x25b4bf[0x4]);}}}}let _0x203a97=-1;for(let _0x518461=0x0;_0x518461<_0x467693['length'];_0x518461++){const _0x19bbd2=_0x467693[_0x518461];if(_0x19bbd2&&_0x19bbd2['some'](_0x55457e=>_0x55457e?.['toString']()['toUpperCase']()['includes']('CODE'))){_0x203a97=_0x518461;break;}}if(_0x203a97===-1)throw new Error('Could\x20not\x20find\x20header\x20row\x20in\x20CSV\x20data');let _0x1d7b01={'code':'','description':'','unit':0x0};for(let _0xec5787=_0x203a97+0x1;_0xec5787<_0x467693['length'];_0xec5787++){const _0x712976=_0x467693[_0xec5787];if(!_0x712976||_0x712976['length']<0x8)continue;const _0x3c2c1c=_0x712976[0x1]?.['toString']()['trim']()||'',_0xe346ec=_0x712976[0x4]?.['toString']()['trim']()||'',_0x4e1e74=_0x712976[0x5]?.['toString']()['trim']()||'',_0x2284e6=_0x712976[0x6]?.['toString']()['trim']()||'',_0x3dcfaa=_0x712976[0x7]?.['toString']()['trim']()||'',_0x22290d=_0x712976[0x3]?.['toString']()['trim']()||'';let _0x10eb84=_0x712976[0x0]?.['toString']()['trim']()||'',_0x59f09c=_0x712976[0x2]?.['toString']()['trim']()||'';if(!_0x3c2c1c)continue;if(!_0x10eb84)_0x10eb84=_0x1d7b01['code'];if(!_0x59f09c)_0x59f09c=_0x1d7b01['description'];let _0x1b6d48=_0x1d7b01['unit'];if(_0x22290d){const _0x2e6bbc=_0x22290d['match'](/(\d+)/);_0x2e6bbc&&_0x2e6bbc[0x1]&&(_0x1b6d48=parseInt(_0x2e6bbc[0x1],0xa));}const _0x50bcc4={'sem':_0x12b6f8,'school_year':_0x2b056d,'code':_0x10eb84,'course_no':_0x3c2c1c,'course_desc':_0x59f09c,'unit':_0x1b6d48,'time':_0xe346ec,'days':_0x4e1e74,'faculty':_0x2284e6,'room':_0x3dcfaa};_0x1d7b01['code']=_0x10eb84,_0x1d7b01['description']=_0x59f09c,_0x1d7b01['unit']=_0x1b6d48,_0x41519a['push'](_0x50bcc4);}return _0x41519a;}
|
|
11
11
|
|
|
12
|
-
async function uploadCourseOffering(
|
|
12
|
+
async function uploadCourseOffering(_0x2e202b,_0x5e7f60){try{const _0x56166a=await convertToCSVFile(_0x5e7f60),_0x54a8bc=await _0x56166a['text'](),_0x1c89a4=parseCourseOffering(_0x54a8bc),_0x449b44=_0x5e5e77['unparse'](_0x1c89a4),_0x2548c6=new File([_0x449b44],_0x56166a['name'],{'type':'text/csv'}),_0x569f93=new FormData();_0x569f93['append']('csvFile',_0x2548c6);const _0x37117c=await fetch(_0x2e202b+'/course-offerings/upload',{'method':'POST','body':_0x569f93});if(!_0x37117c['ok']){const _0x5de342=await _0x37117c['json']();throw _0x5de342;}return _0x37117c['json']();}catch(_0xd02611){throw _0xd02611;}}
|
|
13
13
|
|
|
14
|
-
function performaceTarget(
|
|
14
|
+
function performaceTarget(_0x580b63){if(!_0x580b63)return {'performance_target':null,'passing_score':null};const _0x4c7a0b=_0x580b63['match'](/\d+/g);return {'performance_target':_0x4c7a0b?.[0x0]?parseInt(_0x4c7a0b[0x0],0xa):null,'passing_score':_0x4c7a0b?.[0x1]?parseInt(_0x4c7a0b[0x1],0xa):null};}
|
|
15
15
|
|
|
16
|
-
const HEADERS$1={'co':['course\x20outcome','co\x20statement','outcome\x20statement'],'ilo':['intended\x20learning','ilo','learning\x20outcome'],'assessTool':['assessment\x20tool','assessment\x20method','tool'],'perfTarget':['performance\x20target','target','passing']};function getCoaepHeader(
|
|
16
|
+
const HEADERS$1={'co':['course\x20outcome','co\x20statement','outcome\x20statement'],'ilo':['intended\x20learning','ilo','learning\x20outcome'],'assessTool':['assessment\x20tool','assessment\x20method','tool'],'perfTarget':['performance\x20target','target','passing']};function getCoaepHeader(_0x551e79){let _0x215dbb={'headerRowIndex':-1,'coIdx':-1,'iloIdx':-1,'assessToolIdx':-1,'perfTargetIdx':-1};for(let _0x5cdf5f=0x0;_0x5cdf5f<Math['min'](_0x551e79['length'],0x14);_0x5cdf5f++){const _0x2a5a9e=(_0x551e79[_0x5cdf5f]??[])['map'](_0xbbe583=>_0xbbe583['toLowerCase']()['trim']()),_0x400f31=_0x2a5a9e['findIndex'](_0x271f51=>HEADERS$1['co']['some'](_0x357877=>_0x271f51['includes'](_0x357877))),_0x4a9b9d=_0x2a5a9e['findIndex'](_0xb1edfb=>HEADERS$1['ilo']['some'](_0x28d80b=>_0xb1edfb['includes'](_0x28d80b))),_0x5d2a88=_0x2a5a9e['findIndex'](_0x90df4c=>HEADERS$1['assessTool']['some'](_0xd0e8c5=>_0x90df4c['includes'](_0xd0e8c5))),_0xac20a=_0x2a5a9e['findIndex'](_0x578a2b=>HEADERS$1['perfTarget']['some'](_0x145b3b=>_0x578a2b['includes'](_0x145b3b))),_0x4e1566=[_0x400f31,_0x4a9b9d,_0x5d2a88,_0xac20a]['filter'](_0x2f511b=>_0x2f511b!==-1)['length'];if(_0x4e1566>=0x3){_0x215dbb={'headerRowIndex':_0x5cdf5f,'coIdx':_0x400f31,'iloIdx':_0x4a9b9d,'assessToolIdx':_0x5d2a88,'perfTargetIdx':_0xac20a};break;}}return _0x215dbb;}
|
|
17
17
|
|
|
18
|
-
function extractFromObjective(
|
|
18
|
+
function extractFromObjective(_0x2bac2a){const _0x18cf25={'cognitive_level':null,'taxonomy_level':null,'verb':null},_0x263689=/(?:\(([IED])\))?\s*(\w+)\s*:\s*(.*)/i,_0x1cc2c2=_0x2bac2a['match'](_0x263689);if(_0x1cc2c2){if(_0x1cc2c2[0x1])_0x18cf25['cognitive_level']=_0x1cc2c2[0x1];if(_0x1cc2c2[0x2])_0x18cf25['taxonomy_level']=_0x1cc2c2[0x2]['toLowerCase']();const _0x5d0489=_0x1cc2c2[0x3]?.['trim']();if(_0x5d0489){const _0x1ff40f=/(?:shall|will)\s+(\w+)/i,_0x12fd92=_0x5d0489['match'](_0x1ff40f);_0x12fd92?_0x18cf25['verb']=_0x12fd92[0x1]['toLowerCase']():_0x18cf25['verb']=_0x5d0489['split'](/\s+/)[0x0]['toLowerCase']();}}return _0x18cf25;}
|
|
19
19
|
|
|
20
|
-
function parseCOAEP(
|
|
20
|
+
function parseCOAEP(_0x5c1259){const _0x5b8a36=_0x5e5e77['parse'](_0x5c1259,{'skipEmptyLines':![]})['data'],_0x3212da={'COAEP':{'faculty':null,'course':null,'sy':null,'semester':null,'co':[]}},{headerRowIndex:_0x5733b5,coIdx:_0x497653,iloIdx:_0x15c4d5,assessToolIdx:_0x314df0,perfTargetIdx:_0x291d4e}=getCoaepHeader(_0x5b8a36);if(_0x5733b5===-1)return {'error':'Could\x20not\x20auto-detect\x20header\x20row.','message':'Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.'};_0x5b8a36['forEach'](_0x27ee6a=>{const _0x4b310f=_0x27ee6a['indexOf']('Name\x20of\x20Faculty:'),_0x24b813=_0x27ee6a['indexOf']('School\x20Year'),_0x372b08=_0x27ee6a['indexOf']('Course:'),_0x4eb1fe=_0x27ee6a['indexOf']('Semester');_0x4b310f!==-1&&(_0x3212da['COAEP']['faculty']=_0x27ee6a[_0x4b310f+0x1]?.['trim']()||_0x3212da['COAEP']['faculty']);_0x24b813!==-1&&(_0x3212da['COAEP']['sy']=_0x27ee6a[_0x24b813+0x1]?.['trim']()||_0x3212da['COAEP']['sy']);_0x372b08!==-1&&(_0x3212da['COAEP']['course']=_0x27ee6a[_0x372b08+0x1]?.['trim']()||_0x3212da['COAEP']['course']);if(_0x4eb1fe!==-1){const _0xdfc99=_0x27ee6a[_0x4eb1fe+0x1]?.['trim']()||'',_0x2d30df=_0xdfc99['match'](/\d+/)?.[0x0];_0x3212da['COAEP']['semester']=_0x2d30df?parseInt(_0x2d30df,0xa):_0x3212da['COAEP']['semester'];}});let _0x4165e2=null;return _0x5b8a36['forEach']((_0x338246,_0x2d2151)=>{if(_0x2d2151<=_0x5733b5)return;let _0x2040db=_0x338246[_0x497653-0x1]?.['trim']()||'',_0x2b7856=_0x338246[_0x497653]?.['trim']()||'';/^\d+$/['test'](_0x338246[_0x497653]?.['trim']()||'')&&(_0x2040db=_0x338246[_0x497653]?.['trim']()||'',_0x2b7856=_0x338246[_0x497653+0x1]?.['trim']()||'');const _0x159de6=_0x338246[_0x15c4d5]?.['trim']()||'',_0x3c982e=_0x338246[_0x314df0]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',_0x5a9a75=_0x338246[_0x291d4e]?.['replace'](/\s+/g,'\x20')['trim']()||'';if(_0x2040db&&/^\d+$/['test'](_0x2040db)){_0x4165e2&&_0x3212da['COAEP']['co']['push'](_0x4165e2);const _0x5ad33a=_0x2b7856,{verb:_0x3f0845,cognitive_level:_0x3740e3,taxonomy_level:_0x5dd4f7}=extractFromObjective(_0x5ad33a);if(!_0x3f0845)return {'error':'Could\x20not\x20find\x20verb.','message':'Please\x20ensure\x20the\x20Course\x20Outcome\x20#'+_0x2040db+'\x20is\x20in\x20the\x20correct\x20format.'};_0x4165e2={'statement':_0x5ad33a,'ilo':[],'verb':_0x3f0845,'cognitive_level':_0x3740e3,'taxonomy_level':_0x5dd4f7};}if(_0x4165e2&&_0x159de6&&_0x5a9a75){const _0x498fbf=_0x159de6['replace'](/^ILO\d+[:.]?\s*/,'');if(_0x498fbf['match'](/^(Revision|Prepared|Date|Approved|Effectivity|Page)/i)||_0x498fbf['length']<0xa)return;let _0x53f9c6=_0x3c982e;if(!_0x53f9c6&&_0x498fbf['includes'](':')){const _0x3a6a34=_0x498fbf['match'](/^ILO\d+:\s*(.+?)(?:\s*\(|$)/);_0x3a6a34&&(_0x53f9c6=_0x3a6a34[0x1]?.['trim']()||'');}const {performance_target:_0x12d14a,passing_score:_0x2f57ff}=performaceTarget(_0x5a9a75),{verb:_0xa0fe19,cognitive_level:_0x4a9acb,taxonomy_level:_0x50cb75}=extractFromObjective(_0x498fbf);_0x4165e2['ilo']['push']({'statement':_0x498fbf,'assessment_tool':_0x53f9c6,'performance_target':_0x12d14a,'passing_score':_0x2f57ff,'verb':_0xa0fe19,'cognitive_level':_0x4a9acb,'taxonomy_level':_0x50cb75});}}),_0x4165e2&&_0x3212da['COAEP']['co']['push'](_0x4165e2),_0x3212da;}
|
|
21
21
|
|
|
22
|
-
async function uploadCOAEP(
|
|
22
|
+
async function uploadCOAEP(_0x54d435,_0x1f0e4a,_0x55cd7b){try{const _0x440d82=await convertToCSVFile(_0x1f0e4a),_0x2b8fb2=await _0x440d82['text'](),_0x3789d0=parseCOAEP(_0x2b8fb2);console['log'](_0x3789d0);const _0x139dd7=await fetch(_0x54d435+'/coaeps/upload?course_id='+_0x55cd7b,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x3789d0)});if(!_0x139dd7['ok']){const _0x1e603e=await _0x139dd7['json']();throw _0x1e603e;}return _0x139dd7['json']();}catch(_0x37f38f){throw _0x37f38f;}}
|
|
23
23
|
|
|
24
|
-
async function uploadEnrolledStudent(
|
|
24
|
+
async function uploadEnrolledStudent(_0x5bb46f,_0xacb94e){try{const _0x441422=await convertToCSVFile(_0xacb94e),_0x161abf=new FormData();_0x161abf['append']('csvFile',_0x441422);const _0x669eb7=await fetch(_0x5bb46f+'/enrolled-students/upload',{'method':'POST','body':_0x161abf});if(!_0x669eb7['ok']){const _0x2aa46b=await _0x669eb7['json']();throw _0x2aa46b;}return _0x669eb7['json']();}catch(_0x33dfa0){throw _0x33dfa0;}}
|
|
25
25
|
|
|
26
|
-
function parseClassList(
|
|
26
|
+
function parseClassList(_0x3d6778){const _0x43b142=_0x5e5e77['parse'](_0x3d6778,{'skipEmptyLines':!![]})['data'];let _0x388c96='',_0x93aba7='',_0x78c944='';const _0x1d595a=[];return _0x43b142['forEach'](_0x2ca2aa=>{const _0x550a7b=_0x2ca2aa['map'](_0x53dcbb=>(_0x53dcbb??'')['toString']()['trim']()),_0x1db13a=_0x550a7b[0x0]??'';if(_0x1db13a['startsWith']('Course\x20No:')){const _0x285c27=_0x1db13a['replace']('Course\x20No:','')['trim'](),_0x2aecd=_0x285c27['split'](/\s+/);_0x78c944=_0x2aecd[0x0]??'';const [_0x3c0f16,_0x638e1c]=(_0x2aecd[0x1]??'')['split']('-');_0x93aba7=_0x3c0f16??'';const _0x1a2763=(_0x638e1c??'')['match'](/[a-z]$/);_0x388c96=_0x1a2763?_0x1a2763[0x0]:'';}if(/^\d+$/['test'](_0x1db13a)){const _0x37fb43=_0x550a7b[0x2]??'';_0x1d595a['push']({'subj_code':_0x78c944,'student_no':_0x37fb43,'course_id':_0x93aba7,'section':_0x388c96});}}),{'enrolledCourses':_0x1d595a};}
|
|
27
27
|
|
|
28
|
-
async function uploadClassList(
|
|
28
|
+
async function uploadClassList(_0x2455d0,_0x5c19c8,_0x3e7c20,_0x63752f){try{const _0x4e29a1=await convertToCSVFile(_0x5c19c8),_0x47c883=await _0x4e29a1['text'](),_0x35fb5e=parseClassList(_0x47c883),_0x37789d='subj_code='+_0x3e7c20+'&period_id='+_0x63752f,_0x330ace=await fetch(_0x2455d0+'/enrolled-courses/upload?'+_0x37789d,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x35fb5e)});if(!_0x330ace['ok']){const _0xb451c8=await _0x330ace['json']();throw _0xb451c8;}return _0x330ace['json']();}catch(_0x2098db){throw _0x2098db;}}
|
|
29
29
|
|
|
30
|
-
function parseAssessmentCsv(
|
|
30
|
+
function parseAssessmentCsv(_0x2bdd44){const {data:_0x4d7857}=_0x5e5e77['parse'](_0x2bdd44,{'skipEmptyLines':!![]}),_0x50a4b0=_0x4d7857['filter'](_0x2f7e07=>_0x2f7e07['length']>0x0),_0x29519f=_0x50a4b0['find'](_0x290e6e=>_0x290e6e['some'](_0x1b9a8a=>_0x1b9a8a?.['includes']('Faculty'))),_0x49e18a=_0x29519f?_0x29519f['findIndex'](_0x5d79b5=>_0x5d79b5?.['includes']('Faculty')):-1,_0x17e4d9=_0x49e18a!==-1&&_0x29519f?_0x29519f[_0x49e18a+0x2]?.['replace'](/"/g,'')['trim']()??'':'',_0x3caf0e=_0x50a4b0['find'](_0x58b0b6=>_0x58b0b6['some'](_0x3004ae=>_0x3004ae?.['includes']('Semester'))),_0x36113c=_0x3caf0e?_0x3caf0e['findIndex'](_0x2123cd=>_0x2123cd?.['includes']('Semester')):-1,_0x56ae72=_0x36113c!==-1&&_0x3caf0e?_0x3caf0e[_0x36113c+0x2]?.['trim']()??'':'',_0x19a6a7=_0x56ae72['includes']('1st')?0x1:_0x56ae72['includes']('2nd')?0x2:0x0,_0x431907=_0x50a4b0['find'](_0x3b2982=>_0x3b2982['some'](_0x358fba=>_0x358fba?.['includes']('Course\x20&\x20Sec'))),_0x57c9a3=_0x431907?_0x431907['findIndex'](_0x372011=>_0x372011?.['includes']('Course\x20&\x20Sec')):-1,_0x2f0d58=_0x57c9a3!==-1&&_0x431907?_0x431907[_0x57c9a3+0x2]?.['trim']()??'':'';let _0x544324='',_0x37f8bf='';if(_0x2f0d58){const _0x38bdae=_0x2f0d58['match'](/^([A-Za-z0-9]+)-?([A-Za-z]+)?/);_0x38bdae&&(_0x544324=_0x38bdae[0x1]??'',_0x38bdae[0x2]&&(_0x37f8bf=_0x38bdae[0x2]['replace'](/^OC/i,'')));}const _0x11c906=_0x50a4b0['find'](_0x214878=>_0x214878['some'](_0x4ea5a1=>_0x4ea5a1?.['includes']('School\x20Year'))),_0x3f5031=_0x11c906?_0x11c906['findIndex'](_0x4dea2e=>_0x4dea2e?.['includes']('School\x20Year')):-1,_0x3978e6=_0x3f5031!==-1&&_0x11c906?_0x11c906[_0x3f5031+0x2]?.['trim']()??'':'';let _0x1db512=0x0;if(_0x3978e6){const _0x1d412c=_0x3978e6['match'](/(\d{4})-(\d{4})/);if(_0x1d412c){const _0x3ab37a=(_0x1d412c[0x1]??'')['slice'](0x2),_0x45dd2b=(_0x1d412c[0x2]??'')['slice'](0x2);_0x1db512=parseInt(_0x3ab37a+_0x45dd2b,0xa);}}const _0x457b7b={'faculty':_0x17e4d9,'course':_0x544324,'section':_0x37f8bf,'semester':_0x19a6a7,'sy':_0x1db512},_0x54b2d3=_0x50a4b0['findIndex'](_0x566e72=>_0x566e72['some'](_0x559a43=>_0x559a43?.['trim']()==='CO\x20#'));if(_0x54b2d3===-1)throw new Error('CO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x380220=_0x50a4b0[_0x54b2d3+0x1];if(!_0x380220)throw new Error('ILO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x169b33={};let _0x3b182e=0x1,_0x8cbada=0x1;for(let _0x914231=0x3;_0x914231<_0x380220['length'];_0x914231++){const _0x5871d7=_0x380220[_0x914231];if(!_0x5871d7)continue;const _0x369efc='co'+_0x3b182e;if(!_0x169b33[_0x369efc])_0x169b33[_0x369efc]=[];_0x169b33[_0x369efc]['push']('ilo'+_0x8cbada),_0x8cbada++,_0x8cbada>0x3&&(_0x3b182e++,_0x8cbada=0x1);}const _0x13d320=_0x50a4b0['findIndex'](_0x27cfc0=>_0x27cfc0['includes']('Name\x20of\x20Students'));if(_0x13d320===-1)throw new Error('Student\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x21f4d8=_0x50a4b0[_0x13d320];if(!_0x21f4d8)throw new Error('Student\x20header\x20row\x20is\x20missing');const _0x22695d=_0x21f4d8['findIndex'](_0x1794f8=>_0x1794f8?.['includes']('Name\x20of\x20Students'));if(_0x22695d===-1)throw new Error('Name\x20of\x20Students\x20column\x20not\x20found\x20in\x20CSV');const _0x44247b=_0x22695d+0x2,_0x34cabc=[];for(let _0x22c65f=_0x13d320+0x1;_0x22c65f<_0x50a4b0['length'];_0x22c65f++){const _0x238ff9=_0x50a4b0[_0x22c65f];if(!_0x238ff9)continue;if(_0x238ff9['some'](_0x444524=>_0x444524?.['toUpperCase']()['includes']('TOTAL\x20STUDENTS')||_0x444524?.['toUpperCase']()['includes']('ACHIEVED\x20THE\x20MINIMUM')||_0x444524?.['toUpperCase']()['includes']('INACTIVE')||_0x444524?.['toUpperCase']()['includes']('AVERAGE')))continue;if(!_0x238ff9[_0x22695d])continue;const _0x26cc03=_0x238ff9[_0x22695d]['replace'](/"/g,'')['trim'](),_0xee74fe=_0x238ff9['slice'](_0x44247b)['map'](_0x3f6008=>_0x3f6008===null?null:!isNaN(Number(_0x3f6008))?parseFloat(_0x3f6008):0x0);let _0x258768=0x0;const _0x221440={};Object['entries'](_0x169b33)['forEach'](([_0x5100cd,_0x31aa26])=>{const _0x18a975={};_0x31aa26['forEach'](_0x313a55=>{_0x18a975[_0x313a55]=_0xee74fe[_0x258768]??0x0,_0x258768++;}),_0x221440[_0x5100cd]={'transmuted_score':_0x18a975};}),_0x34cabc['push']({'student_name':_0x26cc03,'coaep':_0x221440});}const _0x30cacb=_0x50a4b0['find'](_0x554e1d=>_0x554e1d['some'](_0xc540be=>_0xc540be?.['includes']('ACHIEVED\x20THE\x20MINIMUM'))),_0x333ea5=_0x50a4b0['find'](_0x227621=>_0x227621['some'](_0x2a45bb=>_0x2a45bb?.['includes']('AVERAGE'))),_0x35dc5c=_0x30cacb?_0x30cacb['slice'](_0x44247b)['map'](_0x36f3b8=>_0x36f3b8&&!isNaN(Number(_0x36f3b8))?parseInt(_0x36f3b8):0x0):[],_0x150e33=_0x333ea5?_0x333ea5['slice'](_0x44247b)['map'](_0x4fd657=>_0x4fd657&&_0x4fd657!=='#DIV/0!'&&!isNaN(Number(_0x4fd657))?parseInt(_0x4fd657):0x0):[],_0x2f914c={};let _0x962c28=0x0;return Object['entries'](_0x169b33)['forEach'](([_0x3bd43a,_0x293d0d])=>{if(!_0x2f914c[_0x3bd43a])_0x2f914c[_0x3bd43a]={};_0x293d0d['forEach'](_0x184f3a=>{_0x2f914c[_0x3bd43a][_0x184f3a]={'achievedMinimum':_0x35dc5c[_0x962c28]??0x0,'average':_0x150e33[_0x962c28]??0x0},_0x962c28++;});}),{'assessmentData':{'classAssignment':_0x457b7b,'student':_0x34cabc,'total':_0x2f914c}};}
|
|
31
31
|
|
|
32
|
-
async function uploadAssessmentData(
|
|
32
|
+
async function uploadAssessmentData(_0x598857,_0x1c1418){try{const _0x2d814f=await convertToCSVFile(_0x1c1418),_0xa212a1=await _0x2d814f['text'](),_0xd511c2=parseAssessmentCsv(_0xa212a1),_0x1b34ea=await fetch(_0x598857+'/assessment-data/upload',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0xd511c2)});if(!_0x1b34ea['ok']){const _0x94a128=await _0x1b34ea['json']();throw _0x94a128;}return _0x1b34ea['json']();}catch(_0x59db1a){throw _0x59db1a;}}
|
|
33
33
|
|
|
34
|
-
async function uploadDeptFaculty(
|
|
34
|
+
async function uploadDeptFaculty(_0x1150d7,_0xd04791){try{const _0x1e3fd3=await convertToCSVFile(_0xd04791),_0x2a5d01=new FormData();_0x2a5d01['append']('csvFile',_0x1e3fd3);const _0x17dcf2=await fetch(_0x1150d7+'/dept-faculties/upload',{'method':'POST','body':_0x2a5d01});if(!_0x17dcf2['ok']){const _0x2796b7=await _0x17dcf2['json']();throw _0x2796b7;}return _0x17dcf2['json']();}catch(_0x45aaf2){throw _0x45aaf2;}}
|
|
35
35
|
|
|
36
|
-
const HEADERS={'po':['program\x20outcome','po\x20statement','outcome\x20statement'],'tl':['taxonomy','level'],'pi':['performance\x20indicator'],'fc':['formative'],'sc':['summative'],'at':['assessment\x20tool','assessment\x20method','tool'],'pt':['performance\x20target','target','passing']};function getPoaepHeader(
|
|
36
|
+
const HEADERS={'po':['program\x20outcome','po\x20statement','outcome\x20statement'],'tl':['taxonomy','level'],'pi':['performance\x20indicator'],'fc':['formative'],'sc':['summative'],'at':['assessment\x20tool','assessment\x20method','tool'],'pt':['performance\x20target','target','passing']};function getPoaepHeader(_0xdd327b){let _0x2b1453={'headerIdx':-1,'poIdx':-1,'tlIdx':-1,'piIdx':-1,'fcIdx':-1,'scIdx':-1,'atIdx':-1,'ptIdx':-1};for(let _0x33487e=0x0;_0x33487e<Math['min'](_0xdd327b['length'],0x14);_0x33487e++){const _0x6d98d5=(_0xdd327b[_0x33487e]??[])['map'](_0x3d700a=>_0x3d700a['toLowerCase']()['trim']()),_0x5c4525=_0x6d98d5['findIndex'](_0x11408d=>HEADERS['po']['some'](_0x142d91=>_0x11408d['toLowerCase']()['includes'](_0x142d91))),_0x5a7b28=_0x6d98d5['findIndex'](_0x1d63b5=>HEADERS['tl']['some'](_0x16c713=>_0x1d63b5['toLowerCase']()['includes'](_0x16c713))),_0x189080=_0x6d98d5['findIndex'](_0x19f06f=>HEADERS['pi']['some'](_0x16a363=>_0x19f06f['toLowerCase']()['includes'](_0x16a363))),_0x1e4708=_0x6d98d5['findIndex'](_0x2383b6=>HEADERS['fc']['some'](_0x270453=>_0x2383b6['toLowerCase']()['includes'](_0x270453))),_0x220a89=_0x6d98d5['findIndex'](_0x24c22a=>HEADERS['sc']['some'](_0x548127=>_0x24c22a['toLowerCase']()['includes'](_0x548127))),_0x25bb5d=_0x6d98d5['findIndex'](_0x2f7b3a=>HEADERS['at']['some'](_0x15526b=>_0x2f7b3a['toLowerCase']()['includes'](_0x15526b))),_0x3ab245=_0x6d98d5['findIndex'](_0x309520=>HEADERS['pt']['some'](_0x27e391=>_0x309520['toLowerCase']()['includes'](_0x27e391))),_0x219b94=[_0x5c4525,_0x5a7b28,_0x189080,_0x1e4708,_0x220a89,_0x25bb5d,_0x3ab245]['filter'](_0xedf91f=>_0xedf91f!==-1)['length'];if(_0x219b94>=0x3){_0x2b1453={'headerIdx':_0x33487e,'poIdx':_0x5c4525,'tlIdx':_0x5a7b28,'piIdx':_0x189080,'fcIdx':_0x1e4708,'scIdx':_0x220a89,'atIdx':_0x25bb5d,'ptIdx':_0x3ab245};break;}}if(_0x2b1453['headerIdx']===-1)throw new Error('No\x20valid\x20headers\x20found\x20in\x20POAEP\x20file.');return _0x2b1453;}
|
|
37
37
|
|
|
38
|
-
const parseFormativeCourses=
|
|
38
|
+
const parseFormativeCourses=_0x31329a=>{let _0x5f090f=_0x31329a['split'](',')['reduce']((_0x4a360e,_0x32a962)=>{const _0x106df7=_0x32a962['trim']();if(_0x106df7)_0x4a360e['push'](_0x106df7);return _0x4a360e;},[]);return _0x5f090f;};
|
|
39
39
|
|
|
40
|
-
const parsePOAEP=
|
|
40
|
+
const parsePOAEP=_0x42b8b3=>{try{const _0x23f72d=_0x5e5e77['parse'](_0x42b8b3,{'skipEmptyLines':![]})['data'],{headerIdx:_0x5cc9dc,poIdx:_0x5ad06e,tlIdx:_0x2fcb77,piIdx:_0x5a2c17,fcIdx:_0x57b52f,scIdx:_0x5f436d,atIdx:_0xc96ca6,ptIdx:_0x5591a1}=getPoaepHeader(_0x23f72d),_0x34cff5=[];let _0x27a08c={'po_desc':'','seq_no':0x0,'PerfIndicators':[]},_0x368d62='',_0x557b67='',_0x425306='';for(let _0x26b663=_0x5cc9dc+0x1;_0x26b663<_0x23f72d['length'];_0x26b663++){const _0x33fd6a=_0x23f72d[_0x26b663];if(!_0x33fd6a)break;const _0x29a93f=_0x33fd6a[_0x5ad06e]?.['trim']()||'';_0x29a93f!==''&&(_0x27a08c={'po_desc':_0x29a93f,'seq_no':_0x27a08c['seq_no']+0x1,'PerfIndicators':[]},_0x34cff5['push'](_0x27a08c),_0x368d62='',_0x557b67='',_0x425306='');if(_0x27a08c['po_desc']==='')throw new Error('Invalid\x20Program\x20Outcome\x20at\x20row\x20'+_0x26b663+'.');const _0x23ab12=_0x33fd6a[_0x5a2c17]?.['trim']()||'';if(_0x23ab12==='')break;const _0x37661a=_0x33fd6a[_0x57b52f]?.['trim']()||'';if(_0x37661a==='')throw new Error('Empty\x20Formative\x20Courses\x20at\x20row\x20'+_0x26b663+'.');const _0x1f4ff3=_0x33fd6a[_0x5f436d]?.['trim']()||_0x368d62;if(_0x1f4ff3==='')throw new Error('Empty\x20Summative\x20Course\x20at\x20row\x20'+_0x26b663+'.');_0x368d62=_0x1f4ff3;const _0x3bf789=_0x33fd6a[_0xc96ca6]?.['trim']()||_0x557b67;if(_0x3bf789==='')throw new Error('Empty\x20Assessment\x20Tool\x20at\x20row\x20'+_0x26b663+'.');_0x557b67=_0x3bf789;const _0x11f84c=_0x33fd6a[_0x5591a1]?.['trim']()||_0x425306;if(_0x11f84c==='')throw new Error('Empty\x20Performance\x20Target\x20at\x20row\x20'+_0x26b663+'.');_0x425306=_0x11f84c;const _0x2f2726=parseFormativeCourses(_0x37661a);if(_0x2f2726['length']===0x0)throw new Error('Invalid\x20Formative\x20Courses\x20format\x20at\x20row\x20'+_0x26b663+'.');const _0xda6065=performaceTarget(_0x11f84c);if(!_0xda6065['performance_target']||!_0xda6065['passing_score'])throw new Error('Invalid\x20Performance\x20Targets\x20format\x20at\x20row\x20'+_0x26b663+'.');const _0x576692={'pi_desc':_0x23ab12,'FormativeCourses':_0x2f2726['map'](_0x52ea88=>({'course_id':_0x52ea88,'cognitive_level':0x0})),'SummativeCourse':{'course_id':_0x1f4ff3},'AssessmentTool':{'at_desc':_0x3bf789},'PerformanceTargets':{'target_percent':_0xda6065['performance_target'],'min_score':_0xda6065['passing_score']}};_0x27a08c['PerfIndicators']['push'](_0x576692);}return {'success':!![],'message':'Successfully\x20parsed\x20POAEP\x20file.','data':{'POAEP':_0x34cff5}};}catch(_0x576db8){return {'success':![],'error':_0x576db8 instanceof Error?_0x576db8['message']:_0x576db8,'message':'Please\x20ensure\x20the\x20file\x20follows\x20the\x20POAEP\x20template.'};}};
|
|
41
41
|
|
|
42
|
-
async function uploadPOAEP(
|
|
42
|
+
async function uploadPOAEP(_0xdf419c,_0x1b7d61,_0x1a562d,_0x5e417a,_0x3fa90a){try{const _0x41a626=await convertToCSVFile(_0x1b7d61),_0x1b3c13=await _0x41a626['text'](),_0x292a6f=parsePOAEP(_0x1b3c13),_0x4d1224=await fetch(_0xdf419c+'/program-outcomes/poaep/upload?curr_id='+_0x5e417a+'&period_id='+_0x3fa90a,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1a562d},'credentials':'include','body':JSON['stringify'](_0x292a6f)});if(!_0x4d1224['ok']){const _0xd8e95d=await _0x4d1224['json']();throw _0xd8e95d;}return _0x4d1224['json']();}catch(_0x34d508){throw _0x34d508;}}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
class DataTable{['name'];['table']=[];['headers'];['validators']=[];constructor(_0x10cb7a='DataTable'){this['name']=_0x10cb7a,this['table']=[],this['headers']=[],this['validators']=[];}['getName'](){return this['name'];}['getHeaders'](){return this['headers'];}['getTable'](){if(this['table']['length']===0x0)return {'success':![],'message':'Datatable\x20is\x20unset.'};return {'success':!![],'message':'Successfully\x20fetched\x20datatable.','data':{'name':this['name'],'table':this['table'],'headers':this['headers']}};}async['setTable'](_0x3effa0){await this['assertInitialized']();if(_0x3effa0[0x0]['length']!==this['headers']['length'])Promise['reject'](new Error('Number\x20of\x20columns\x20does\x20not\x20match\x20number\x20of\x20headers.'));this['table']=_0x3effa0;}async['initializeTable'](_0x2b833a){try{let _0x560a4c;if(_0x2b833a instanceof File)_0x560a4c=await this['fromXML'](_0x2b833a);else _0x560a4c=await this['fromCSVString'](_0x2b833a);if(!_0x560a4c['success']||!_0x560a4c['data'])return _0x560a4c;if(_0x560a4c['data']['table']['length']===0x0)throw new Error('Cannot\x20set\x20an\x20empty\x20table.');const {table:_0x298f95,headers:_0x4025ee}=_0x560a4c['data'];return this['table']=_0x298f95,this['headers']=_0x4025ee,{'success':!![],'message':'Successfully\x20set\x20table.'};}catch(_0x4a63ae){return {'success':![],'message':'Error\x20setting\x20table.','error':_0x4a63ae};}}async['assertInitialized'](){if(this['headers']['length']===0x0)throw {'error':'This\x20'+this['name']+'\x20is\x20not\x20initialized.','from':'ASSERT_INIT'};return Promise['resolve']('The\x20table\x20is\x20initialized.');}async['fromXML'](_0x685108,_0x172f02){const _0x381cf7=await convertToCSVFile(_0x685108,_0x172f02),_0x2a039=await _0x381cf7['text']();return this['fromCSVString'](_0x2a039);}async['findValue'](_0x3073bc){await this['assertInitialized']();for(let _0x25c067=0x0;_0x25c067<this['table']['length'];_0x25c067++){for(let _0x170f99=0x0;_0x170f99<this['table'][_0x25c067]['length'];_0x170f99++){if(this['table'][_0x25c067][_0x170f99]===_0x3073bc)return {'row':_0x25c067,'column':_0x170f99};}}return {'row':-1,'column':-1};}async['validate'](){const _0x30fd0b=[],_0x1e71be=[];try{await this['assertInitialized']()['then'](_0x321662=>{_0x30fd0b['push'](_0x321662);})['catch'](_0x2818da=>_0x1e71be['push'](_0x2818da));if(_0x1e71be['length']>0x0)throw 'Cannot\x20validate\x20uninitialized\x20table.';await this['validateFields'](_0x30fd0b,_0x1e71be);const {success:_0x2d461c,message:_0x23ae5d,error:_0xbfd8b4,data:_0x516a1e}=await this['toJson']();if(!_0x516a1e)throw 'Cannot\x20access\x20Json\x20Object\x20data.';_0x30fd0b['push'](..._0x516a1e['validMsgs']),_0x1e71be['push'](..._0x516a1e['tableErrors']);const {jsonObj:_0x372a6b}=_0x516a1e;for(const _0x26d90a of this['validators']){await _0x26d90a['validate'](_0x30fd0b,_0x1e71be,this,_0x372a6b);}let _0x5c84fa=this['name']+'\x20ran\x20its\x20validations.';if(_0x30fd0b['length']>0x0)_0x5c84fa+='\x20'+_0x30fd0b['length']+'\x20validations\x20were\x20successful.';if(_0x1e71be['length']>0x0)_0x5c84fa+='\x20'+_0x1e71be['length']+'\x20validations\x20failed.';return {'success':!![],'message':_0x5c84fa,'data':{'validMsgs':_0x30fd0b,'tableErrors':_0x1e71be}};}catch(_0x2248c5){return _0x1e71be['push']({'error':this['name']+'\x20failed\x20to\x20run\x20all\x20its\x20validations.','from':this['name']['toUpperCase']()+'_VALIDATE','cause':_0x2248c5}),{'success':![],'message':this['name']+'\x20failed\x20to\x20run\x20all\x20its\x20validations.','data':{'validMsgs':_0x30fd0b,'tableErrors':_0x1e71be}};}}['useValidator'](_0x48264b){this['validators']['push'](_0x48264b);}}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
class DTValidator{['name'];constructor(_0x23642b){this['name']=_0x23642b;}['getName'](){return this['name'];}['report'](_0x1df71d,_0x12390e,_0xcc5797){if(_0x1df71d['length']>0x0)_0xcc5797['push'](..._0x1df71d);else _0x12390e['push'](this['name']+'\x20successfully\x20validated.');}}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
class LastILOTaxo extends DTValidator{constructor(){super('LAST_ILO_TAXO');}async['validate'](_0x261fa8,_0x13e7e2,_0x187e01,_0x45e5a1){const _0x35b4ad=[];if(!_0x45e5a1){_0x13e7e2['push']({'error':'Unable\x20to\x20access\x20COAEP\x20object.','from':this['name']});return;}for(let _0x2e6e0a=0x0;_0x2e6e0a<_0x45e5a1['co']['length'];_0x2e6e0a++){const _0x11d8f0=_0x45e5a1['co'][_0x2e6e0a];if(!_0x11d8f0){const {row:_0x54d98a,column:_0x95d54a}=await _0x187e01['findValue'](_0x2e6e0a+0x1+'');_0x35b4ad['push']({'error':'No\x20CO\x20Statement\x20for\x20CO\x20'+(_0x2e6e0a+0x1)+'.','row':_0x54d98a,'column':_0x95d54a+0x1,'from':this['name']});continue;}if(!_0x11d8f0?.['ilo']){const {row:_0x353ccc,column:_0x590b8b}=await _0x187e01['findValue'](_0x11d8f0['statement']);_0x35b4ad['push']({'error':'No\x20ILOs\x20for\x20CO\x20'+(_0x2e6e0a+0x1)+'.','row':_0x353ccc,'column':_0x590b8b,'from':this['name']});continue;}const _0x50d527=_0x11d8f0['ilo']['length']-0x1,_0x22417c=_0x11d8f0['ilo'][_0x50d527];if(!_0x22417c['taxonomy_level']){const {row:_0x5b070a,column:_0x1dda83}=await _0x187e01['findValue'](_0x22417c['statement']);_0x35b4ad['push']({'error':'Last\x20ILO\x20for\x20CO\x20'+(_0x2e6e0a+0x1)+'\x20has\x20no\x20Taxonomy\x20Level.','row':_0x5b070a,'column':_0x1dda83,'from':this['name']});continue;}if(_0x22417c['taxonomy_level']!==_0x11d8f0['taxonomy_level']){const {row:_0x31e010,column:_0x23c31f}=await _0x187e01['findValue'](_0x22417c['statement']);_0x35b4ad['push']({'error':'Last\x20ILO\x20for\x20CO\x20'+(_0x2e6e0a+0x1)+'\x20does\x20not\x20match\x20the\x20CO\x27s\x20Taxonomy\x20Level.\x20('+_0x22417c['taxonomy_level']+'\x20!==\x20'+_0x11d8f0['taxonomy_level']+')','row':_0x31e010,'column':_0x23c31f,'from':this['name']});}}this['report'](_0x35b4ad,_0x261fa8,_0x13e7e2);}}
|
|
49
49
|
|
|
50
|
-
const
|
|
50
|
+
const invalidTaxos=['remembering','understanding'];class MinCOtaxo extends DTValidator{constructor(){super('MIN_CO_TAXO');}async['validate'](_0x2883e1,_0x284a8a,_0x2ede1e,_0x47e24a){const _0x1f5dd9=[];if(!_0x47e24a){_0x284a8a['push']({'error':'Unable\x20to\x20access\x20COAEP\x20object.','from':this['name']});return;}for(let _0x445154=0x0;_0x445154<_0x47e24a['co']['length'];_0x445154++){const _0x2b80a8=_0x47e24a['co'][_0x445154];if(!_0x2b80a8['taxonomy_level']){_0x1f5dd9['push']({'error':'No\x20taxonomy\x20level\x20for\x20CO\x20'+(_0x445154+0x1),'from':this['name']});continue;}for(const _0x37edeb of invalidTaxos){if(_0x2b80a8['taxonomy_level']===_0x37edeb){const {row:_0x581dae,column:_0x586855}=await _0x2ede1e['findValue'](_0x2b80a8['statement']);let _0x5c90af={'error':'Cannot\x20have\x20CO\x20Taxonomy\x20Level\x20of\x20lower\x20than\x20Applying:\x20'+_0x2b80a8['taxonomy_level']['toUpperCase'](),'from':this['name']};(_0x581dae!==-1||_0x586855!==-1)&&(_0x5c90af={..._0x5c90af,'row':_0x581dae,'column':_0x586855}),_0x1f5dd9['push'](_0x5c90af);}}}this['report'](_0x1f5dd9,_0x2883e1,_0x284a8a);return;}}
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const taxoOrder={'remembering':0x1,'understanding':0x2,'applying':0x3,'analyzing':0x4,'evaluating':0x5,'creating':0x6};class ILOTaxoOrder extends DTValidator{constructor(){super('ILO_TAXO_ORDER');}async['validate'](_0x24a0b5,_0x446ec1,_0x3ff39b,_0x4a8d0c){const _0x42f7c4=[];if(!_0x4a8d0c){_0x446ec1['push']({'error':'Unable\x20to\x20access\x20COAEP\x20object.','from':this['name']});return;}for(let _0x146f9a=0x0;_0x146f9a<_0x4a8d0c['co']['length'];_0x146f9a++){const _0x5f189f=_0x4a8d0c['co'][_0x146f9a];if(!_0x5f189f){const {row:_0x8c03aa,column:_0x3ba47e}=await _0x3ff39b['findValue'](_0x146f9a+0x1+'');_0x42f7c4['push']({'error':'No\x20CO\x20Statement\x20for\x20CO\x20'+(_0x146f9a+0x1)+'.','row':_0x8c03aa,'column':_0x3ba47e+0x1,'from':this['name']});continue;}if(!_0x5f189f?.['ilo']){const {row:_0x5a2ca8,column:_0x58d3e3}=await _0x3ff39b['findValue'](_0x5f189f['statement']);_0x42f7c4['push']({'error':'No\x20ILOs\x20for\x20CO\x20'+(_0x146f9a+0x1)+'.','row':_0x5a2ca8,'column':_0x58d3e3,'from':this['name']});continue;}const _0x465a7f=await _0x3ff39b['findValue'](_0x5f189f['ilo'][0x0]['statement']),_0x3f0ee7=_0x5f189f['ilo']['map'](_0x1d9a90=>taxoOrder[_0x1d9a90['taxonomy_level']]);let _0x1eaeaa=_0x3f0ee7[0x0];for(let _0x392bbe=0x1;_0x392bbe<_0x3f0ee7['length'];_0x392bbe++){if(_0x3f0ee7[_0x392bbe]<_0x1eaeaa){_0x42f7c4['push']({'error':'Under\x20CO\x20'+(_0x146f9a+0x1)+',\x20ILO\x20'+(_0x392bbe+0x1)+'\x20should\x20not\x20have\x20a\x20taxonomy\x20level\x20lower\x20than\x20ILO\x20'+_0x392bbe+'\x27s.','row':_0x465a7f['row'],'column':_0x465a7f['column']+_0x392bbe,'from':this['name']});continue;}_0x1eaeaa=_0x3f0ee7[_0x392bbe];}}this['report'](_0x42f7c4,_0x24a0b5,_0x446ec1);}}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
class CoaepDT extends DataTable{['faculty']=null;['course']=null;['sy']=null;['semester']=null;constructor(){super('CoaepDT'),this['useValidator'](new MinCOtaxo()),this['useValidator'](new LastILOTaxo()),this['useValidator'](new ILOTaxoOrder());}async['validateFields'](_0x102374,_0x5f152b){const _0x2691ca=[];let _0x1e0a13=null,_0x3582fb=null;for(let _0x32a227=0x0;_0x32a227<this['table']['length'];_0x32a227++){const _0x2016ca=[],_0x34ebd0=this['table'][_0x32a227],_0x135188=_0x34ebd0[0x0]||_0x1e0a13,_0x35a538=_0x34ebd0[0x1]||_0x3582fb,_0x4c56c7=_0x34ebd0[0x2],_0x3e56c9=_0x34ebd0[0x3],_0x203cb7=_0x34ebd0[0x4];if(!_0x135188)_0x2016ca['push'](0x0);if(!_0x35a538)_0x2016ca['push'](0x1);if(!_0x4c56c7)_0x2016ca['push'](0x2);if(!_0x3e56c9)_0x2016ca['push'](0x3);if(!_0x203cb7)_0x2016ca['push'](0x4);if(_0x3582fb!==_0x35a538)this['validateObjectiveGrammar'](_0x35a538,_0x32a227,0x1,_0x5f152b);_0x1e0a13=_0x135188,_0x3582fb=_0x35a538;for(const _0x335090 of _0x2016ca){_0x2691ca['push']({'error':'Missing\x20field:\x20'+this['headers'][_0x335090],'row':_0x32a227,'column':_0x335090});}if(_0x4c56c7)this['validateObjectiveGrammar'](_0x4c56c7,_0x32a227,0x2,_0x5f152b);}if(_0x2691ca['length']>0x0)_0x5f152b['push'](..._0x2691ca);else _0x102374['push'](this['name']+'\x20successfully\x20validated\x20all\x20fields.');}async['fromCSVString'](_0x30c9a0){try{const _0x5d335d={'name':this['name'],'table':[],'headers':[],'types':[]},_0xf26000=_0x5e5e77['parse'](_0x30c9a0,{'skipEmptyLines':![]})['data'];_0x5d335d['headers']=['No.','Course\x20Outcome\x20Statement','Intended\x20Learning\x20Outcome','Assessment\x20Tool','Performance\x20Target'];const {headerRowIndex:_0x51b349,coIdx:_0x17114e,iloIdx:_0x2e44bb,assessToolIdx:_0x1d5a31,perfTargetIdx:_0x443541}=getCoaepHeader(_0xf26000);if(_0x51b349===-0x1)throw new Error('Could\x20not\x20auto-detect\x20header\x20row.\x20Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.');_0xf26000['forEach'](_0x11d32f=>{const _0x581f31=_0x11d32f['indexOf']('Name\x20of\x20Faculty:'),_0x2f542e=_0x11d32f['indexOf']('School\x20Year'),_0x54b2dd=_0x11d32f['indexOf']('Course:'),_0x3603b0=_0x11d32f['indexOf']('Semester');_0x581f31!==-0x1&&(this['faculty']=_0x11d32f[_0x581f31+0x1]?.['trim']()||this['faculty']);_0x2f542e!==-0x1&&(this['sy']=_0x11d32f[_0x2f542e+0x1]?.['trim']()||this['sy']);_0x54b2dd!==-0x1&&(this['course']=_0x11d32f[_0x54b2dd+0x1]?.['trim']()||this['course']);if(_0x3603b0!==-0x1){const _0x24fc69=_0x11d32f[_0x3603b0+0x1]?.['trim']()||'',_0x5c1f09=_0x24fc69['match'](/\d+/)?.[0x0];this['semester']=_0x5c1f09?parseInt(_0x5c1f09,0xa):this['semester'];}});for(let _0x204dc7=0x0;_0x204dc7<=_0xf26000['length'];_0x204dc7++){const _0x3037a2=_0xf26000[_0x204dc7];if(!_0x3037a2)break;if(_0x204dc7<=_0x51b349)continue;let _0x4f05b8=_0x3037a2[_0x17114e-0x1]?.['trim']()||'',_0x341720=_0x3037a2[_0x17114e]?.['trim']()||'';/^\d+$/['test'](_0x3037a2[_0x17114e]?.['trim']()||'')&&(_0x4f05b8=_0x3037a2[_0x17114e]?.['trim']()||'',_0x341720=_0x3037a2[_0x17114e+0x1]?.['trim']()||'');if(_0x3037a2[_0x2e44bb])_0x5d335d['table']['push']([_0x4f05b8,_0x341720,_0x3037a2[_0x2e44bb]?.['trim']()||'',_0x3037a2[_0x1d5a31]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',_0x3037a2[_0x443541]?.['replace'](/\s+/g,'\x20')['trim']()||'']);else break;}return {'success':!![],'message':'Successfully\x20converted\x20COAEP\x20datatable.','data':_0x5d335d};}catch(_0x1e6c81){return {'success':![],'message':'Error\x20parsing\x20COAEP\x20table','error':_0x1e6c81};}}async['toJson'](){const _0x172c93=[],_0x16d1d3=[],_0x5b20a9='COAEPDT_TO_JSON';try{await this['assertInitialized']();const _0x2f43bf={'faculty':this['faculty'],'course':this['course'],'sy':this['sy'],'semester':this['semester'],'co':[]};let _0x4c0c2a=null,_0x3388c9='',_0x5c88c8='';this['table']['forEach']((_0x4841db,_0x46b6dd)=>{if(_0x46b6dd===0x0&&!_0x4841db[0x1])_0x16d1d3['push']({'error':'Cannot\x20have\x20empty\x20CO\x20Statement\x20in\x20first\x20row.','row':0x0,'column':0x1,'from':_0x5b20a9});_0x4841db[0x1]&&(_0x3388c9='',_0x5c88c8='');const _0x476b1e=_0x4841db[0x1],_0x38063c=_0x4841db[0x2],_0x42e99b=_0x4841db[0x3]||_0x3388c9,_0x2f5ecb=_0x4841db[0x4]||_0x5c88c8;if(!_0x38063c)_0x16d1d3['push']({'error':'Cannot\x20have\x20empty\x20ILO.','row':0x1,'column':0x2,'from':_0x5b20a9});if(!_0x42e99b)_0x16d1d3['push']({'error':'Cannot\x20have\x20empty\x20Assessment\x20Tool.','row':_0x46b6dd,'column':0x3,'from':_0x5b20a9});if(!_0x2f5ecb)_0x16d1d3['push']({'error':'Cannot\x20have\x20empty\x20Performance\x20Target.','row':_0x46b6dd,'column':0x4,'from':_0x5b20a9});if(_0x4841db[0x1]){const {cognitive_level:_0x382ee0,taxonomy_level:_0x246e62,verb:_0x441830}=extractFromObjective(_0x476b1e),_0x218153={'statement':_0x476b1e,'ilo':[],'taxonomy_level':_0x246e62,'cognitive_level':_0x382ee0,'verb':_0x441830};_0x4c0c2a=_0x218153,_0x2f43bf['co']['push'](_0x218153);}const {cognitive_level:_0xc94cd4,taxonomy_level:_0x153177,verb:_0x15a53d}=extractFromObjective(_0x38063c),{performance_target:_0x52f81e,passing_score:_0x30dab6}=performaceTarget(_0x2f5ecb),_0x3ac93d={'statement':_0x38063c,'assessment_tool':_0x42e99b,'performance_target':_0x52f81e,'passing_score':_0x30dab6,'cognitive_level':_0xc94cd4,'taxonomy_level':_0x153177,'verb':_0x15a53d};_0x4c0c2a['ilo']['push'](_0x3ac93d);});if(_0x16d1d3['length'])return _0x16d1d3['push']({'error':'Converted\x20COAEP\x20datatable\x20to\x20JSON,\x20but\x20with\x20errors.','from':_0x5b20a9}),{'success':![],'message':'Converted\x20COAEP\x20datatable\x20to\x20JSON,\x20but\x20with\x20errors.','data':{'jsonObj':_0x2f43bf,'validMsgs':_0x172c93,'tableErrors':_0x16d1d3}};return _0x172c93['push']('Successfully\x20converted\x20COAEP\x20datatable\x20to\x20JSON.'),{'success':!![],'message':'Successfully\x20converted\x20COAEP\x20datatable\x20to\x20JSON','data':{'jsonObj':_0x2f43bf,'validMsgs':_0x172c93,'tableErrors':_0x16d1d3}};}catch(_0x195ea9){return _0x16d1d3['push']({'error':'Error\x20converting\x20COAEP\x20datatable\x20to\x20JSON','from':_0x5b20a9}),{'success':![],'message':'Error\x20converting\x20COAEP\x20datatable\x20to\x20JSON','error':_0x195ea9,'data':{'jsonObj':null,'tableErrors':_0x16d1d3}};}}['validateObjectiveGrammar'](_0x2fd2a,_0x372ce9,_0x46efdd,_0x4638b9){const {cognitive_level:_0x1b6601,taxonomy_level:_0x57adb1,verb:_0x4157ef}=extractFromObjective(_0x2fd2a),_0x307444=[];if(!_0x1b6601)_0x307444['push']('cognitive_level');if(!_0x57adb1)_0x307444['push']('taxonomy_level');if(!_0x4157ef)_0x307444['push']('verb');if(!_0x307444['length'])return;_0x4638b9['push']({'error':'Cannot\x20find\x20fields:\x20'+_0x307444['join'](',\x20')+'.','row':_0x372ce9,'column':_0x46efdd,'from':this['name']['toUpperCase']()+'_OBJ_GRAMMAR'});}}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const getEnrolledStudentsFromXLSX=async _0x5a6e16=>{try{const _0x4d9fc8=await convertToCSVFile(_0x5a6e16),_0x486f74=new FormData();_0x486f74['append']('csvFile',_0x4d9fc8);const _0x396600={'success':!![],'message':'Successfully\x20parsed\x20Enrolled\x20Students.','data':{'body':_0x486f74}};return Promise['resolve'](_0x396600);}catch(_0x40e73d){return Promise['reject']({'success':![],'message':'Error\x20parsing\x20Enrolled\x20Students.','error':_0x40e73d});}};
|
|
59
|
-
|
|
60
|
-
class Client{['BASE_URL'];constructor(_0x16d716){this['BASE_URL']=_0x16d716;}['Parser'](){return {'curriculum':async _0x4d2d34=>{const _0x3adcdd=await uploadCurriculum(this['BASE_URL'],_0x4d2d34);return _0x3adcdd;},'courseOffering':async _0x3a31ed=>{const _0x27e920=await uploadCourseOffering(this['BASE_URL'],_0x3a31ed);return _0x27e920;},'coaep':async(_0x39f30e,_0x4f9212)=>{const _0xeb67dc=await uploadCOAEP(this['BASE_URL'],_0x39f30e,_0x4f9212);return _0xeb67dc;},'enrolledStudent':async _0x193966=>{const _0x514d9d=await uploadEnrolledStudent(this['BASE_URL'],_0x193966);return _0x514d9d;},'classlist':async(_0x20b849,_0x3f5d48,_0x42a35b)=>{const _0x5c3168=await uploadClassList(this['BASE_URL'],_0x20b849,_0x3f5d48,_0x42a35b);return _0x5c3168;},'assessmentData':async _0x382dba=>{const _0x5b3a57=await uploadAssessmentData(this['BASE_URL'],_0x382dba);return _0x5b3a57;},'deptFaculty':async _0x2749c0=>{const _0x6b5ed5=await uploadDeptFaculty(this['BASE_URL'],_0x2749c0);return _0x6b5ed5;},'poaep':async(_0x5601ac,_0x26690a,_0x415690,_0x4067ee)=>{const _0xd13e4e=await uploadPOAEP(this['BASE_URL'],_0x5601ac,_0x26690a,_0x415690,_0x4067ee);return _0xd13e4e;},'getAssessmentDataFromXLSX':getAssessmentDataFromXLSX,'getClassListFromXLSX':getClassListFromXLSX,'getCOAEPFromCSV':getCOAEPFromCSV,'getCOAEPFromXLSX':getCOAEPFromXLSX,'getCourseOfferingFromXLSX':getCourseOfferingFromXLSX,'getCurriculumFromXLSX':getCurriculumFromXLSX,'getPOAEPFromCSV':getPOAEPFromCSV,'getPOAEPFromXLSX':getPOAEPFromXLSX,'getDeptFacultyFromXLSX':getDeptFacultyFromXLSX,'getEnrolledStudentsFromXLSX':getEnrolledStudentsFromXLSX};}}
|
|
56
|
+
class Client{['BASE_URL'];constructor(_0x258e2e){this['BASE_URL']=_0x258e2e;}['Parser'](){return {'curriculum':async _0x536706=>{const _0x2fb006=await uploadCurriculum(this['BASE_URL'],_0x536706);return _0x2fb006;},'courseOffering':async _0x4f14d3=>{const _0x1d7247=await uploadCourseOffering(this['BASE_URL'],_0x4f14d3);return _0x1d7247;},'coaep':async(_0x56b3a2,_0x4b0726)=>{const _0x1c43b1=await uploadCOAEP(this['BASE_URL'],_0x56b3a2,_0x4b0726);return _0x1c43b1;},'enrolledStudent':async _0x35c1d7=>{const _0x2b178d=await uploadEnrolledStudent(this['BASE_URL'],_0x35c1d7);return _0x2b178d;},'classlist':async(_0x1faf00,_0x28e518,_0x25eb64)=>{const _0x5a0c78=await uploadClassList(this['BASE_URL'],_0x1faf00,_0x28e518,_0x25eb64);return _0x5a0c78;},'assessmentData':async _0x1074e8=>{const _0x3dc482=await uploadAssessmentData(this['BASE_URL'],_0x1074e8);return _0x3dc482;},'deptFaculty':async _0x41676e=>{const _0x2d2bbc=await uploadDeptFaculty(this['BASE_URL'],_0x41676e);return _0x2d2bbc;},'poaep':async(_0x273c6b,_0x73f8e1,_0xc10c48,_0xf60382)=>{const _0x1252f8=await uploadPOAEP(this['BASE_URL'],_0x273c6b,_0x73f8e1,_0xc10c48,_0xf60382);return _0x1252f8;},'CoaepDT':CoaepDT};}}
|
|
61
57
|
|
|
62
58
|
export { Client as default };
|
package/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoaepDT } from "./DataTable/models/CoaepDT";
|
|
2
2
|
export default class Client {
|
|
3
3
|
private BASE_URL;
|
|
4
4
|
constructor(url: string);
|
|
@@ -25,35 +25,6 @@ export default class Client {
|
|
|
25
25
|
* Functions that parse then return the payload
|
|
26
26
|
* instead of directly calling the backend and returning the response
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
assessmentData: import("./types/assessmentdata").AssessmentData;
|
|
30
|
-
}>>;
|
|
31
|
-
getClassListFromXLSX: (xls: File) => Promise<import("./types/parserResult").ParserResult<{
|
|
32
|
-
enrolledCourses: import("./types/classList").classList[];
|
|
33
|
-
}>>;
|
|
34
|
-
getCOAEPFromCSV: typeof getCOAEPFromCSV;
|
|
35
|
-
getCOAEPFromXLSX: typeof getCOAEPFromXLSX;
|
|
36
|
-
getCourseOfferingFromXLSX: (xls: File) => Promise<import("./types/parserResult").ParserResult<{
|
|
37
|
-
courseOfferings: import("./types/courseOffering").CourseOffering[];
|
|
38
|
-
}>>;
|
|
39
|
-
getCurriculumFromXLSX: (xls: File) => Promise<import("./types/parserResult").ParserResult<{
|
|
40
|
-
curriculums: import("./types/curriculum").CurriculumCourses[];
|
|
41
|
-
}>>;
|
|
42
|
-
getPOAEPFromCSV: (csv: string) => Promise<import("./types/parserResult").ParserResult<{
|
|
43
|
-
POAEP: import("./types/poaep").PO[];
|
|
44
|
-
}>>;
|
|
45
|
-
getPOAEPFromXLSX: (xls: File) => Promise<import("./types/parserResult").ParserResult<{
|
|
46
|
-
POAEP: import("./types/poaep").PO[];
|
|
47
|
-
}>>;
|
|
48
|
-
/**
|
|
49
|
-
* Functions that converts the xls to csv
|
|
50
|
-
* then returns the csv as formdata
|
|
51
|
-
*/
|
|
52
|
-
getDeptFacultyFromXLSX: (xls: File) => Promise<import("./types/parserResult").ParserResult<{
|
|
53
|
-
body: FormData;
|
|
54
|
-
}>>;
|
|
55
|
-
getEnrolledStudentsFromXLSX: (xls: File) => Promise<import("./types/parserResult").ParserResult<{
|
|
56
|
-
body: FormData;
|
|
57
|
-
}>>;
|
|
28
|
+
CoaepDT: typeof CoaepDT;
|
|
58
29
|
};
|
|
59
30
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|