@obe-loms/coms-parser 1.3.2 → 1.4.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/bundle.js +19 -19
- package/helper/header-getter/getPoaepHeader.d.ts +10 -0
- package/helper/parseFormativeCourses.helper.d.ts +2 -0
- package/package.json +1 -1
- package/parser/poaep.d.ts +13 -0
- package/relay/uploadPOAEP.d.ts +1 -0
- package/test/poaep/poaep.test.d.ts +1 -0
- package/types/poaep.d.ts +26 -0
package/bundle.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import _0x4ce8b3 from 'papaparse';
|
|
2
|
+
import * as _0x16ee38 from 'xlsx';
|
|
3
3
|
|
|
4
|
-
function parseCurriculum(
|
|
4
|
+
function parseCurriculum(_0x3766f0){let _0x5fa482='',_0xce3154='',_0x5c7f42=0x0,_0x1f38d1=null;const _0x1f15c3=[];return _0x4ce8b3['parse'](_0x3766f0,{'skipEmptyLines':!![],'complete':_0x28ea85=>{_0x28ea85['data']['forEach'](_0x33ee7b=>{const _0x3075c7=_0x33ee7b['map'](_0x421437=>(_0x421437??'')['toString']()['trim']()),_0x54eb9c=_0x3075c7[0x0]??'';if(_0x54eb9c['includes']('Rev#')){const _0xddc42e=_0x54eb9c['match'](/([A-Z0-9]+)\s*-\s*.*:\s*(.*?)\s+Rev#\s*(\d+)/i);_0xddc42e&&(_0x5fa482=_0xddc42e[0x1]?.['trim']()??'',_0xce3154=_0xddc42e[0x2]?.['trim']()??'',_0x5c7f42=parseInt(_0xddc42e[0x3]??'0',0xa));return;}if(/FIRST YEAR/i['test'](_0x54eb9c)){_0x1f38d1=0x1;return;}if(/SECOND YEAR/i['test'](_0x54eb9c)){_0x1f38d1=0x2;return;}if(/THIRD YEAR/i['test'](_0x54eb9c)){_0x1f38d1=0x3;return;}if(/FOURTH YEAR/i['test'](_0x54eb9c)){_0x1f38d1=0x4;return;}if(/FIFTH YEAR/i['test'](_0x54eb9c)){_0x1f38d1=0x5;return;}if(/First Semester/i['test'](_0x54eb9c)||/Second Semester/i['test'](_0x54eb9c)||/Summer/i['test'](_0x54eb9c))return;const _0x4e426b=[{'sem':0x1,'offset':0x0},{'sem':0x2,'offset':0x6},{'sem':0x3,'offset':0xc}];_0x4e426b['forEach'](({sem:_0x5cc9d5,offset:_0x279c50})=>{const _0x346b5d=_0x3075c7[_0x279c50]??'',_0x47cea1=_0x3075c7[_0x279c50+0x1]??'',_0x403303=_0x3075c7[_0x279c50+0x2]??'',_0x257f2e=_0x3075c7[_0x279c50+0x3]??'',_0x21e1e1=_0x3075c7[_0x279c50+0x4]??'';_0x346b5d&&_0x1f38d1&&_0x1f15c3['push']({'curr_id':_0x5fa482,'program_name':_0xce3154,'revision_no':_0x5c7f42,'year_level':_0x1f38d1,'sem':_0x5cc9d5,'course_id':_0x346b5d,'course_desc':_0x47cea1,'total_units':_0x403303,'lec_unit':_0x257f2e,'lab_unit':_0x21e1e1});});});}}),_0x1f15c3;}
|
|
5
5
|
|
|
6
|
-
function convertToCSVFile(
|
|
6
|
+
function convertToCSVFile(_0x192782){return new Promise((_0x18e518,_0x4a02b3)=>{const _0x214ee3=new FileReader();_0x214ee3['onload']=_0x3720b9=>{const _0x268f7e=_0x3720b9['target']?.['result'];if(!_0x268f7e){_0x4a02b3(new Error('Failed\x20to\x20read\x20file'));return;}try{const _0xd666a1=_0x16ee38['read'](_0x268f7e,{'type':'array'}),_0x4fb830=_0xd666a1['SheetNames'][0x0];if(!_0x4fb830){_0x4a02b3(new Error('No\x20sheets\x20found\x20in\x20workbook'));return;}const _0x5968f5=_0xd666a1['Sheets'][_0x4fb830];if(!_0x5968f5){_0x4a02b3(new Error('No\x20sheets\x20found\x20in\x20worksheet'));return;}const _0xc53d23=_0x16ee38['utils']['sheet_to_csv'](_0x5968f5,{'strip':!![]}),_0x2f8ead=_0x192782['name']['replace'](/\.[^/.]+$/,'.csv'),_0x3faac6=new File([_0xc53d23],_0x2f8ead,{'type':'text/csv','lastModified':Date['now']()});_0x18e518(_0x3faac6);}catch(_0x37bf4e){_0x4a02b3(_0x37bf4e);}},_0x214ee3['onerror']=()=>{_0x4a02b3(new Error('File\x20reading\x20failed'));},_0x214ee3['readAsArrayBuffer'](_0x192782);});}
|
|
7
7
|
|
|
8
|
-
async function uploadCurriculum(
|
|
8
|
+
async function uploadCurriculum(_0x2d29f4,_0x42ffa6){try{const _0x1148a0=await convertToCSVFile(_0x42ffa6),_0x812fd4=await _0x1148a0['text'](),_0x4856da=parseCurriculum(_0x812fd4),_0x1a0667=_0x4ce8b3['unparse'](_0x4856da),_0x172dd9=new File([_0x1a0667],_0x1148a0['name'],{'type':'text/csv'}),_0x350a51=new FormData();_0x350a51['append']('csvFile',_0x172dd9);const _0x97282c=await fetch(_0x2d29f4+'/curr-courses/upload',{'method':'POST','body':_0x350a51});if(!_0x97282c['ok']){const _0x1eb5dd=await _0x97282c['json']();throw _0x1eb5dd;}return _0x97282c['json']();}catch(_0xdad09c){throw _0xdad09c;}}
|
|
9
9
|
|
|
10
|
-
function parseCourseOffering(
|
|
10
|
+
function parseCourseOffering(_0xd0ad89){let _0xb47836='',_0x5b04f6='';const _0x1d79b8=[],_0x4c8667=_0x4ce8b3['parse'](_0xd0ad89,{'header':![],'skipEmptyLines':!![],'delimiter':','}),_0x8f692f=_0x4c8667['data'];for(let _0x592fe7=0x0;_0x592fe7<Math['min'](0x5,_0x8f692f['length']);_0x592fe7++){const _0x5b1f3a=_0x8f692f[_0x592fe7];if(_0x5b1f3a&&_0x5b1f3a['length']>0x0){const _0x4d473e=_0x5b1f3a[0x0]?.['toString']()||'',_0xe06096=_0x4d473e['match'](/(First|Second)\s+Sem\s+S\/Y\s+(\d{4}-\d{4})/i);if(_0xe06096){_0xb47836=_0xe06096[0x1]?.['toLowerCase']()==='first'?'1':'2';if(_0xe06096[0x2]){const _0x194165=_0xe06096[0x2]['match'](/(\d{2})(\d{2})-(\d{2})(\d{2})/);_0x194165&&_0x194165[0x2]&&_0x194165[0x4]&&(_0x5b04f6=_0x194165[0x2]+_0x194165[0x4]);}}}}let _0x217fff=-1;for(let _0x34a8e4=0x0;_0x34a8e4<_0x8f692f['length'];_0x34a8e4++){const _0x4c4252=_0x8f692f[_0x34a8e4];if(_0x4c4252&&_0x4c4252['some'](_0xb24b10=>_0xb24b10?.['toString']()['toUpperCase']()['includes']('CODE'))){_0x217fff=_0x34a8e4;break;}}if(_0x217fff===-1)throw new Error('Could\x20not\x20find\x20header\x20row\x20in\x20CSV\x20data');let _0x1dc21b={'code':'','description':'','unit':0x0};for(let _0x5827f4=_0x217fff+0x1;_0x5827f4<_0x8f692f['length'];_0x5827f4++){const _0x28e17f=_0x8f692f[_0x5827f4];if(!_0x28e17f||_0x28e17f['length']<0x8)continue;const _0x87fa9b=_0x28e17f[0x1]?.['toString']()['trim']()||'',_0x16d6e7=_0x28e17f[0x4]?.['toString']()['trim']()||'',_0x51988e=_0x28e17f[0x5]?.['toString']()['trim']()||'',_0x2b3c69=_0x28e17f[0x6]?.['toString']()['trim']()||'',_0x1689dd=_0x28e17f[0x7]?.['toString']()['trim']()||'',_0x4a6472=_0x28e17f[0x3]?.['toString']()['trim']()||'';let _0x506459=_0x28e17f[0x0]?.['toString']()['trim']()||'',_0x32c838=_0x28e17f[0x2]?.['toString']()['trim']()||'';if(!_0x87fa9b)continue;if(!_0x506459)_0x506459=_0x1dc21b['code'];if(!_0x32c838)_0x32c838=_0x1dc21b['description'];let _0x373620=_0x1dc21b['unit'];if(_0x4a6472){const _0x7b07a7=_0x4a6472['match'](/(\d+)/);_0x7b07a7&&_0x7b07a7[0x1]&&(_0x373620=parseInt(_0x7b07a7[0x1],0xa));}const _0x21a5ca={'sem':_0xb47836,'school_year':_0x5b04f6,'code':_0x506459,'course_no':_0x87fa9b,'course_desc':_0x32c838,'unit':_0x373620,'time':_0x16d6e7,'days':_0x51988e,'faculty':_0x2b3c69,'room':_0x1689dd};_0x1dc21b['code']=_0x506459,_0x1dc21b['description']=_0x32c838,_0x1dc21b['unit']=_0x373620,_0x1d79b8['push'](_0x21a5ca);}return _0x1d79b8;}
|
|
11
11
|
|
|
12
|
-
async function uploadCourseOffering(
|
|
12
|
+
async function uploadCourseOffering(_0x58f2a6,_0x151516){try{const _0x412782=await convertToCSVFile(_0x151516),_0x161d1f=await _0x412782['text'](),_0x13260b=parseCourseOffering(_0x161d1f),_0x293807=_0x4ce8b3['unparse'](_0x13260b),_0x383c93=new File([_0x293807],_0x412782['name'],{'type':'text/csv'}),_0x17cc71=new FormData();_0x17cc71['append']('csvFile',_0x383c93);const _0x37574e=await fetch(_0x58f2a6+'/course-offerings/upload',{'method':'POST','body':_0x17cc71});if(!_0x37574e['ok']){const _0x32361f=await _0x37574e['json']();throw _0x32361f;}return _0x37574e['json']();}catch(_0x30c9dc){throw _0x30c9dc;}}
|
|
13
13
|
|
|
14
|
-
function performaceTarget(
|
|
14
|
+
function performaceTarget(_0x154bbc){if(!_0x154bbc)return {'performance_target':null,'passing_score':null};const _0x2936a8=_0x154bbc['match'](/\d+/g);return {'performance_target':_0x2936a8?.[0x0]?parseInt(_0x2936a8[0x0],0xa):null,'passing_score':_0x2936a8?.[0x1]?parseInt(_0x2936a8[0x1],0xa):null};}
|
|
15
15
|
|
|
16
|
-
function extractInstructionalVerb(
|
|
16
|
+
function extractInstructionalVerb(_0x2077c6){const _0x3d009e=_0x2077c6['trim'](),_0x5a41c5=/\b(will|shall)\b\s+(?:be\s+able\s+to\s+)?([a-zA-Z]+)/i,_0x2470ba=_0x3d009e['match'](_0x5a41c5);return _0x2470ba&&_0x2470ba[0x2]!==undefined?_0x2470ba[0x2]:null;}
|
|
17
17
|
|
|
18
|
-
const HEADERS={'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(
|
|
18
|
+
const HEADERS={'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(_0x3d1e2f){let _0x43d64d={'headerRowIndex':-1,'coIdx':-1,'iloIdx':-1,'assessToolIdx':-1,'perfTargetIdx':-1};for(let _0x3803d9=0x0;_0x3803d9<Math['min'](_0x3d1e2f['length'],0x14);_0x3803d9++){const _0x4f48be=(_0x3d1e2f[_0x3803d9]??[])['map'](_0x4ec934=>_0x4ec934['toLowerCase']()['trim']()),_0x5589e8=_0x4f48be['findIndex'](_0x2cc4d9=>HEADERS['co']['some'](_0x364052=>_0x2cc4d9['includes'](_0x364052))),_0x4f99cc=_0x4f48be['findIndex'](_0x4ac8df=>HEADERS['ilo']['some'](_0x5a0f6b=>_0x4ac8df['includes'](_0x5a0f6b))),_0x51332a=_0x4f48be['findIndex'](_0x17e06a=>HEADERS['assessTool']['some'](_0x5c7fef=>_0x17e06a['includes'](_0x5c7fef))),_0x2bfae4=_0x4f48be['findIndex'](_0x4be0b2=>HEADERS['perfTarget']['some'](_0x497bbd=>_0x4be0b2['includes'](_0x497bbd))),_0x1a488e=[_0x5589e8,_0x4f99cc,_0x51332a,_0x2bfae4]['filter'](_0x7b0bce=>_0x7b0bce!==-1)['length'];if(_0x1a488e>=0x3){_0x43d64d={'headerRowIndex':_0x3803d9,'coIdx':_0x5589e8,'iloIdx':_0x4f99cc,'assessToolIdx':_0x51332a,'perfTargetIdx':_0x2bfae4};break;}}return _0x43d64d;}
|
|
19
19
|
|
|
20
|
-
function parseCOAEP(
|
|
20
|
+
function parseCOAEP(_0x57e6ce){const _0x1a478c=_0x4ce8b3['parse'](_0x57e6ce,{'skipEmptyLines':![]})['data'],_0x250764={'COAEP':{'faculty':null,'course':null,'sy':null,'semester':null,'co':[]}},{headerRowIndex:_0x59dd16,coIdx:_0x2befbb,iloIdx:_0x583253,assessToolIdx:_0xb3cc58,perfTargetIdx:_0x42061c}=getCoaepHeader(_0x1a478c);if(_0x59dd16===-1)return {'error':'Could\x20not\x20auto-detect\x20header\x20row.','message':'Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.'};_0x1a478c['forEach'](_0x1636f3=>{const _0x31c07e=_0x1636f3['indexOf']('Name\x20of\x20Faculty:'),_0x5543c6=_0x1636f3['indexOf']('School\x20Year'),_0x186899=_0x1636f3['indexOf']('Course:'),_0x313a86=_0x1636f3['indexOf']('Semester');_0x31c07e!==-1&&(_0x250764['COAEP']['faculty']=_0x1636f3[_0x31c07e+0x1]?.['trim']()||_0x250764['COAEP']['faculty']);_0x5543c6!==-1&&(_0x250764['COAEP']['sy']=_0x1636f3[_0x5543c6+0x1]?.['trim']()||_0x250764['COAEP']['sy']);_0x186899!==-1&&(_0x250764['COAEP']['course']=_0x1636f3[_0x186899+0x1]?.['trim']()||_0x250764['COAEP']['course']);if(_0x313a86!==-1){const _0x181630=_0x1636f3[_0x313a86+0x1]?.['trim']()||'',_0x219315=_0x181630['match'](/\d+/)?.[0x0];_0x250764['COAEP']['semester']=_0x219315?parseInt(_0x219315,0xa):_0x250764['COAEP']['semester'];}});let _0x353b03=null;return _0x1a478c['forEach']((_0x109171,_0x15474c)=>{if(_0x15474c<=_0x59dd16)return;let _0x5f4898=_0x109171[_0x2befbb-0x1]?.['trim']()||'',_0x9e8026=_0x109171[_0x2befbb]?.['trim']()||'';/^\d+$/['test'](_0x109171[_0x2befbb]?.['trim']()||'')&&(_0x5f4898=_0x109171[_0x2befbb]?.['trim']()||'',_0x9e8026=_0x109171[_0x2befbb+0x1]?.['trim']()||'');const _0x3d12de=_0x109171[_0x583253]?.['trim']()||'',_0x2503e7=_0x109171[_0xb3cc58]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',_0x497453=_0x109171[_0x42061c]?.['replace'](/\s+/g,'\x20')['trim']()||'';if(_0x5f4898&&/^\d+$/['test'](_0x5f4898)){_0x353b03&&_0x250764['COAEP']['co']['push'](_0x353b03);const _0x4eb0d0=_0x9e8026,_0x2cd063=extractInstructionalVerb(_0x4eb0d0)||'';_0x353b03={'statement':_0x4eb0d0,'verb':_0x2cd063,'ilo':[]};}if(_0x353b03&&_0x3d12de&&_0x497453){const _0x437eb9=_0x3d12de['replace'](/^ILO\d+[:.]?\s*/,'');if(_0x437eb9['match'](/^(Revision|Prepared|Date|Approved|Effectivity|Page)/i)||_0x437eb9['length']<0xa)return;let _0x5eeec5=_0x2503e7;if(!_0x5eeec5&&_0x437eb9['includes'](':')){const _0x44dadc=_0x437eb9['match'](/^ILO\d+:\s*(.+?)(?:\s*\(|$)/);_0x44dadc&&(_0x5eeec5=_0x44dadc[0x1]?.['trim']()||'');}const {performance_target:_0x118ff5,passing_score:_0x3d117c}=performaceTarget(_0x497453);_0x353b03['ilo']['push']({'statement':_0x437eb9,'verb':extractInstructionalVerb(_0x437eb9)||'','assessment_tool':_0x5eeec5,'performance_target':_0x118ff5,'passing_score':_0x3d117c});}}),_0x353b03&&_0x250764['COAEP']['co']['push'](_0x353b03),_0x250764;}
|
|
21
21
|
|
|
22
|
-
async function uploadCOAEP(
|
|
22
|
+
async function uploadCOAEP(_0x569b29,_0x5c31ef,_0xd03023){try{const _0x43870d=await convertToCSVFile(_0x5c31ef),_0x10d8a3=await _0x43870d['text'](),_0x59b000=parseCOAEP(_0x10d8a3);console['log'](_0x59b000);const _0x1db01d=await fetch(_0x569b29+'/coaeps/upload?course_id='+_0xd03023,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x59b000)});if(!_0x1db01d['ok']){const _0x3bc3c6=await _0x1db01d['json']();throw _0x3bc3c6;}return _0x1db01d['json']();}catch(_0x597ae8){throw _0x597ae8;}}
|
|
23
23
|
|
|
24
|
-
async function uploadEnrolledStudent(
|
|
24
|
+
async function uploadEnrolledStudent(_0x2ccbed,_0x32dc85){try{const _0x17674d=await convertToCSVFile(_0x32dc85),_0x28124b=new FormData();_0x28124b['append']('csvFile',_0x17674d);const _0x39ae3c=await fetch(_0x2ccbed+'/enrolled-students/upload',{'method':'POST','body':_0x28124b});if(!_0x39ae3c['ok']){const _0x30afed=await _0x39ae3c['json']();throw _0x30afed;}return _0x39ae3c['json']();}catch(_0x3d010b){throw _0x3d010b;}}
|
|
25
25
|
|
|
26
|
-
function parseClassList(
|
|
26
|
+
function parseClassList(_0xd96389){const _0x53cb36=_0x4ce8b3['parse'](_0xd96389,{'skipEmptyLines':!![]})['data'];let _0x117806='',_0x5b4ccf='',_0x37de24='';const _0xe18a70=[];return _0x53cb36['forEach'](_0x41a48b=>{const _0x3a89=_0x41a48b['map'](_0x5f5198=>(_0x5f5198??'')['toString']()['trim']()),_0x4602c2=_0x3a89[0x0]??'';if(_0x4602c2['startsWith']('Course\x20No:')){const _0x5f2c12=_0x4602c2['replace']('Course\x20No:','')['trim'](),_0xd3a440=_0x5f2c12['split'](/\s+/);_0x37de24=_0xd3a440[0x0]??'';const [_0x4d194d,_0x1f4059]=(_0xd3a440[0x1]??'')['split']('-');_0x5b4ccf=_0x4d194d??'';const _0x45f3bc=(_0x1f4059??'')['match'](/[a-z]$/);_0x117806=_0x45f3bc?_0x45f3bc[0x0]:'';}if(/^\d+$/['test'](_0x4602c2)){const _0x33da5e=_0x3a89[0x2]??'';_0xe18a70['push']({'subj_code':_0x37de24,'student_no':_0x33da5e,'course_id':_0x5b4ccf,'section':_0x117806});}}),{'enrolledCourses':_0xe18a70};}
|
|
27
27
|
|
|
28
|
-
async function uploadClassList(
|
|
28
|
+
async function uploadClassList(_0x5486be,_0x1e5795,_0x377f4e,_0x97408a){try{const _0x255d61=await convertToCSVFile(_0x1e5795),_0x25f317=await _0x255d61['text'](),_0x65101e=parseClassList(_0x25f317),_0x188444='subj_code='+_0x377f4e+'&period_id='+_0x97408a,_0x15c3b6=await fetch(_0x5486be+'/enrolled-courses/upload?'+_0x188444,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x65101e)});if(!_0x15c3b6['ok']){const _0x2951f4=await _0x15c3b6['json']();throw _0x2951f4;}return _0x15c3b6['json']();}catch(_0x4a1a77){throw _0x4a1a77;}}
|
|
29
29
|
|
|
30
|
-
function parseAssessmentCsv(
|
|
30
|
+
function parseAssessmentCsv(_0x5e7f60){const {data:_0x428faa}=_0x4ce8b3['parse'](_0x5e7f60,{'skipEmptyLines':!![]}),_0x1ed6c2=_0x428faa['filter'](_0x5e63fe=>_0x5e63fe['length']>0x0),_0x199c9d=_0x1ed6c2['find'](_0x11dbc3=>_0x11dbc3['some'](_0x3e146e=>_0x3e146e?.['includes']('Faculty'))),_0x8a9f40=_0x199c9d?_0x199c9d['findIndex'](_0x4819fb=>_0x4819fb?.['includes']('Faculty')):-1,_0x351ecc=_0x8a9f40!==-1&&_0x199c9d?_0x199c9d[_0x8a9f40+0x2]?.['replace'](/"/g,'')['trim']()??'':'',_0x1cc1e9=_0x1ed6c2['find'](_0x2fc801=>_0x2fc801['some'](_0x3e1211=>_0x3e1211?.['includes']('Semester'))),_0x53d959=_0x1cc1e9?_0x1cc1e9['findIndex'](_0x50c82c=>_0x50c82c?.['includes']('Semester')):-1,_0x13971f=_0x53d959!==-1&&_0x1cc1e9?_0x1cc1e9[_0x53d959+0x2]?.['trim']()??'':'',_0x207a7c=_0x13971f['includes']('1st')?0x1:_0x13971f['includes']('2nd')?0x2:0x0,_0x2e6bc6=_0x1ed6c2['find'](_0x276456=>_0x276456['some'](_0x2b2b79=>_0x2b2b79?.['includes']('Course\x20&\x20Sec'))),_0x3ad234=_0x2e6bc6?_0x2e6bc6['findIndex'](_0x3dceb1=>_0x3dceb1?.['includes']('Course\x20&\x20Sec')):-1,_0x53c5cd=_0x3ad234!==-1&&_0x2e6bc6?_0x2e6bc6[_0x3ad234+0x2]?.['trim']()??'':'';let _0x4100bd='',_0x4bf4ec='';if(_0x53c5cd){const _0x3234de=_0x53c5cd['match'](/^([A-Za-z0-9]+)-?([A-Za-z]+)?/);_0x3234de&&(_0x4100bd=_0x3234de[0x1]??'',_0x3234de[0x2]&&(_0x4bf4ec=_0x3234de[0x2]['replace'](/^OC/i,'')));}const _0x1ad591=_0x1ed6c2['find'](_0x1877c7=>_0x1877c7['some'](_0x3ddfab=>_0x3ddfab?.['includes']('School\x20Year'))),_0x2bd8f6=_0x1ad591?_0x1ad591['findIndex'](_0x3cf468=>_0x3cf468?.['includes']('School\x20Year')):-1,_0xeadc0b=_0x2bd8f6!==-1&&_0x1ad591?_0x1ad591[_0x2bd8f6+0x2]?.['trim']()??'':'';let _0x5958ef=0x0;if(_0xeadc0b){const _0x3aba23=_0xeadc0b['match'](/(\d{4})-(\d{4})/);if(_0x3aba23){const _0x144bbc=(_0x3aba23[0x1]??'')['slice'](0x2),_0xe5b68a=(_0x3aba23[0x2]??'')['slice'](0x2);_0x5958ef=parseInt(_0x144bbc+_0xe5b68a,0xa);}}const _0x46e59e={'faculty':_0x351ecc,'course':_0x4100bd,'section':_0x4bf4ec,'semester':_0x207a7c,'sy':_0x5958ef},_0x75034f=_0x1ed6c2['findIndex'](_0x21ba9c=>_0x21ba9c['some'](_0x4fa2dc=>_0x4fa2dc?.['trim']()==='CO\x20#'));if(_0x75034f===-1)throw new Error('CO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x32de3=_0x1ed6c2[_0x75034f+0x1];if(!_0x32de3)throw new Error('ILO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x2aba5e={};let _0x284c11=0x1,_0x51a1e2=0x1;for(let _0x1f32a8=0x3;_0x1f32a8<_0x32de3['length'];_0x1f32a8++){const _0x572c56=_0x32de3[_0x1f32a8];if(!_0x572c56)continue;const _0xfe5697='co'+_0x284c11;if(!_0x2aba5e[_0xfe5697])_0x2aba5e[_0xfe5697]=[];_0x2aba5e[_0xfe5697]['push']('ilo'+_0x51a1e2),_0x51a1e2++,_0x51a1e2>0x3&&(_0x284c11++,_0x51a1e2=0x1);}const _0x5a01bd=_0x1ed6c2['findIndex'](_0x73fdcf=>_0x73fdcf['includes']('Name\x20of\x20Students'));if(_0x5a01bd===-1)throw new Error('Student\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x5b2e79=_0x1ed6c2[_0x5a01bd];if(!_0x5b2e79)throw new Error('Student\x20header\x20row\x20is\x20missing');const _0x515a9d=_0x5b2e79['findIndex'](_0x3e8b6b=>_0x3e8b6b?.['includes']('Name\x20of\x20Students'));if(_0x515a9d===-1)throw new Error('Name\x20of\x20Students\x20column\x20not\x20found\x20in\x20CSV');const _0x2400a1=_0x515a9d+0x2,_0x20f8b9=[];for(let _0x584fe5=_0x5a01bd+0x1;_0x584fe5<_0x1ed6c2['length'];_0x584fe5++){const _0x30ea35=_0x1ed6c2[_0x584fe5];if(!_0x30ea35)continue;if(_0x30ea35['some'](_0x9cf779=>_0x9cf779?.['toUpperCase']()['includes']('TOTAL\x20STUDENTS')||_0x9cf779?.['toUpperCase']()['includes']('ACHIEVED\x20THE\x20MINIMUM')||_0x9cf779?.['toUpperCase']()['includes']('INACTIVE')||_0x9cf779?.['toUpperCase']()['includes']('AVERAGE')))continue;if(!_0x30ea35[_0x515a9d])continue;const _0x3f3531=_0x30ea35[_0x515a9d]['replace'](/"/g,'')['trim'](),_0x33072d=_0x30ea35['slice'](_0x2400a1)['map'](_0x147b51=>_0x147b51===null?null:!isNaN(Number(_0x147b51))?parseFloat(_0x147b51):0x0);let _0xcc2c32=0x0;const _0x1c722a={};Object['entries'](_0x2aba5e)['forEach'](([_0x31b53b,_0xa10e49])=>{const _0x9b55ed={};_0xa10e49['forEach'](_0x344f25=>{_0x9b55ed[_0x344f25]=_0x33072d[_0xcc2c32]??0x0,_0xcc2c32++;}),_0x1c722a[_0x31b53b]={'transmuted_score':_0x9b55ed};}),_0x20f8b9['push']({'student_name':_0x3f3531,'coaep':_0x1c722a});}const _0x6b3997=_0x1ed6c2['find'](_0xa32ea4=>_0xa32ea4['some'](_0xfab332=>_0xfab332?.['includes']('ACHIEVED\x20THE\x20MINIMUM'))),_0x11cfbc=_0x1ed6c2['find'](_0x1fc591=>_0x1fc591['some'](_0x17849c=>_0x17849c?.['includes']('AVERAGE'))),_0x5d7704=_0x6b3997?_0x6b3997['slice'](_0x2400a1)['map'](_0x452a2b=>_0x452a2b&&!isNaN(Number(_0x452a2b))?parseInt(_0x452a2b):0x0):[],_0x39bd83=_0x11cfbc?_0x11cfbc['slice'](_0x2400a1)['map'](_0x29fe67=>_0x29fe67&&_0x29fe67!=='#DIV/0!'&&!isNaN(Number(_0x29fe67))?parseInt(_0x29fe67):0x0):[],_0x4d2af9={};let _0x5aa584=0x0;return Object['entries'](_0x2aba5e)['forEach'](([_0x40b794,_0x452ce9])=>{if(!_0x4d2af9[_0x40b794])_0x4d2af9[_0x40b794]={};_0x452ce9['forEach'](_0x53d3c1=>{_0x4d2af9[_0x40b794][_0x53d3c1]={'achievedMinimum':_0x5d7704[_0x5aa584]??0x0,'average':_0x39bd83[_0x5aa584]??0x0},_0x5aa584++;});}),{'assessmentData':{'classAssignment':_0x46e59e,'student':_0x20f8b9,'total':_0x4d2af9}};}
|
|
31
31
|
|
|
32
|
-
async function uploadAssessmentData(
|
|
32
|
+
async function uploadAssessmentData(_0x1933f6,_0x52075e){try{const _0x3294a7=await convertToCSVFile(_0x52075e),_0x15ef86=await _0x3294a7['text'](),_0x327a91=parseAssessmentCsv(_0x15ef86),_0x275f32=await fetch(_0x1933f6+'/assessment-data/upload',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x327a91)});if(!_0x275f32['ok']){const _0x5bd4cc=await _0x275f32['json']();throw _0x5bd4cc;}return _0x275f32['json']();}catch(_0xa5e3f6){throw _0xa5e3f6;}}
|
|
33
33
|
|
|
34
|
-
async function uploadDeptFaculty(
|
|
34
|
+
async function uploadDeptFaculty(_0x224006,_0x42de28){try{const _0x516bcc=await convertToCSVFile(_0x42de28),_0x1886d8=new FormData();_0x1886d8['append']('csvFile',_0x516bcc);const _0x1b52d8=await fetch(_0x224006+'/dept-faculties/upload',{'method':'POST','body':_0x1886d8});if(!_0x1b52d8['ok']){const _0x47355f=await _0x1b52d8['json']();throw _0x47355f;}return _0x1b52d8['json']();}catch(_0x9f203c){throw _0x9f203c;}}
|
|
35
35
|
|
|
36
|
-
class Client{['BASE_URL'];constructor(
|
|
36
|
+
class Client{['BASE_URL'];constructor(_0x54bd52){this['BASE_URL']=_0x54bd52;}['Parser'](){return {'curriculum':async _0x261e0a=>{const _0x14ec95=await uploadCurriculum(this['BASE_URL'],_0x261e0a);return _0x14ec95;},'courseOffering':async _0x238ce4=>{const _0xe37a94=await uploadCourseOffering(this['BASE_URL'],_0x238ce4);return _0xe37a94;},'coaep':async(_0x9b8a7a,_0x3b019d)=>{const _0x314d6c=await uploadCOAEP(this['BASE_URL'],_0x9b8a7a,_0x3b019d);return _0x314d6c;},'enrolledStudent':async _0x30c0b9=>{const _0x5e4086=await uploadEnrolledStudent(this['BASE_URL'],_0x30c0b9);return _0x5e4086;},'classlist':async(_0x12ea7e,_0x642fbf,_0x58be3d)=>{const _0x4c11e0=await uploadClassList(this['BASE_URL'],_0x12ea7e,_0x642fbf,_0x58be3d);return _0x4c11e0;},'assessmentData':async _0x2ccc6d=>{const _0x4c25aa=await uploadAssessmentData(this['BASE_URL'],_0x2ccc6d);return _0x4c25aa;},'deptFaculty':async _0x2f0cd8=>{const _0xb8b7f1=await uploadDeptFaculty(this['BASE_URL'],_0x2f0cd8);return _0xb8b7f1;}};}}
|
|
37
37
|
|
|
38
38
|
export { Client as default };
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PO } from "../types/poaep";
|
|
2
|
+
declare const parsePOAEP: (csvString: string) => {
|
|
3
|
+
success: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
data: PO[];
|
|
6
|
+
error?: never;
|
|
7
|
+
} | {
|
|
8
|
+
success: boolean;
|
|
9
|
+
error: string;
|
|
10
|
+
message: string;
|
|
11
|
+
data?: never;
|
|
12
|
+
};
|
|
13
|
+
export default parsePOAEP;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function uploadPOAEP(url: string, xls: File, token: string, course_id: string, curr_id: string, period_id: number): Promise<Record<string, unknown>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/poaep.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface PO {
|
|
2
|
+
po_desc: string;
|
|
3
|
+
seq_no: number;
|
|
4
|
+
PerfIndicators: PerfIndicator[];
|
|
5
|
+
}
|
|
6
|
+
export interface PerfIndicator {
|
|
7
|
+
pi_desc: string;
|
|
8
|
+
FormativeCourses: PIFormative[];
|
|
9
|
+
SummativeCourse: PISummative;
|
|
10
|
+
AssessmentTool: PIAssessmentTool;
|
|
11
|
+
PerformanceTargets: PIPerfTarget;
|
|
12
|
+
}
|
|
13
|
+
export interface PIFormative {
|
|
14
|
+
course_id: string;
|
|
15
|
+
cognitive_level: number;
|
|
16
|
+
}
|
|
17
|
+
export interface PISummative {
|
|
18
|
+
course_id: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PIAssessmentTool {
|
|
21
|
+
at_desc: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PIPerfTarget {
|
|
24
|
+
target_percent: number;
|
|
25
|
+
min_score: number;
|
|
26
|
+
}
|