@obe-loms/coms-parser 1.6.7 → 1.6.9
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.
|
@@ -2,6 +2,7 @@ import { COAEP } from "../../types/coaep";
|
|
|
2
2
|
import { DataTable } from "./DataTable";
|
|
3
3
|
import { ParserResult } from "../types/ParserResult";
|
|
4
4
|
import DataTableException from "../types/DataTableException";
|
|
5
|
+
import { CoaepRow } from "../types/CoaepDTRow";
|
|
5
6
|
/**
|
|
6
7
|
* Represents a row in the COAEP DataTable.
|
|
7
8
|
*
|
|
@@ -12,28 +13,6 @@ import DataTableException from "../types/DataTableException";
|
|
|
12
13
|
* @return {string|null } row [3] - Assessment Tool
|
|
13
14
|
* @return {[number | null, number | null] | null} row [4] - [PerfTarget, PassingScore]
|
|
14
15
|
*/
|
|
15
|
-
export type CoaepRow = [
|
|
16
|
-
string | null,
|
|
17
|
-
// CO No
|
|
18
|
-
[
|
|
19
|
-
string | null,
|
|
20
|
-
string | null,
|
|
21
|
-
string | null,
|
|
22
|
-
string | null
|
|
23
|
-
] | null,
|
|
24
|
-
[
|
|
25
|
-
string | null,
|
|
26
|
-
string | null,
|
|
27
|
-
string | null,
|
|
28
|
-
string | null
|
|
29
|
-
],
|
|
30
|
-
// ILO Cognitive Level, Taxonomy Level, Verb, Statement
|
|
31
|
-
string | null,
|
|
32
|
-
[
|
|
33
|
-
number | null,
|
|
34
|
-
number | null
|
|
35
|
-
]
|
|
36
|
-
];
|
|
37
16
|
export declare class CoaepDT extends DataTable<COAEP, CoaepRow> {
|
|
38
17
|
faculty: string | null;
|
|
39
18
|
course: string | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Taxonomy from "../../types/Taxonomy";
|
|
2
|
+
/**
|
|
3
|
+
* Represents the CO number column in the internal COAEP DataTable.
|
|
4
|
+
*/
|
|
5
|
+
export type CoaepDT_No = string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Represents the CO statement column in the internal COAEP DataTable.
|
|
8
|
+
*/
|
|
9
|
+
export type CoaepDT_CO = [string | null, string | null, string | null, string | null] | null;
|
|
10
|
+
export type CoaepDT_CogLvl = "I" | "E" | "D" | null;
|
|
11
|
+
export type CoaepDT_TaxLvl = Taxonomy | null;
|
|
12
|
+
export type CoaepDT_Verb = string | null;
|
|
13
|
+
export type CoaepDT_Rest = string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Represents the ILO statement column in the internal COAEP DataTable.
|
|
16
|
+
*/
|
|
17
|
+
export type CoaepDT_ILO = [
|
|
18
|
+
CoaepDT_CogLvl,
|
|
19
|
+
CoaepDT_TaxLvl,
|
|
20
|
+
CoaepDT_Verb,
|
|
21
|
+
CoaepDT_Rest
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Assessment Tool column in the internal COAEP DataTable.
|
|
25
|
+
*/
|
|
26
|
+
export type CoaepDT_AT = string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Represents the Performance Target and Passing Score tuple column in the internal COAEP DataTable.
|
|
29
|
+
* */
|
|
30
|
+
export type CoaepDT_PT = [number | null, number | null];
|
|
31
|
+
/**
|
|
32
|
+
* Represents a row in the internal COAEP DataTable.
|
|
33
|
+
* @column 0: CO Number: string | null
|
|
34
|
+
* @column 1: CO Statement: [string | null, string | null, string | null, string | null] | null
|
|
35
|
+
* @column 2: ILO Statement: [string | null, string | null, string | null, string | null]
|
|
36
|
+
* @column 3: Assessment Tool: string | null
|
|
37
|
+
* @column 4: Performance Target, Passing Score: [number | null, number | null]
|
|
38
|
+
*/
|
|
39
|
+
export type CoaepRow = [
|
|
40
|
+
CoaepDT_No,
|
|
41
|
+
CoaepDT_CO,
|
|
42
|
+
CoaepDT_ILO,
|
|
43
|
+
CoaepDT_AT,
|
|
44
|
+
CoaepDT_PT
|
|
45
|
+
];
|
package/bundle.js
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import _0x2ee671 from 'papaparse';
|
|
2
|
+
import * as _0x4c00a5 from 'xlsx';
|
|
3
3
|
|
|
4
|
-
function parseCurriculum(
|
|
4
|
+
function parseCurriculum(_0x4a30d8){let _0x561e92='',_0x1b9f78='',_0x9be93=0x0,_0x375ccc=null;const _0x5f4b16=[];return _0x2ee671['parse'](_0x4a30d8,{'skipEmptyLines':!![],'complete':_0x36910e=>{_0x36910e['data']['forEach'](_0x2dba46=>{const _0x354d44=_0x2dba46['map'](_0x1a7a7e=>(_0x1a7a7e??'')['toString']()['trim']()),_0x376f27=_0x354d44[0x0]??'';if(_0x376f27['includes']('Rev#')){const _0xde5cd4=_0x376f27['match'](/([A-Z0-9]+)\s*-\s*.*:\s*(.*?)\s+Rev#\s*(\d+)/i);_0xde5cd4&&(_0x561e92=_0xde5cd4[0x1]?.['trim']()??'',_0x1b9f78=_0xde5cd4[0x2]?.['trim']()??'',_0x9be93=parseInt(_0xde5cd4[0x3]??'0',0xa));return;}if(/FIRST YEAR/i['test'](_0x376f27)){_0x375ccc=0x1;return;}if(/SECOND YEAR/i['test'](_0x376f27)){_0x375ccc=0x2;return;}if(/THIRD YEAR/i['test'](_0x376f27)){_0x375ccc=0x3;return;}if(/FOURTH YEAR/i['test'](_0x376f27)){_0x375ccc=0x4;return;}if(/FIFTH YEAR/i['test'](_0x376f27)){_0x375ccc=0x5;return;}if(/First Semester/i['test'](_0x376f27)||/Second Semester/i['test'](_0x376f27)||/Summer/i['test'](_0x376f27))return;const _0x32709a=[{'sem':0x1,'offset':0x0},{'sem':0x2,'offset':0x6},{'sem':0x3,'offset':0xc}];_0x32709a['forEach'](({sem:_0x1d8bd3,offset:_0x1ebec7})=>{const _0x136cb2=_0x354d44[_0x1ebec7]??'',_0x1c7998=_0x354d44[_0x1ebec7+0x1]??'',_0xbd5f64=_0x354d44[_0x1ebec7+0x2]??'',_0x364382=_0x354d44[_0x1ebec7+0x3]??'',_0x52dce9=_0x354d44[_0x1ebec7+0x4]??'';_0x136cb2&&_0x375ccc&&_0x5f4b16['push']({'curr_id':_0x561e92,'program_name':_0x1b9f78,'revision_no':_0x9be93,'year_level':_0x375ccc,'sem':_0x1d8bd3,'course_id':_0x136cb2,'course_desc':_0x1c7998,'total_units':_0xbd5f64,'lec_unit':_0x364382,'lab_unit':_0x52dce9});});});}}),_0x5f4b16;}
|
|
5
5
|
|
|
6
|
-
function convertToCSVFile(
|
|
6
|
+
function convertToCSVFile(_0x572c94,_0x1196b6){return new Promise((_0x346376,_0x4e886a)=>{const _0x4a3632=new FileReader();_0x4a3632['onload']=_0xd02ac3=>{const _0xb8b61f=_0xd02ac3['target']?.['result'];if(!_0xb8b61f){_0x4e886a(new Error('Failed\x20to\x20read\x20file'));return;}try{const _0x3e3e3e=_0x4c00a5['read'](_0xb8b61f,{'type':'array'});!_0x1196b6&&(_0x1196b6=_0x3e3e3e['SheetNames'][0x0]);if(!_0x1196b6){_0x4e886a(new Error('No\x20sheets\x20found\x20in\x20workbook'));return;}const _0x4cca45=_0x3e3e3e['Sheets'][_0x1196b6];if(!_0x4cca45){_0x4e886a(new Error('No\x20sheets\x20found\x20in\x20worksheet'));return;}const _0x3009bb=_0x4c00a5['utils']['sheet_to_csv'](_0x4cca45,{'strip':!![]}),_0x83890b=_0x572c94['name']['replace'](/\.[^/.]+$/,'.csv'),_0x5149c4=new File([_0x3009bb],_0x83890b,{'type':'text/csv','lastModified':Date['now']()});_0x346376(_0x5149c4);}catch(_0x393d4a){_0x4e886a(_0x393d4a);}},_0x4a3632['onerror']=()=>{_0x4e886a(new Error('File\x20reading\x20failed'));},_0x4a3632['readAsArrayBuffer'](_0x572c94);});}
|
|
7
7
|
|
|
8
|
-
async function uploadCurriculum(
|
|
8
|
+
async function uploadCurriculum(_0x244960,_0x247e11){try{const _0x5e479f=await convertToCSVFile(_0x247e11),_0x1b5b77=await _0x5e479f['text'](),_0x50c247=parseCurriculum(_0x1b5b77),_0x244616=_0x2ee671['unparse'](_0x50c247),_0x21b218=new File([_0x244616],_0x5e479f['name'],{'type':'text/csv'}),_0x2fdda6=new FormData();_0x2fdda6['append']('csvFile',_0x21b218);const _0x3c4658=await fetch(_0x244960+'/curr-courses/upload',{'method':'POST','body':_0x2fdda6});if(!_0x3c4658['ok']){const _0xa458aa=await _0x3c4658['json']();throw _0xa458aa;}return _0x3c4658['json']();}catch(_0x2f95cc){throw _0x2f95cc;}}
|
|
9
9
|
|
|
10
|
-
function parseCourseOffering(
|
|
10
|
+
function parseCourseOffering(_0xd2419e){let _0xc29057='',_0x50ffd4='';const _0x43a73f=[],_0x4d60bf=_0x2ee671['parse'](_0xd2419e,{'header':![],'skipEmptyLines':!![],'delimiter':','}),_0x3fbb7e=_0x4d60bf['data'];for(let _0x2cbcb8=0x0;_0x2cbcb8<Math['min'](0x5,_0x3fbb7e['length']);_0x2cbcb8++){const _0x19c5b4=_0x3fbb7e[_0x2cbcb8];if(_0x19c5b4&&_0x19c5b4['length']>0x0){const _0x3fa69b=_0x19c5b4[0x0]?.['toString']()||'',_0x23c4bb=_0x3fa69b['match'](/(First|Second)\s+Sem\s+S\/Y\s+(\d{4}-\d{4})/i);if(_0x23c4bb){_0xc29057=_0x23c4bb[0x1]?.['toLowerCase']()==='first'?'1':'2';if(_0x23c4bb[0x2]){const _0x1ed245=_0x23c4bb[0x2]['match'](/(\d{2})(\d{2})-(\d{2})(\d{2})/);_0x1ed245&&_0x1ed245[0x2]&&_0x1ed245[0x4]&&(_0x50ffd4=_0x1ed245[0x2]+_0x1ed245[0x4]);}}}}let _0x313f9f=-1;for(let _0x17753e=0x0;_0x17753e<_0x3fbb7e['length'];_0x17753e++){const _0x269a83=_0x3fbb7e[_0x17753e];if(_0x269a83&&_0x269a83['some'](_0x22fffe=>_0x22fffe?.['toString']()['toUpperCase']()['includes']('CODE'))){_0x313f9f=_0x17753e;break;}}if(_0x313f9f===-1)throw new Error('Could\x20not\x20find\x20header\x20row\x20in\x20CSV\x20data');let _0x400214={'code':'','description':'','unit':0x0};for(let _0x715227=_0x313f9f+0x1;_0x715227<_0x3fbb7e['length'];_0x715227++){const _0x494fe6=_0x3fbb7e[_0x715227];if(!_0x494fe6||_0x494fe6['length']<0x8)continue;const _0x124000=_0x494fe6[0x1]?.['toString']()['trim']()||'',_0xc663b6=_0x494fe6[0x4]?.['toString']()['trim']()||'',_0x2a62ee=_0x494fe6[0x5]?.['toString']()['trim']()||'',_0x4846e6=_0x494fe6[0x6]?.['toString']()['trim']()||'',_0xc796a0=_0x494fe6[0x7]?.['toString']()['trim']()||'',_0xf705ef=_0x494fe6[0x3]?.['toString']()['trim']()||'';let _0x25d819=_0x494fe6[0x0]?.['toString']()['trim']()||'',_0x4d50e1=_0x494fe6[0x2]?.['toString']()['trim']()||'';if(!_0x124000)continue;if(!_0x25d819)_0x25d819=_0x400214['code'];if(!_0x4d50e1)_0x4d50e1=_0x400214['description'];let _0x4fe9e2=_0x400214['unit'];if(_0xf705ef){const _0x1cc94a=_0xf705ef['match'](/(\d+)/);_0x1cc94a&&_0x1cc94a[0x1]&&(_0x4fe9e2=parseInt(_0x1cc94a[0x1],0xa));}const _0x48b63f={'sem':_0xc29057,'school_year':_0x50ffd4,'code':_0x25d819,'course_no':_0x124000,'course_desc':_0x4d50e1,'unit':_0x4fe9e2,'time':_0xc663b6,'days':_0x2a62ee,'faculty':_0x4846e6,'room':_0xc796a0};_0x400214['code']=_0x25d819,_0x400214['description']=_0x4d50e1,_0x400214['unit']=_0x4fe9e2,_0x43a73f['push'](_0x48b63f);}return _0x43a73f;}
|
|
11
11
|
|
|
12
|
-
async function uploadCourseOffering(
|
|
12
|
+
async function uploadCourseOffering(_0x135cc3,_0x3b002b){try{const _0x3adb81=await convertToCSVFile(_0x3b002b),_0x6094b=await _0x3adb81['text'](),_0x3db5c5=parseCourseOffering(_0x6094b),_0x482e26=_0x2ee671['unparse'](_0x3db5c5),_0x58e63d=new File([_0x482e26],_0x3adb81['name'],{'type':'text/csv'}),_0x24474a=new FormData();_0x24474a['append']('csvFile',_0x58e63d);const _0x4c9f3d=await fetch(_0x135cc3+'/course-offerings/upload',{'method':'POST','body':_0x24474a});if(!_0x4c9f3d['ok']){const _0x11b225=await _0x4c9f3d['json']();throw _0x11b225;}return _0x4c9f3d['json']();}catch(_0x34bbf1){throw _0x34bbf1;}}
|
|
13
13
|
|
|
14
|
-
function performaceTarget(
|
|
14
|
+
function performaceTarget(_0x44ab17){if(!_0x44ab17)return {'performance_target':null,'passing_score':null};const _0x2e0a65=_0x44ab17['match'](/\d+/g);return {'performance_target':_0x2e0a65?.[0x0]?parseInt(_0x2e0a65[0x0],0xa):null,'passing_score':_0x2e0a65?.[0x1]?parseInt(_0x2e0a65[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(_0x49c44a){let _0x523b10={'headerRowIndex':-1,'coIdx':-1,'iloIdx':-1,'assessToolIdx':-1,'perfTargetIdx':-1};for(let _0x10cb7a=0x0;_0x10cb7a<Math['min'](_0x49c44a['length'],0x14);_0x10cb7a++){const _0x3b7d3e=(_0x49c44a[_0x10cb7a]??[])['map'](_0x5eddf1=>_0x5eddf1['toLowerCase']()['trim']()),_0x15b199=_0x3b7d3e['findIndex'](_0x349247=>HEADERS$1['co']['some'](_0xab1430=>_0x349247['includes'](_0xab1430))),_0x2dc50f=_0x3b7d3e['findIndex'](_0x5ace76=>HEADERS$1['ilo']['some'](_0x236f6b=>_0x5ace76['includes'](_0x236f6b))),_0x4541f5=_0x3b7d3e['findIndex'](_0x52be79=>HEADERS$1['assessTool']['some'](_0x2a8da7=>_0x52be79['includes'](_0x2a8da7))),_0x505cf3=_0x3b7d3e['findIndex'](_0xbd3fdf=>HEADERS$1['perfTarget']['some'](_0x3ec8f2=>_0xbd3fdf['includes'](_0x3ec8f2))),_0x598a53=[_0x15b199,_0x2dc50f,_0x4541f5,_0x505cf3]['filter'](_0x158cf0=>_0x158cf0!==-1)['length'];if(_0x598a53>=0x3){_0x523b10={'headerRowIndex':_0x10cb7a,'coIdx':_0x15b199,'iloIdx':_0x2dc50f,'assessToolIdx':_0x4541f5,'perfTargetIdx':_0x505cf3};break;}}return _0x523b10;}
|
|
17
17
|
|
|
18
|
-
function extractFromObjective(
|
|
18
|
+
function extractFromObjective(_0xa808ae){const _0x53173b={'cognitive_level':null,'taxonomy_level':null,'verb':null,'rest':_0xa808ae['trim']()},_0x1a45ba=_0xa808ae['match'](/^\((I|E|D)\)/);_0x1a45ba&&(_0x53173b['cognitive_level']=_0x1a45ba[0x1],_0x53173b['rest']=_0xa808ae['slice'](_0x1a45ba[0x0]['length'])['trim']());const _0x2d7f95=_0x53173b['rest']?.['match'](/^(.*?)\:/);_0x2d7f95&&(_0x53173b['taxonomy_level']=_0x2d7f95[0x1]['trim']()['toLowerCase']()||null,_0x53173b['rest']=_0x53173b['rest']?.['slice'](_0x2d7f95[0x0]['length'])['trim']()||null);const _0x4e3633=_0x53173b['rest']?.['match'](/(?:shall|will)\s+([a-zA-Z-]+)/);if(_0x4e3633)_0x53173b['verb']=_0x4e3633[0x1]['trim']()['toLowerCase']()||null;else {const _0x400ba5=_0x53173b['rest']?.['match'](/^\w+/);if(_0x400ba5)_0x53173b['verb']=_0x400ba5[0x0]['trim']()['toLowerCase']()||null;}return _0x53173b;}
|
|
19
19
|
|
|
20
|
-
function parseCOAEP(
|
|
20
|
+
function parseCOAEP(_0x36ff8b){const _0x5e1daf=_0x2ee671['parse'](_0x36ff8b,{'skipEmptyLines':![]})['data'],_0x557459={'COAEP':{'faculty':null,'course':null,'sy':null,'semester':null,'co':[]}},{headerRowIndex:_0x2617d1,coIdx:_0x36e410,iloIdx:_0x302326,assessToolIdx:_0x324685,perfTargetIdx:_0x311114}=getCoaepHeader(_0x5e1daf);if(_0x2617d1===-1)return {'error':'Could\x20not\x20auto-detect\x20header\x20row.','message':'Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.'};_0x5e1daf['forEach'](_0x272e0d=>{const _0x441233=_0x272e0d['indexOf']('Name\x20of\x20Faculty:'),_0xaff733=_0x272e0d['indexOf']('School\x20Year'),_0x1e576e=_0x272e0d['indexOf']('Course:'),_0x4f988e=_0x272e0d['indexOf']('Semester');_0x441233!==-1&&(_0x557459['COAEP']['faculty']=_0x272e0d[_0x441233+0x1]?.['trim']()||_0x557459['COAEP']['faculty']);_0xaff733!==-1&&(_0x557459['COAEP']['sy']=_0x272e0d[_0xaff733+0x1]?.['trim']()||_0x557459['COAEP']['sy']);_0x1e576e!==-1&&(_0x557459['COAEP']['course']=_0x272e0d[_0x1e576e+0x1]?.['trim']()||_0x557459['COAEP']['course']);if(_0x4f988e!==-1){const _0x3cb09d=_0x272e0d[_0x4f988e+0x1]?.['trim']()||'',_0x1fd659=_0x3cb09d['match'](/\d+/)?.[0x0];_0x557459['COAEP']['semester']=_0x1fd659?parseInt(_0x1fd659,0xa):_0x557459['COAEP']['semester'];}});let _0x432db6=null;return _0x5e1daf['forEach']((_0x273f06,_0x57b81a)=>{if(_0x57b81a<=_0x2617d1)return;let _0x39ade6=_0x273f06[_0x36e410-0x1]?.['trim']()||'',_0x5b799c=_0x273f06[_0x36e410]?.['trim']()||'';/^\d+$/['test'](_0x273f06[_0x36e410]?.['trim']()||'')&&(_0x39ade6=_0x273f06[_0x36e410]?.['trim']()||'',_0x5b799c=_0x273f06[_0x36e410+0x1]?.['trim']()||'');const _0x4f113b=_0x273f06[_0x302326]?.['trim']()||'',_0x223272=_0x273f06[_0x324685]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',_0x34a560=_0x273f06[_0x311114]?.['replace'](/\s+/g,'\x20')['trim']()||'';if(_0x39ade6&&/^\d+$/['test'](_0x39ade6)){_0x432db6&&_0x557459['COAEP']['co']['push'](_0x432db6);const _0x458a7e=_0x5b799c,{verb:_0x28e7f5,cognitive_level:_0x27d162,taxonomy_level:_0x2182c6}=extractFromObjective(_0x458a7e);if(!_0x28e7f5)return {'error':'Could\x20not\x20find\x20verb.','message':'Please\x20ensure\x20the\x20Course\x20Outcome\x20#'+_0x39ade6+'\x20is\x20in\x20the\x20correct\x20format.'};_0x432db6={'statement':_0x458a7e,'ilo':[],'verb':_0x28e7f5,'cognitive_level':_0x27d162,'taxonomy_level':_0x2182c6};}if(_0x432db6&&_0x4f113b&&_0x34a560){const _0x237e8f=_0x4f113b['replace'](/^ILO\d+[:.]?\s*/,'');if(_0x237e8f['match'](/^(Revision|Prepared|Date|Approved|Effectivity|Page)/i)||_0x237e8f['length']<0xa)return;let _0xe4a9c7=_0x223272;if(!_0xe4a9c7&&_0x237e8f['includes'](':')){const _0x4aadea=_0x237e8f['match'](/^ILO\d+:\s*(.+?)(?:\s*\(|$)/);_0x4aadea&&(_0xe4a9c7=_0x4aadea[0x1]?.['trim']()||'');}const {performance_target:_0x2822e3,passing_score:_0x60ddd7}=performaceTarget(_0x34a560),{verb:_0x50e96b,cognitive_level:_0x5bceef,taxonomy_level:_0x276628}=extractFromObjective(_0x237e8f);_0x432db6['ilo']['push']({'statement':_0x237e8f,'assessment_tool':_0xe4a9c7,'performance_target':_0x2822e3,'passing_score':_0x60ddd7,'verb':_0x50e96b,'cognitive_level':_0x5bceef,'taxonomy_level':_0x276628});}}),_0x432db6&&_0x557459['COAEP']['co']['push'](_0x432db6),_0x557459;}
|
|
21
21
|
|
|
22
|
-
async function uploadCOAEP(
|
|
22
|
+
async function uploadCOAEP(_0x203684,_0x3bc07d,_0x2e01fa){try{const _0x2513b5=await convertToCSVFile(_0x3bc07d),_0x2ae566=await _0x2513b5['text'](),_0x2f2474=parseCOAEP(_0x2ae566);console['log'](_0x2f2474);const _0x31bb68=await fetch(_0x203684+'/coaeps/upload?course_id='+_0x2e01fa,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x2f2474)});if(!_0x31bb68['ok']){const _0x1f4cac=await _0x31bb68['json']();throw _0x1f4cac;}return _0x31bb68['json']();}catch(_0x5a79a7){throw _0x5a79a7;}}
|
|
23
23
|
|
|
24
|
-
async function uploadEnrolledStudent(
|
|
24
|
+
async function uploadEnrolledStudent(_0x29bc9e,_0xd1df3a){try{const _0x167754=await convertToCSVFile(_0xd1df3a),_0x12796e=new FormData();_0x12796e['append']('csvFile',_0x167754);const _0x2ad43d=await fetch(_0x29bc9e+'/enrolled-students/upload',{'method':'POST','body':_0x12796e});if(!_0x2ad43d['ok']){const _0x782015=await _0x2ad43d['json']();throw _0x782015;}return _0x2ad43d['json']();}catch(_0x416bd6){throw _0x416bd6;}}
|
|
25
25
|
|
|
26
|
-
function parseClassList(
|
|
26
|
+
function parseClassList(_0x4deb09){const _0x23cd5c=_0x2ee671['parse'](_0x4deb09,{'skipEmptyLines':!![]})['data'];let _0x5b61cc='',_0x6e9f20='',_0xe3f284='';const _0x37f437=[];return _0x23cd5c['forEach'](_0x1ce013=>{const _0x3a82bc=_0x1ce013['map'](_0x4eaa30=>(_0x4eaa30??'')['toString']()['trim']()),_0xddd618=_0x3a82bc[0x0]??'';if(_0xddd618['startsWith']('Course\x20No:')){const _0x3d5110=_0xddd618['replace']('Course\x20No:','')['trim'](),_0x1b6282=_0x3d5110['split'](/\s+/);_0xe3f284=_0x1b6282[0x0]??'';const [_0xa2ea04,_0x339db2]=(_0x1b6282[0x1]??'')['split']('-');_0x6e9f20=_0xa2ea04??'';const _0x329c87=(_0x339db2??'')['match'](/[a-z]$/);_0x5b61cc=_0x329c87?_0x329c87[0x0]:'';}if(/^\d+$/['test'](_0xddd618)){const _0x1f1ef4=_0x3a82bc[0x2]??'';_0x37f437['push']({'subj_code':_0xe3f284,'student_no':_0x1f1ef4,'course_id':_0x6e9f20,'section':_0x5b61cc});}}),{'enrolledCourses':_0x37f437};}
|
|
27
27
|
|
|
28
|
-
async function uploadClassList(
|
|
28
|
+
async function uploadClassList(_0x5e4f0a,_0x4cb825,_0x5ac7d3,_0x311aa4){try{const _0x5dc3a8=await convertToCSVFile(_0x4cb825),_0x103c75=await _0x5dc3a8['text'](),_0x134f9d=parseClassList(_0x103c75),_0x422740='subj_code='+_0x5ac7d3+'&period_id='+_0x311aa4,_0x42536a=await fetch(_0x5e4f0a+'/enrolled-courses/upload?'+_0x422740,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x134f9d)});if(!_0x42536a['ok']){const _0x1dec11=await _0x42536a['json']();throw _0x1dec11;}return _0x42536a['json']();}catch(_0x37d6b7){throw _0x37d6b7;}}
|
|
29
29
|
|
|
30
|
-
function parseAssessmentCsv(
|
|
30
|
+
function parseAssessmentCsv(_0x160b4f){const {data:_0x4a3a2e}=_0x2ee671['parse'](_0x160b4f,{'skipEmptyLines':!![]}),_0x1df575=_0x4a3a2e['filter'](_0x57080f=>_0x57080f['length']>0x0),_0x203fc3=_0x1df575['find'](_0x3ce390=>_0x3ce390['some'](_0x32b567=>_0x32b567?.['includes']('Faculty'))),_0x495aad=_0x203fc3?_0x203fc3['findIndex'](_0x337634=>_0x337634?.['includes']('Faculty')):-1,_0x53cddc=_0x495aad!==-1&&_0x203fc3?_0x203fc3[_0x495aad+0x2]?.['replace'](/"/g,'')['trim']()??'':'',_0xefa449=_0x1df575['find'](_0x4c4166=>_0x4c4166['some'](_0x508524=>_0x508524?.['includes']('Semester'))),_0x550bc2=_0xefa449?_0xefa449['findIndex'](_0x261d1b=>_0x261d1b?.['includes']('Semester')):-1,_0x578f49=_0x550bc2!==-1&&_0xefa449?_0xefa449[_0x550bc2+0x2]?.['trim']()??'':'',_0x5439ac=_0x578f49['includes']('1st')?0x1:_0x578f49['includes']('2nd')?0x2:0x0,_0x15e30a=_0x1df575['find'](_0x1ffe7c=>_0x1ffe7c['some'](_0x5b1a35=>_0x5b1a35?.['includes']('Course\x20&\x20Sec'))),_0x5ec8f3=_0x15e30a?_0x15e30a['findIndex'](_0x950fda=>_0x950fda?.['includes']('Course\x20&\x20Sec')):-1,_0x9548b4=_0x5ec8f3!==-1&&_0x15e30a?_0x15e30a[_0x5ec8f3+0x2]?.['trim']()??'':'';let _0x40442f='',_0x22644f='';if(_0x9548b4){const _0x599518=_0x9548b4['match'](/^([A-Za-z0-9]+)-?([A-Za-z]+)?/);_0x599518&&(_0x40442f=_0x599518[0x1]??'',_0x599518[0x2]&&(_0x22644f=_0x599518[0x2]['replace'](/^OC/i,'')));}const _0xd24fc4=_0x1df575['find'](_0x1ce6ce=>_0x1ce6ce['some'](_0x1022ef=>_0x1022ef?.['includes']('School\x20Year'))),_0x23a03e=_0xd24fc4?_0xd24fc4['findIndex'](_0x142466=>_0x142466?.['includes']('School\x20Year')):-1,_0x3a62ec=_0x23a03e!==-1&&_0xd24fc4?_0xd24fc4[_0x23a03e+0x2]?.['trim']()??'':'';let _0x4e1892=0x0;if(_0x3a62ec){const _0x2558df=_0x3a62ec['match'](/(\d{4})-(\d{4})/);if(_0x2558df){const _0x55bf33=(_0x2558df[0x1]??'')['slice'](0x2),_0x148263=(_0x2558df[0x2]??'')['slice'](0x2);_0x4e1892=parseInt(_0x55bf33+_0x148263,0xa);}}const _0x34b68f={'faculty':_0x53cddc,'course':_0x40442f,'section':_0x22644f,'semester':_0x5439ac,'sy':_0x4e1892},_0x1e6900=_0x1df575['findIndex'](_0x1d4e52=>_0x1d4e52['some'](_0x3e016d=>_0x3e016d?.['trim']()==='CO\x20#'));if(_0x1e6900===-1)throw new Error('CO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x25c7f5=_0x1df575[_0x1e6900+0x1];if(!_0x25c7f5)throw new Error('ILO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x1726b6={};let _0x17ba14=0x1,_0xfa29a0=0x1;for(let _0x30a822=0x3;_0x30a822<_0x25c7f5['length'];_0x30a822++){const _0x13a252=_0x25c7f5[_0x30a822];if(!_0x13a252)continue;const _0x4a43f7='co'+_0x17ba14;if(!_0x1726b6[_0x4a43f7])_0x1726b6[_0x4a43f7]=[];_0x1726b6[_0x4a43f7]['push']('ilo'+_0xfa29a0),_0xfa29a0++,_0xfa29a0>0x3&&(_0x17ba14++,_0xfa29a0=0x1);}const _0x4cefaa=_0x1df575['findIndex'](_0x1afa85=>_0x1afa85['includes']('Name\x20of\x20Students'));if(_0x4cefaa===-1)throw new Error('Student\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x5d25e8=_0x1df575[_0x4cefaa];if(!_0x5d25e8)throw new Error('Student\x20header\x20row\x20is\x20missing');const _0x23e33d=_0x5d25e8['findIndex'](_0xfc4808=>_0xfc4808?.['includes']('Name\x20of\x20Students'));if(_0x23e33d===-1)throw new Error('Name\x20of\x20Students\x20column\x20not\x20found\x20in\x20CSV');const _0x355a7a=_0x23e33d+0x2,_0x49673a=[];for(let _0x413aa0=_0x4cefaa+0x1;_0x413aa0<_0x1df575['length'];_0x413aa0++){const _0x143063=_0x1df575[_0x413aa0];if(!_0x143063)continue;if(_0x143063['some'](_0x36862d=>_0x36862d?.['toUpperCase']()['includes']('TOTAL\x20STUDENTS')||_0x36862d?.['toUpperCase']()['includes']('ACHIEVED\x20THE\x20MINIMUM')||_0x36862d?.['toUpperCase']()['includes']('INACTIVE')||_0x36862d?.['toUpperCase']()['includes']('AVERAGE')))continue;if(!_0x143063[_0x23e33d])continue;const _0x191614=_0x143063[_0x23e33d]['replace'](/"/g,'')['trim'](),_0x7825d8=_0x143063['slice'](_0x355a7a)['map'](_0x594f90=>_0x594f90===null?null:!isNaN(Number(_0x594f90))?parseFloat(_0x594f90):0x0);let _0x19335d=0x0;const _0x4ed0f2={};Object['entries'](_0x1726b6)['forEach'](([_0x1bce7f,_0x160048])=>{const _0x2f3839={};_0x160048['forEach'](_0x4b99c6=>{_0x2f3839[_0x4b99c6]=_0x7825d8[_0x19335d]??0x0,_0x19335d++;}),_0x4ed0f2[_0x1bce7f]={'transmuted_score':_0x2f3839};}),_0x49673a['push']({'student_name':_0x191614,'coaep':_0x4ed0f2});}const _0x2677c5=_0x1df575['find'](_0x55f17f=>_0x55f17f['some'](_0x516d51=>_0x516d51?.['includes']('ACHIEVED\x20THE\x20MINIMUM'))),_0x405032=_0x1df575['find'](_0x26ce6e=>_0x26ce6e['some'](_0x123e5b=>_0x123e5b?.['includes']('AVERAGE'))),_0x51ff94=_0x2677c5?_0x2677c5['slice'](_0x355a7a)['map'](_0x28cf94=>_0x28cf94&&!isNaN(Number(_0x28cf94))?parseInt(_0x28cf94):0x0):[],_0x2262b8=_0x405032?_0x405032['slice'](_0x355a7a)['map'](_0x13fbcb=>_0x13fbcb&&_0x13fbcb!=='#DIV/0!'&&!isNaN(Number(_0x13fbcb))?parseInt(_0x13fbcb):0x0):[],_0x566da7={};let _0x578e1=0x0;return Object['entries'](_0x1726b6)['forEach'](([_0xc6f06,_0x245e59])=>{if(!_0x566da7[_0xc6f06])_0x566da7[_0xc6f06]={};_0x245e59['forEach'](_0x50283b=>{_0x566da7[_0xc6f06][_0x50283b]={'achievedMinimum':_0x51ff94[_0x578e1]??0x0,'average':_0x2262b8[_0x578e1]??0x0},_0x578e1++;});}),{'assessmentData':{'classAssignment':_0x34b68f,'student':_0x49673a,'total':_0x566da7}};}
|
|
31
31
|
|
|
32
|
-
async function uploadAssessmentData(
|
|
32
|
+
async function uploadAssessmentData(_0x19b209,_0x5b297c){try{const _0x2af8f7=await convertToCSVFile(_0x5b297c),_0x41cf7a=await _0x2af8f7['text'](),_0x8e1311=parseAssessmentCsv(_0x41cf7a),_0x81a69c=await fetch(_0x19b209+'/assessment-data/upload',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x8e1311)});if(!_0x81a69c['ok']){const _0x2a09ac=await _0x81a69c['json']();throw _0x2a09ac;}return _0x81a69c['json']();}catch(_0x392a69){throw _0x392a69;}}
|
|
33
33
|
|
|
34
|
-
async function uploadDeptFaculty(
|
|
34
|
+
async function uploadDeptFaculty(_0xa02e4c,_0xe642eb){try{const _0x78d442=await convertToCSVFile(_0xe642eb),_0x572c29=new FormData();_0x572c29['append']('csvFile',_0x78d442);const _0x1b3048=await fetch(_0xa02e4c+'/dept-faculties/upload',{'method':'POST','body':_0x572c29});if(!_0x1b3048['ok']){const _0x21993f=await _0x1b3048['json']();throw _0x21993f;}return _0x1b3048['json']();}catch(_0x295a6e){throw _0x295a6e;}}
|
|
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(_0x4df522){let _0x1e3048={'headerIdx':-1,'poIdx':-1,'tlIdx':-1,'piIdx':-1,'fcIdx':-1,'scIdx':-1,'atIdx':-1,'ptIdx':-1};for(let _0x3a0835=0x0;_0x3a0835<Math['min'](_0x4df522['length'],0x14);_0x3a0835++){const _0x450f1e=(_0x4df522[_0x3a0835]??[])['map'](_0x557e7a=>_0x557e7a['toLowerCase']()['trim']()),_0x26eeaa=_0x450f1e['findIndex'](_0x1c619f=>HEADERS['po']['some'](_0x580ac2=>_0x1c619f['toLowerCase']()['includes'](_0x580ac2))),_0x4c1312=_0x450f1e['findIndex'](_0x4f45dc=>HEADERS['tl']['some'](_0x495b9a=>_0x4f45dc['toLowerCase']()['includes'](_0x495b9a))),_0x57fd27=_0x450f1e['findIndex'](_0x13644e=>HEADERS['pi']['some'](_0x30d924=>_0x13644e['toLowerCase']()['includes'](_0x30d924))),_0xbee2d6=_0x450f1e['findIndex'](_0x4f390f=>HEADERS['fc']['some'](_0xc6f640=>_0x4f390f['toLowerCase']()['includes'](_0xc6f640))),_0x2a4815=_0x450f1e['findIndex'](_0xf8b164=>HEADERS['sc']['some'](_0x207b96=>_0xf8b164['toLowerCase']()['includes'](_0x207b96))),_0x277739=_0x450f1e['findIndex'](_0x39e91b=>HEADERS['at']['some'](_0x309069=>_0x39e91b['toLowerCase']()['includes'](_0x309069))),_0x443c64=_0x450f1e['findIndex'](_0x4ff04f=>HEADERS['pt']['some'](_0x3d0c66=>_0x4ff04f['toLowerCase']()['includes'](_0x3d0c66))),_0x1623ba=[_0x26eeaa,_0x4c1312,_0x57fd27,_0xbee2d6,_0x2a4815,_0x277739,_0x443c64]['filter'](_0x2fd704=>_0x2fd704!==-1)['length'];if(_0x1623ba>=0x3){_0x1e3048={'headerIdx':_0x3a0835,'poIdx':_0x26eeaa,'tlIdx':_0x4c1312,'piIdx':_0x57fd27,'fcIdx':_0xbee2d6,'scIdx':_0x2a4815,'atIdx':_0x277739,'ptIdx':_0x443c64};break;}}if(_0x1e3048['headerIdx']===-1)throw new Error('No\x20valid\x20headers\x20found\x20in\x20POAEP\x20file.');return _0x1e3048;}
|
|
37
37
|
|
|
38
|
-
const parseFormativeCourses=
|
|
38
|
+
const parseFormativeCourses=_0x1070d5=>{let _0x1959b5=_0x1070d5['split'](',')['reduce']((_0x1f9bcb,_0x256293)=>{const _0x5bff86=_0x256293['trim']();if(_0x5bff86)_0x1f9bcb['push'](_0x5bff86);return _0x1f9bcb;},[]);return _0x1959b5;};
|
|
39
39
|
|
|
40
|
-
const parsePOAEP=
|
|
40
|
+
const parsePOAEP=_0x45dad1=>{try{const _0x52452f=_0x2ee671['parse'](_0x45dad1,{'skipEmptyLines':![]})['data'],{headerIdx:_0x35dab5,poIdx:_0x19458b,tlIdx:_0x4d6c63,piIdx:_0x453a61,fcIdx:_0x17bb1b,scIdx:_0x494ed5,atIdx:_0x6839c1,ptIdx:_0x4a4995}=getPoaepHeader(_0x52452f),_0x487f4c=[];let _0x172cd4={'po_desc':'','seq_no':0x0,'PerfIndicators':[]},_0x4de952='',_0x11150b='',_0x3536c1='';for(let _0x47da6d=_0x35dab5+0x1;_0x47da6d<_0x52452f['length'];_0x47da6d++){const _0x26bb0b=_0x52452f[_0x47da6d];if(!_0x26bb0b)break;const _0x3b0558=_0x26bb0b[_0x19458b]?.['trim']()||'';_0x3b0558!==''&&(_0x172cd4={'po_desc':_0x3b0558,'seq_no':_0x172cd4['seq_no']+0x1,'PerfIndicators':[]},_0x487f4c['push'](_0x172cd4),_0x4de952='',_0x11150b='',_0x3536c1='');if(_0x172cd4['po_desc']==='')throw new Error('Invalid\x20Program\x20Outcome\x20at\x20row\x20'+_0x47da6d+'.');const _0x5635fb=_0x26bb0b[_0x453a61]?.['trim']()||'';if(_0x5635fb==='')break;const _0x2a2b15=_0x26bb0b[_0x17bb1b]?.['trim']()||'';if(_0x2a2b15==='')throw new Error('Empty\x20Formative\x20Courses\x20at\x20row\x20'+_0x47da6d+'.');const _0x2f2530=_0x26bb0b[_0x494ed5]?.['trim']()||_0x4de952;if(_0x2f2530==='')throw new Error('Empty\x20Summative\x20Course\x20at\x20row\x20'+_0x47da6d+'.');_0x4de952=_0x2f2530;const _0x54e262=_0x26bb0b[_0x6839c1]?.['trim']()||_0x11150b;if(_0x54e262==='')throw new Error('Empty\x20Assessment\x20Tool\x20at\x20row\x20'+_0x47da6d+'.');_0x11150b=_0x54e262;const _0x2694e8=_0x26bb0b[_0x4a4995]?.['trim']()||_0x3536c1;if(_0x2694e8==='')throw new Error('Empty\x20Performance\x20Target\x20at\x20row\x20'+_0x47da6d+'.');_0x3536c1=_0x2694e8;const _0x3700df=parseFormativeCourses(_0x2a2b15);if(_0x3700df['length']===0x0)throw new Error('Invalid\x20Formative\x20Courses\x20format\x20at\x20row\x20'+_0x47da6d+'.');const _0x40648e=performaceTarget(_0x2694e8);if(!_0x40648e['performance_target']||!_0x40648e['passing_score'])throw new Error('Invalid\x20Performance\x20Targets\x20format\x20at\x20row\x20'+_0x47da6d+'.');const _0x584f82={'pi_desc':_0x5635fb,'FormativeCourses':_0x3700df['map'](_0x23123a=>({'course_id':_0x23123a,'cognitive_level':0x0})),'SummativeCourse':{'course_id':_0x2f2530},'AssessmentTool':{'at_desc':_0x54e262},'PerformanceTargets':{'target_percent':_0x40648e['performance_target'],'min_score':_0x40648e['passing_score']}};_0x172cd4['PerfIndicators']['push'](_0x584f82);}return {'success':!![],'message':'Successfully\x20parsed\x20POAEP\x20file.','data':{'POAEP':_0x487f4c}};}catch(_0x42dfeb){return {'success':![],'error':_0x42dfeb instanceof Error?_0x42dfeb['message']:_0x42dfeb,'message':'Please\x20ensure\x20the\x20file\x20follows\x20the\x20POAEP\x20template.'};}};
|
|
41
41
|
|
|
42
|
-
async function uploadPOAEP(
|
|
42
|
+
async function uploadPOAEP(_0x264da7,_0x1c685c,_0x486f05,_0x3dadb0,_0x3caf8e){try{const _0xe1b6b9=await convertToCSVFile(_0x1c685c),_0x18b85e=await _0xe1b6b9['text'](),_0x58f450=parsePOAEP(_0x18b85e),_0x21b5f7=await fetch(_0x264da7+'/program-outcomes/poaep/upload?curr_id='+_0x3dadb0+'&period_id='+_0x3caf8e,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x486f05},'credentials':'include','body':JSON['stringify'](_0x58f450)});if(!_0x21b5f7['ok']){const _0x24eec5=await _0x21b5f7['json']();throw _0x24eec5;}return _0x21b5f7['json']();}catch(_0x736914){throw _0x736914;}}
|
|
43
43
|
|
|
44
|
-
class DataTable{['name'];['headers'];['table'];['validators']=[];constructor(
|
|
44
|
+
class DataTable{['name'];['headers'];['table'];['validators']=[];constructor(_0x179c10='DataTable',_0x525c9d){this['name']=_0x179c10,this['headers']=_0x525c9d,this['table']=[],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'],'headers':this['headers'],'table':this['table']}};}async['setTable'](_0x438ab6){await this['assertInitialized']();}async['initializeTable'](_0x249bf9,_0x1ae8c9){try{let _0x35e897;if(_0x249bf9 instanceof File)_0x35e897=await this['fromXML'](_0x249bf9,_0x1ae8c9);else _0x35e897=await this['fromCSVString'](_0x249bf9);if(!_0x35e897['success']||!_0x35e897['data'])return _0x35e897;if(_0x35e897['data']['length']===0x0)throw new Error('Cannot\x20set\x20an\x20empty\x20table.');return this['table']=_0x35e897['data'],{'success':!![],'message':'Successfully\x20set\x20table.'};}catch(_0x131bfa){return {'success':![],'message':'Error\x20setting\x20table.','error':_0x131bfa};}}async['assertInitialized'](){if(this['table']['length']===0x0)Promise['reject']({'error':this['name']+'\x20is\x20unset.','from':this['name']['toUpperCase']()+'_ASSERT_INIT'});}async['fromXML'](_0xb848f7,_0x5af3fe){const _0xbea056=await convertToCSVFile(_0xb848f7,_0x5af3fe),_0x57fa1a=await _0xbea056['text']();return this['fromCSVString'](_0x57fa1a);}async['findValue'](_0x559a3c){let [_0xf229d4,_0x533f7e]=[-1,-1];if(!_0x559a3c)return {'row':_0xf229d4,'column':_0x533f7e};for(let _0xb60aa8=0x0;_0xb60aa8<this['table']['length'];_0xb60aa8++){const _0x28555a=this['table'][_0xb60aa8];for(let _0x5e0227=0x0;_0x5e0227<_0x28555a['length'];_0x5e0227++){if(typeof _0x559a3c==='string'){if(_0x28555a[_0x5e0227]===_0x559a3c)return {'row':_0xb60aa8,'column':_0x5e0227};}else {if(_0x28555a[_0x5e0227]){if(_0x28555a[_0x5e0227]===_0x559a3c)return {'row':_0xb60aa8,'column':_0x5e0227};}}}}return {'row':_0xf229d4,'column':_0x533f7e};}async['validate'](){const _0x1ad08f=[],_0x5d65f3=[];try{await this['assertInitialized']()['then'](()=>{_0x1ad08f['push']('Table\x20is\x20initialized.');})['catch'](_0x53e60f=>_0x5d65f3['push'](_0x53e60f));if(_0x5d65f3['length']>0x0)throw 'Cannot\x20validate\x20uninitialized\x20table.';await this['validateFields'](_0x1ad08f,_0x5d65f3);const {success:_0x5656ad,message:_0x1da19c,error:_0xcaaec1,data:_0x7aa429}=await this['toJson']();if(!_0x7aa429)throw 'Cannot\x20access\x20Json\x20Object\x20data.';_0x1ad08f['push'](..._0x7aa429['validMsgs']),_0x5d65f3['push'](..._0x7aa429['tableErrors']);const {jsonObj:_0x2222ef}=_0x7aa429;for(const _0x2601f8 of this['validators']){await _0x2601f8['validate'](_0x1ad08f,_0x5d65f3,this,_0x2222ef);}let _0x2b52ca=this['name']+'\x20ran\x20its\x20validations.';if(_0x1ad08f['length']>0x0)_0x2b52ca+='\x20'+_0x1ad08f['length']+'\x20validations\x20were\x20successful.';if(_0x5d65f3['length']>0x0)_0x2b52ca+='\x20'+_0x5d65f3['length']+'\x20validations\x20failed.';return {'success':!![],'message':_0x2b52ca,'data':{'validMsgs':_0x1ad08f,'tableErrors':_0x5d65f3}};}catch(_0x3b851f){return _0x5d65f3['push']({'error':this['name']+'\x20failed\x20to\x20run\x20all\x20its\x20validations.','from':this['name']['toUpperCase']()+'_VALIDATE','cause':_0x3b851f}),{'success':![],'message':this['name']+'\x20failed\x20to\x20run\x20all\x20its\x20validations.','data':{'validMsgs':_0x1ad08f,'tableErrors':_0x5d65f3}};}}['useValidator'](_0x582270){this['validators']['push'](_0x582270);}}
|
|
45
45
|
|
|
46
|
-
class DTValidator{['name'];constructor(
|
|
46
|
+
class DTValidator{['name'];constructor(_0x436053){this['name']=_0x436053;}['getName'](){return this['name'];}['report'](_0x1b65ba,_0x6d6432,_0x222158){if(_0x1b65ba['length']>0x0)_0x222158['push'](..._0x1b65ba);else _0x6d6432['push'](this['name']+'\x20successfully\x20validated.');}}
|
|
47
47
|
|
|
48
|
-
class LastILOTaxo extends DTValidator{constructor(){super('LAST_ILO_TAXO');}async['validate'](
|
|
48
|
+
class LastILOTaxo extends DTValidator{constructor(){super('LAST_ILO_TAXO');}async['validate'](_0x403c1d,_0x4bdaf6,_0x132ebf,_0xe5c823){const _0x2249d3=[];if(!_0xe5c823){_0x4bdaf6['push']({'error':'Unable\x20to\x20access\x20COAEP\x20object.','from':this['name']});return;}for(let _0xb753bd=0x0;_0xb753bd<_0xe5c823['co']['length'];_0xb753bd++){const _0x2ba300=_0xe5c823['co'][_0xb753bd];if(!_0x2ba300){const {row:_0x3ef3c2,column:_0x427f51}=await _0x132ebf['findValue'](_0xb753bd+0x1+'');_0x2249d3['push']({'error':'No\x20CO\x20Statement\x20for\x20CO\x20'+(_0xb753bd+0x1)+'.','row':_0x3ef3c2,'column':_0x427f51+0x1,'from':this['name']});continue;}if(!_0x2ba300?.['ilo']){const {row:_0x421c7a,column:_0x47d231}=await _0x132ebf['findValue'](_0x2ba300['statement']);_0x2249d3['push']({'error':'No\x20ILOs\x20for\x20CO\x20'+(_0xb753bd+0x1)+'.','row':_0x421c7a,'column':_0x47d231,'from':this['name']});continue;}const _0x2e8196=_0x2ba300['ilo']['length']-0x1,_0x2d29ad=_0x2ba300['ilo'][_0x2e8196];if(!_0x2d29ad['taxonomy_level']){const {row:_0x1c0cb3,column:_0x4e3154}=await _0x132ebf['findValue'](_0x2d29ad['statement']);_0x2249d3['push']({'error':'Last\x20ILO\x20for\x20CO\x20'+(_0xb753bd+0x1)+'\x20has\x20no\x20Taxonomy\x20Level.','row':_0x1c0cb3,'column':_0x4e3154,'from':this['name']});continue;}if(_0x2d29ad['taxonomy_level']!==_0x2ba300['taxonomy_level']){const {row:_0x59371c,column:_0xa37a66}=await _0x132ebf['findValue'](_0x2d29ad['statement']);_0x2249d3['push']({'error':'Last\x20ILO\x20for\x20CO\x20'+(_0xb753bd+0x1)+'\x20does\x20not\x20match\x20the\x20CO\x27s\x20Taxonomy\x20Level.\x20('+_0x2d29ad['taxonomy_level']+'\x20!==\x20'+_0x2ba300['taxonomy_level']+')','row':_0x59371c,'column':_0xa37a66,'from':this['name']});}}this['report'](_0x2249d3,_0x403c1d,_0x4bdaf6);}}
|
|
49
49
|
|
|
50
|
-
const whitelist=['applying','analyzing','evaluating','creating'];class MinCOtaxo extends DTValidator{constructor(){super('MIN_CO_TAXO');}async['validate'](
|
|
50
|
+
const whitelist=['applying','analyzing','evaluating','creating'];class MinCOtaxo extends DTValidator{constructor(){super('MIN_CO_TAXO');}async['validate'](_0x4a5a1d,_0x160252,_0x221c1c,_0x1b5c66){const _0x1915c4=[];if(!_0x1b5c66){_0x160252['push']({'error':'Unable\x20to\x20access\x20COAEP\x20object.','from':this['name']});return;}for(let _0x54291e=0x0;_0x54291e<_0x1b5c66['co']['length'];_0x54291e++){const _0x58eb27=_0x1b5c66['co'][_0x54291e];if(!_0x58eb27['taxonomy_level']){_0x1915c4['push']({'error':'No\x20taxonomy\x20level\x20for\x20CO\x20'+(_0x54291e+0x1),'from':this['name']});continue;}if(!whitelist['includes'](_0x58eb27['taxonomy_level'])){const {row:_0x383b3b,column:_0x1335d3}=await _0x221c1c['findValue'](_0x58eb27['statement']);let _0x2a7e7b={'error':'Cannot\x20have\x20CO\x20Taxonomy\x20Level\x20of\x20lower\x20than\x20Applying:\x20'+_0x58eb27['taxonomy_level']['toUpperCase'](),'from':this['name']};(_0x383b3b!==-1||_0x1335d3!==-1)&&(_0x2a7e7b['row']=_0x383b3b,_0x2a7e7b['column']=_0x1335d3),_0x1915c4['push'](_0x2a7e7b);}}this['report'](_0x1915c4,_0x4a5a1d,_0x160252);return;}}
|
|
51
51
|
|
|
52
|
-
const taxoOrder={'remembering':0x1,'understanding':0x2,'applying':0x3,'analyzing':0x4,'evaluating':0x5,'creating':0x6};
|
|
52
|
+
const taxoOrder={'remembering':0x1,'understanding':0x2,'applying':0x3,'analyzing':0x4,'evaluating':0x5,'creating':0x6};
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
class ILOTaxoOrder extends DTValidator{constructor(){super('ILO_TAXO_ORDER');}async['validate'](_0x416909,_0x30eabe,_0x7b13b,_0x25b6c0){const _0x56bfd4=[];if(!_0x25b6c0){_0x30eabe['push']({'error':'Unable\x20to\x20access\x20COAEP\x20object.','from':this['name']});return;}for(let _0x23f861=0x0;_0x23f861<_0x25b6c0['co']['length'];_0x23f861++){const _0x5ea2ac=_0x25b6c0['co'][_0x23f861];if(!_0x5ea2ac){const {row:_0x52a8f6,column:_0x4e7ecd}=await _0x7b13b['findValue'](_0x23f861+0x1+'');_0x56bfd4['push']({'error':'No\x20CO\x20Statement\x20for\x20CO\x20'+(_0x23f861+0x1)+'.','row':_0x52a8f6,'column':_0x4e7ecd+0x1,'from':this['name']});continue;}if(!_0x5ea2ac?.['ilo']){const {row:_0x52a3e3,column:_0x26bb3d}=await _0x7b13b['findValue'](_0x5ea2ac['statement']);_0x56bfd4['push']({'error':'No\x20ILOs\x20for\x20CO\x20'+(_0x23f861+0x1)+'.','row':_0x52a3e3,'column':_0x26bb3d,'from':this['name']});continue;}const _0x1d5809=await _0x7b13b['findValue'](_0x5ea2ac['ilo'][0x0]['statement']),_0x4f7c12=_0x5ea2ac['ilo']['map'](_0x346687=>taxoOrder[_0x346687['taxonomy_level']]);let _0x4e2869=_0x4f7c12[0x0];for(let _0x15da6d=0x1;_0x15da6d<_0x4f7c12['length'];_0x15da6d++){if(_0x4f7c12[_0x15da6d]<_0x4e2869){_0x56bfd4['push']({'error':'Under\x20CO\x20'+(_0x23f861+0x1)+',\x20ILO\x20'+(_0x15da6d+0x1)+'\x20should\x20not\x20have\x20a\x20taxonomy\x20level\x20lower\x20than\x20ILO\x20'+_0x15da6d+'\x27s.','row':_0x1d5809['row'],'column':_0x1d5809['column']+_0x15da6d,'from':this['name']});continue;}_0x4e2869=_0x4f7c12[_0x15da6d];}}this['report'](_0x56bfd4,_0x416909,_0x30eabe);}}
|
|
55
55
|
|
|
56
|
-
class
|
|
56
|
+
const minPerfTarget=0x32,minPassScore=0x32;class MinPerfTarget extends DTValidator{constructor(){super('MIN_PERF_TARGET');}async['validate'](_0x2ba1a5,_0x5491f6,_0x24a33f,_0x5bfc49){const {success:_0x44cb05,data:_0x3c508d}=_0x24a33f['getTable'](),_0x237e5f=[];if(!_0x44cb05){_0x237e5f['push']({'error':'Failed\x20to\x20access\x20table\x20data.','from':this['name']});return;}const {table:_0x27b14e}=_0x3c508d;for(let _0x45c887=0x0;_0x45c887<_0x27b14e['length'];_0x45c887++){const _0x2df4bf=_0x27b14e[_0x45c887],[_0x412cca,_0x576288]=_0x2df4bf[0x4];if(!_0x412cca)_0x237e5f['push']({'error':'Performance\x20target\x20is\x20required.','row':_0x45c887,'column':0x4,'from':this['name']});else _0x412cca<minPerfTarget&&_0x237e5f['push']({'error':'Performance\x20target\x20must\x20be\x20at\x20least\x20'+minPerfTarget+'.','row':_0x45c887,'column':0x4,'from':this['name']});if(!_0x576288)_0x237e5f['push']({'error':'Pass\x20score\x20is\x20required.','row':_0x45c887,'column':0x6,'from':this['name']});else _0x576288<minPassScore&&_0x237e5f['push']({'error':'Pass\x20score\x20must\x20be\x20at\x20least\x20'+minPassScore+'.','row':_0x45c887,'column':0x6,'from':this['name']});}this['report'](_0x237e5f,_0x2ba1a5,_0x5491f6);}}
|
|
57
57
|
|
|
58
|
-
class
|
|
58
|
+
class CoaepDT extends DataTable{['faculty']=null;['course']=null;['sy']=null;['semester']=null;constructor(){super('CoaepDT',['No.','Course\x20Outcome\x20Statement','Intended\x20Learning\x20Outcome','Assessment\x20Tool','Performance\x20Target']),this['useValidator'](new MinCOtaxo()),this['useValidator'](new LastILOTaxo()),this['useValidator'](new ILOTaxoOrder()),this['useValidator'](new MinPerfTarget());}async['validateFields'](_0x109474,_0x3028e6){const _0x146831=[];let _0x199bb2=null,_0xd66636=null;for(let _0xf29030=0x0;_0xf29030<this['table']['length'];_0xf29030++){const _0x12927a=[],_0x521267=this['table'][_0xf29030],_0x5047ad=_0x521267[0x0]||_0x199bb2,_0x167261=_0x521267[0x1]||_0xd66636,_0xafaded=_0x521267[0x2],_0x97d511=_0x521267[0x3],_0x2a29b2=_0x521267[0x4];if(!_0x5047ad)_0x12927a['push'](0x0);if(!_0xd66636)_0x12927a['push'](0x1);if(!_0xafaded)_0x12927a['push'](0x2);if(!_0x97d511)_0x12927a['push'](0x3);if(!_0x2a29b2)_0x12927a['push'](0x4);if(_0xd66636!==_0x167261)this['validateObjectiveGrammar'](_0x167261,_0xf29030,0x1,_0x3028e6);_0x199bb2=_0x5047ad,_0xd66636=_0x167261;for(const _0x33c54e of _0x12927a){_0x146831['push']({'error':'Missing\x20field:\x20'+this['headers'][_0x33c54e],'row':_0xf29030,'column':_0x33c54e});}if(_0xafaded)this['validateObjectiveGrammar'](_0xafaded,_0xf29030,0x2,_0x3028e6);}if(_0x146831['length']>0x0)_0x3028e6['push'](..._0x146831);else _0x109474['push'](this['name']+'\x20successfully\x20validated\x20all\x20fields.');}async['fromCSVString'](_0x2a153e){try{const _0xb988c1=[],_0x273892=_0x2ee671['parse'](_0x2a153e,{'skipEmptyLines':![]})['data'],{headerRowIndex:_0x31e062,coIdx:_0x5abbf8,iloIdx:_0x2d7df2,assessToolIdx:_0x3ae745,perfTargetIdx:_0x357f79}=getCoaepHeader(_0x273892);if(_0x31e062===-0x1)throw new Error('Could\x20not\x20auto-detect\x20header\x20row.\x20Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.');_0x273892['forEach'](_0x305da9=>{const _0x3154b6=_0x305da9['indexOf']('Name\x20of\x20Faculty:'),_0x4b12ab=_0x305da9['indexOf']('School\x20Year'),_0x582850=_0x305da9['indexOf']('Course:'),_0x6311e9=_0x305da9['indexOf']('Semester');_0x3154b6!==-0x1&&(this['faculty']=_0x305da9[_0x3154b6+0x1]?.['trim']()||this['faculty']);_0x4b12ab!==-0x1&&(this['sy']=_0x305da9[_0x4b12ab+0x1]?.['trim']()||this['sy']);_0x582850!==-0x1&&(this['course']=_0x305da9[_0x582850+0x1]?.['trim']()||this['course']);if(_0x6311e9!==-0x1){const _0x5f328b=_0x305da9[_0x6311e9+0x1]?.['trim']()||'',_0x32e67f=_0x5f328b['match'](/\d+/)?.[0x0];this['semester']=_0x32e67f?parseInt(_0x32e67f,0xa):this['semester'];}});for(let _0x2bcb50=0x0;_0x2bcb50<=_0x273892['length'];_0x2bcb50++){const _0x3e9be3=_0x273892[_0x2bcb50];if(!_0x3e9be3)break;if(_0x2bcb50<=_0x31e062)continue;if(!_0x3e9be3[_0x2d7df2])break;let _0x4a2265=_0x3e9be3[_0x5abbf8-0x1]?.['trim']()||'',_0x558a2a=_0x3e9be3[_0x5abbf8]?.['trim']()||'',_0x4775d2=_0x3e9be3[_0x2d7df2]?.['trim']()||'';/^\d+$/['test'](_0x3e9be3[_0x5abbf8]?.['trim']()||'')&&(_0x4a2265=_0x3e9be3[_0x5abbf8]?.['trim']()||'',_0x558a2a=_0x3e9be3[_0x5abbf8+0x1]?.['trim']()||'');let _0x114c80=null;if(_0x558a2a){const {cognitive_level:_0x308cb6,taxonomy_level:_0x5e5d4d,verb:_0x4ea910,rest:_0x57835a}=extractFromObjective(_0x558a2a);_0x114c80=[_0x308cb6,_0x5e5d4d,_0x4ea910,_0x57835a];}let _0x21f2d4;{const {cognitive_level:_0x3132d2,taxonomy_level:_0xd22e53,verb:_0x41da21,rest:_0x240ea2}=extractFromObjective(_0x4775d2);_0x21f2d4=[_0x3132d2,_0xd22e53,_0x41da21,_0x240ea2];}const _0x24cd35=_0x3e9be3[_0x357f79]?.['replace'](/\s+/g,'\x20')['trim']()||'',{performance_target:_0x3c1814,passing_score:_0x4da1f7}=performaceTarget(_0x24cd35);_0xb988c1['push']([_0x4a2265,_0x114c80,_0x21f2d4,_0x3e9be3[_0x3ae745]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',[_0x3c1814,_0x4da1f7]]);}return {'success':!![],'message':'Successfully\x20converted\x20COAEP\x20datatable.','data':_0xb988c1};}catch(_0x119c5c){return {'success':![],'message':'Error\x20parsing\x20COAEP\x20table','error':_0x119c5c};}}async['toJson'](){const _0x32a099=[],_0x21ac41=[],_0x45a5b6='COAEPDT_TO_JSON';try{await this['assertInitialized']();const _0x3dcdde={'faculty':this['faculty'],'course':this['course'],'sy':this['sy'],'semester':this['semester'],'co':[]};let _0x10bf21=null,_0x3b0aba='',_0x5463de=[null,null];this['table']['forEach']((_0x5a03bf,_0x532df1)=>{if(_0x532df1===0x0&&!_0x5a03bf[0x1])_0x21ac41['push']({'error':'Cannot\x20have\x20empty\x20CO\x20Statement\x20in\x20first\x20row.','row':0x0,'column':0x1,'from':_0x45a5b6});_0x5a03bf[0x1]&&(_0x3b0aba='',_0x5463de=[null,null]);const _0x1e12df=_0x5a03bf[0x1],_0xeaac59=_0x5a03bf[0x2],_0x47e818=_0x5a03bf[0x3]||_0x3b0aba,_0x1ec6ad=_0x5a03bf[0x4]||_0x5463de;if(!_0xeaac59)_0x21ac41['push']({'error':'Cannot\x20have\x20empty\x20ILO.','row':0x1,'column':0x2,'from':_0x45a5b6});if(!_0x47e818)_0x21ac41['push']({'error':'Cannot\x20have\x20empty\x20Assessment\x20Tool.','row':_0x532df1,'column':0x3,'from':_0x45a5b6});if(!_0x1ec6ad)_0x21ac41['push']({'error':'Cannot\x20have\x20empty\x20Performance\x20Target.','row':_0x532df1,'column':0x4,'from':_0x45a5b6});if(_0x1e12df){const [_0x549d25,_0x19b434,_0x3f648b,_0x43673f]=_0x1e12df,_0x614b9f={'statement':_0x43673f,'ilo':[],'taxonomy_level':_0x19b434,'cognitive_level':_0x549d25,'verb':_0x3f648b};_0x10bf21=_0x614b9f,_0x3dcdde['co']['push'](_0x614b9f);}const [_0x102ad5,_0x5ac78e,_0xee48c7,_0x1772f2]=_0xeaac59,[_0x18a1ff,_0x40f6e7]=_0x1ec6ad,_0x2ffd08={'statement':_0x1772f2,'assessment_tool':_0x47e818,'performance_target':_0x18a1ff,'passing_score':_0x40f6e7,'cognitive_level':_0x102ad5,'taxonomy_level':_0x5ac78e,'verb':_0xee48c7};_0x10bf21['ilo']['push'](_0x2ffd08);});if(_0x21ac41['length'])return _0x21ac41['push']({'error':'Converted\x20COAEP\x20datatable\x20to\x20JSON,\x20but\x20with\x20errors.','from':_0x45a5b6}),{'success':![],'message':'Converted\x20COAEP\x20datatable\x20to\x20JSON,\x20but\x20with\x20errors.','data':{'jsonObj':_0x3dcdde,'validMsgs':_0x32a099,'tableErrors':_0x21ac41}};return _0x32a099['push']('Successfully\x20converted\x20COAEP\x20datatable\x20to\x20JSON.'),{'success':!![],'message':'Successfully\x20converted\x20COAEP\x20datatable\x20to\x20JSON','data':{'jsonObj':_0x3dcdde,'validMsgs':_0x32a099,'tableErrors':_0x21ac41}};}catch(_0x3b4443){return _0x21ac41['push']({'error':'Error\x20converting\x20COAEP\x20datatable\x20to\x20JSON','from':_0x45a5b6}),{'success':![],'message':'Error\x20converting\x20COAEP\x20datatable\x20to\x20JSON','error':_0x3b4443,'data':{'jsonObj':null,'tableErrors':_0x21ac41}};}}['validateObjectiveGrammar'](_0xa26ca8,_0x5e1758,_0x1b343e,_0x49e00f){if(!_0xa26ca8){_0x49e00f['push']({'error':'Cannot\x20find\x20objective\x20statement.','row':_0x5e1758,'column':_0x1b343e,'from':this['name']['toUpperCase']()+'_OBJ_GRAMMAR'});return;}const [_0x144b8b,_0x41c4ab,_0x31f70b,_0x181945]=_0xa26ca8,_0x4bfbee=[];if(!_0x144b8b)_0x4bfbee['push']('cognitive_level');if(!_0x41c4ab)_0x4bfbee['push']('taxonomy_level');if(!_0x31f70b)_0x4bfbee['push']('verb');if(!_0x4bfbee['length'])return;_0x49e00f['push']({'error':'Cannot\x20find\x20fields:\x20'+_0x4bfbee['join'](',\x20')+'.','row':_0x5e1758,'column':_0x1b343e,'from':this['name']['toUpperCase']()+'_OBJ_GRAMMAR'});}}
|
|
59
|
+
|
|
60
|
+
class Client{['BASE_URL'];constructor(_0xfaa557){this['BASE_URL']=_0xfaa557;}['Parser'](){return {'curriculum':async _0x3a94cf=>{const _0x2c1582=await uploadCurriculum(this['BASE_URL'],_0x3a94cf);return _0x2c1582;},'courseOffering':async _0x83a1ea=>{const _0x51942f=await uploadCourseOffering(this['BASE_URL'],_0x83a1ea);return _0x51942f;},'coaep':async(_0x508188,_0x26a7e3)=>{const _0x46e6bd=await uploadCOAEP(this['BASE_URL'],_0x508188,_0x26a7e3);return _0x46e6bd;},'enrolledStudent':async _0x25e123=>{const _0x14f898=await uploadEnrolledStudent(this['BASE_URL'],_0x25e123);return _0x14f898;},'classlist':async(_0x3ce8f9,_0x1e3f87,_0x20d156)=>{const _0x465503=await uploadClassList(this['BASE_URL'],_0x3ce8f9,_0x1e3f87,_0x20d156);return _0x465503;},'assessmentData':async _0x412389=>{const _0x25edc4=await uploadAssessmentData(this['BASE_URL'],_0x412389);return _0x25edc4;},'deptFaculty':async _0x2db19b=>{const _0x5abbbe=await uploadDeptFaculty(this['BASE_URL'],_0x2db19b);return _0x5abbbe;},'poaep':async(_0x18e830,_0x4f5413,_0x2c37c1,_0x4cc572)=>{const _0x3832ef=await uploadPOAEP(this['BASE_URL'],_0x18e830,_0x4f5413,_0x2c37c1,_0x4cc572);return _0x3832ef;},'CoaepDT':CoaepDT};}}
|
|
59
61
|
|
|
60
62
|
export { Client as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import Taxonomy from "../types/Taxonomy";
|
|
1
2
|
export default function extractFromObjective(objective: string): {
|
|
2
3
|
cognitive_level: "I" | "E" | "D" | null;
|
|
3
|
-
taxonomy_level:
|
|
4
|
+
taxonomy_level: Taxonomy | null;
|
|
4
5
|
verb: string | null;
|
|
5
6
|
rest: string | null;
|
|
6
7
|
};
|
package/package.json
CHANGED
package/types/Taxonomy.d.ts
CHANGED