@obe-loms/coms-parser 1.0.0

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 ADDED
@@ -0,0 +1,32 @@
1
+ import _0x4aefdc from 'papaparse';
2
+ import * as _0x3a54cb from 'xlsx';
3
+
4
+ function parseCurriculum(_0x4c65e8){let _0x532c63='',_0xecac9d='',_0x16b58a=0x0,_0xe9b69a=null;const _0x33f16a=[];return _0x4aefdc['parse'](_0x4c65e8,{'skipEmptyLines':!![],'complete':_0x1478a1=>{_0x1478a1['data']['forEach'](_0x28775c=>{const _0x4444a7=_0x28775c['map'](_0x11b3b5=>(_0x11b3b5??'')['toString']()['trim']()),_0x3fa8fa=_0x4444a7[0x0]??'';if(_0x3fa8fa['includes']('Rev#')){const _0x181c1e=_0x3fa8fa['match'](/([A-Z0-9]+)\s*-\s*.*:\s*(.*?)\s+Rev#\s*(\d+)/i);_0x181c1e&&(_0x532c63=_0x181c1e[0x1]?.['trim']()??'',_0xecac9d=_0x181c1e[0x2]?.['trim']()??'',_0x16b58a=parseInt(_0x181c1e[0x3]??'0',0xa));return;}if(/FIRST YEAR/i['test'](_0x3fa8fa)){_0xe9b69a=0x1;return;}if(/SECOND YEAR/i['test'](_0x3fa8fa)){_0xe9b69a=0x2;return;}if(/THIRD YEAR/i['test'](_0x3fa8fa)){_0xe9b69a=0x3;return;}if(/FOURTH YEAR/i['test'](_0x3fa8fa)){_0xe9b69a=0x4;return;}if(/FIFTH YEAR/i['test'](_0x3fa8fa)){_0xe9b69a=0x5;return;}if(/First Semester/i['test'](_0x3fa8fa)||/Second Semester/i['test'](_0x3fa8fa)||/Summer/i['test'](_0x3fa8fa))return;const _0x3aec97=[{'sem':0x1,'offset':0x0},{'sem':0x2,'offset':0x6},{'sem':0x3,'offset':0xc}];_0x3aec97['forEach'](({sem:_0x2be394,offset:_0x3163f5})=>{const _0x160e39=_0x4444a7[_0x3163f5]??'',_0x113034=_0x4444a7[_0x3163f5+0x1]??'',_0x464c9c=_0x4444a7[_0x3163f5+0x2]??'',_0x4ac04a=_0x4444a7[_0x3163f5+0x3]??'',_0x83279e=_0x4444a7[_0x3163f5+0x4]??'';_0x160e39&&_0xe9b69a&&_0x33f16a['push']({'curr_id':_0x532c63,'program_name':_0xecac9d,'revision_no':_0x16b58a,'year_level':_0xe9b69a,'sem':_0x2be394,'course_id':_0x160e39,'course_desc':_0x113034,'total_units':_0x464c9c,'lec_unit':_0x4ac04a,'lab_unit':_0x83279e});});});}}),_0x33f16a;}
5
+
6
+ function convertToCSVFile(_0x363188){return new Promise((_0x54b1f0,_0x3d665f)=>{const _0x275734=new FileReader();_0x275734['onload']=_0x249c5a=>{const _0x4aec9b=_0x249c5a['target']?.['result'];if(!_0x4aec9b){_0x3d665f(new Error('Failed\x20to\x20read\x20file'));return;}try{const _0x5ea1db=_0x3a54cb['read'](_0x4aec9b,{'type':'array'}),_0x15658c=_0x5ea1db['SheetNames'][0x0];if(!_0x15658c){_0x3d665f(new Error('No\x20sheets\x20found\x20in\x20workbook'));return;}const _0x360159=_0x5ea1db['Sheets'][_0x15658c];if(!_0x360159){_0x3d665f(new Error('No\x20sheets\x20found\x20in\x20worksheet'));return;}const _0x4c4ca3=_0x3a54cb['utils']['sheet_to_csv'](_0x360159),_0x3b7fde=_0x363188['name']['replace'](/\.[^/.]+$/,'.csv'),_0xa9ac15=new File([_0x4c4ca3],_0x3b7fde,{'type':'text/csv','lastModified':Date['now']()});_0x54b1f0(_0xa9ac15);}catch(_0x2f6040){_0x3d665f(_0x2f6040);}},_0x275734['onerror']=()=>{_0x3d665f(new Error('File\x20reading\x20failed'));},_0x275734['readAsArrayBuffer'](_0x363188);});}
7
+
8
+ async function uploadCurriculum(_0xebe15b,_0x4124d2){try{const _0x2c7bbb=await convertToCSVFile(_0x4124d2),_0x164574=await _0x2c7bbb['text'](),_0x2ee9f6=parseCurriculum(_0x164574),_0x6c5083=_0x4aefdc['unparse'](_0x2ee9f6),_0x51e71d=new File([_0x6c5083],_0x2c7bbb['name'],{'type':'text/csv'}),_0x1e14f0=new FormData();_0x1e14f0['append']('csvFile',_0x51e71d);const _0x343ad=await fetch(_0xebe15b+'/curr-courses/upload',{'method':'POST','body':_0x1e14f0});if(!_0x343ad['ok']){const _0x14883e=await _0x343ad['json']();throw _0x14883e;}return _0x343ad['json']();}catch(_0x247d1b){throw _0x247d1b;}}
9
+
10
+ function parseCourseOffering(_0x18f1b6){let _0x500854='',_0x132bd0='';const _0x5157db=[],_0x51d487=_0x4aefdc['parse'](_0x18f1b6,{'header':![],'skipEmptyLines':!![],'delimiter':','}),_0x19c02f=_0x51d487['data'];for(let _0x4ddba9=0x0;_0x4ddba9<Math['min'](0x5,_0x19c02f['length']);_0x4ddba9++){const _0x25c86f=_0x19c02f[_0x4ddba9];if(_0x25c86f&&_0x25c86f['length']>0x0){const _0x2aded9=_0x25c86f[0x0]?.['toString']()||'',_0x2142dd=_0x2aded9['match'](/(First|Second)\s+Sem\s+S\/Y\s+(\d{4}-\d{4})/i);if(_0x2142dd){_0x500854=_0x2142dd[0x1]?.['toLowerCase']()==='first'?'1':'2';if(_0x2142dd[0x2]){const _0x3bf9e9=_0x2142dd[0x2]['match'](/(\d{2})(\d{2})-(\d{2})(\d{2})/);_0x3bf9e9&&_0x3bf9e9[0x2]&&_0x3bf9e9[0x4]&&(_0x132bd0=_0x3bf9e9[0x2]+_0x3bf9e9[0x4]);}}}}let _0x93e96f=-1;for(let _0x441493=0x0;_0x441493<_0x19c02f['length'];_0x441493++){const _0x5b00b2=_0x19c02f[_0x441493];if(_0x5b00b2&&_0x5b00b2['some'](_0x5e2093=>_0x5e2093?.['toString']()['toUpperCase']()['includes']('CODE'))){_0x93e96f=_0x441493;break;}}if(_0x93e96f===-1)throw new Error('Could\x20not\x20find\x20header\x20row\x20in\x20CSV\x20data');for(let _0xb6ccbd=_0x93e96f+0x1;_0xb6ccbd<_0x19c02f['length'];_0xb6ccbd++){const _0x4fb315=_0x19c02f[_0xb6ccbd];if(!_0x4fb315||_0x4fb315['length']<0x8)continue;const _0x4b35b3=_0x4fb315[0x0]?.['toString']()['trim']()||'',_0x16913b=_0x4fb315[0x1]?.['toString']()['trim']()||'',_0x1be4cd=_0x4fb315[0x2]?.['toString']()['trim']()||'',_0x3e388e=_0x4fb315[0x3]?.['toString']()['trim']()||'',_0xdffe43=_0x4fb315[0x4]?.['toString']()['trim']()||'',_0x270364=_0x4fb315[0x5]?.['toString']()['trim']()||'',_0x2a11fc=_0x4fb315[0x6]?.['toString']()['trim']()||'',_0x4b008a=_0x4fb315[0x7]?.['toString']()['trim']()||'';if(!_0x4b35b3)continue;let _0x324f53=0x0;const _0x5bbae8=_0x3e388e['match'](/(\d+)/);_0x5bbae8&&_0x5bbae8[0x1]&&(_0x324f53=parseInt(_0x5bbae8[0x1],0xa));const _0x35f188={'sem':_0x500854,'school_year':_0x132bd0,'code':_0x4b35b3,'course_no':_0x16913b,'course_desc':_0x1be4cd,'unit':_0x324f53,'time':_0xdffe43,'days':_0x270364,'faculty':_0x2a11fc,'room':_0x4b008a};_0x5157db['push'](_0x35f188);}return _0x5157db;}
11
+
12
+ async function uploadCourseOffering(_0x1af96e,_0x5c2f3f){try{const _0x185371=await convertToCSVFile(_0x5c2f3f),_0x16c596=await _0x185371['text'](),_0xb8bcc6=parseCourseOffering(_0x16c596),_0x31692a=_0x4aefdc['unparse'](_0xb8bcc6),_0x4bad21=new File([_0x31692a],_0x185371['name'],{'type':'text/csv'}),_0x2e5b59=new FormData();_0x2e5b59['append']('csvFile',_0x4bad21);const _0x250590=await fetch(_0x1af96e+'/course-offerings/upload',{'method':'POST','body':_0x2e5b59});if(!_0x250590['ok']){const _0x13f373=await _0x250590['json']();throw _0x13f373;}return _0x250590['json']();}catch(_0x2a61a2){throw _0x2a61a2;}}
13
+
14
+ function performaceTarget(_0x166638){if(!_0x166638)return {'performance_target':null,'passing_score':null};const _0x1805d3=_0x166638['match'](/\d+/g);return {'performance_target':_0x1805d3?.[0x0]?parseInt(_0x1805d3[0x0],0xa):null,'passing_score':_0x1805d3?.[0x1]?parseInt(_0x1805d3[0x1],0xa):null};}
15
+
16
+ function parseCOAEP(_0xef4e57){const _0x3aa3c3=_0x4aefdc['parse'](_0xef4e57,{'skipEmptyLines':![]})['data'],_0x5edb43={'COAEP':{'faculty':null,'course':null,'sy':null,'semester':null,'co':[]}};_0x3aa3c3['forEach'](_0x43565d=>{_0x43565d[0x1]?.['includes']('Name\x20of\x20Faculty:')&&(_0x5edb43['COAEP']['faculty']=_0x43565d[0x2]?.['trim']()||null);if(_0x43565d['includes']('School\x20Year')){const _0x32eed8=_0x43565d['indexOf']('School\x20Year');_0x5edb43['COAEP']['sy']=_0x43565d[_0x32eed8+0x1]?.['trim']()||null;}if(_0x43565d[0x1]?.['includes']('Course:')){const _0x68e409=_0x43565d[0x2]?.['trim']()||'';_0x5edb43['COAEP']['course']=_0x68e409||null;}if(_0x43565d['includes']('Semester')){const _0x4defae=_0x43565d['indexOf']('Semester'),_0x4ca9ae=_0x43565d[_0x4defae+0x1]?.['trim']()||'',_0x367fb9=_0x4ca9ae['match'](/\d+/)?.[0x0];_0x5edb43['COAEP']['semester']=_0x367fb9?parseInt(_0x367fb9,0xa):null;}});let _0x162ebd=null;return _0x3aa3c3['forEach'](_0x4a55ed=>{const _0x10cd55=_0x4a55ed[0x0]?.['trim']()||'',_0x27a1f5=_0x4a55ed[0x1]?.['trim']()||'',_0x17f175=_0x4a55ed[0x3]?.['trim']()||'';if(_0x10cd55&&/^\d+$/['test'](_0x10cd55)){_0x162ebd&&_0x5edb43['COAEP']['co']['push'](_0x162ebd);const _0x1a80a8=_0x27a1f5,_0x42affd=_0x1a80a8['trim']()['split'](/\s+/)[0x0]??'';_0x162ebd={'statement':_0x1a80a8,'verb':_0x42affd,'ilo':[]};}if(_0x162ebd&&_0x17f175){const _0x1d5bcc=_0x17f175['replace'](/^ILO\d+\s*/,'')['replace'](/\s+/g,'\x20')['trim'](),_0x55bdda=_0x4a55ed[0x4]?.['replace'](/\s+/g,'\x20')['trim']()||'',_0x5d052a=_0x4a55ed[0x5]?.['replace'](/\s+/g,'\x20')['trim']()||'',{performance_target:_0x4a0bf1,passing_score:_0x766931}=performaceTarget(_0x5d052a);_0x162ebd['ilo']['push']({'statement':_0x1d5bcc,'verb':_0x1d5bcc['split'](/\s+/)[0x0]??'','assessment_tool':_0x55bdda,'performance_target':_0x4a0bf1,'passing_score':_0x766931});}}),_0x162ebd&&_0x5edb43['COAEP']['co']['push'](_0x162ebd),_0x5edb43;}
17
+
18
+ async function uploadCOAEP(_0x7ba016,_0x5f27bd,_0x5b17df){try{const _0x5c036f=await convertToCSVFile(_0x5f27bd),_0xa8fad=await _0x5c036f['text'](),_0x24b0e9=parseCOAEP(_0xa8fad),_0x5be2e2=await fetch(_0x7ba016+'/coaeps/upload?course_id='+_0x5b17df,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x24b0e9)});if(!_0x5be2e2['ok']){const _0x5a0c58=await _0x5be2e2['json']();throw _0x5a0c58;}return _0x5be2e2['json']();}catch(_0xfbd41b){throw _0xfbd41b;}}
19
+
20
+ async function uploadEnrolledStudent(_0x47e15a,_0xea8db8){try{const _0x296b37=await convertToCSVFile(_0xea8db8),_0x4d48c8=new FormData();_0x4d48c8['append']('csvFile',_0x296b37);const _0x25e5c4=await fetch(_0x47e15a+'/enrolled-students/upload',{'method':'POST','body':_0x4d48c8});if(!_0x25e5c4['ok']){const _0x3def63=await _0x25e5c4['json']();throw _0x3def63;}return _0x25e5c4['json']();}catch(_0x54671d){throw _0x54671d;}}
21
+
22
+ function parseClassList(_0x4245cf){const _0x307729=_0x4aefdc['parse'](_0x4245cf,{'skipEmptyLines':!![]})['data'];let _0x2777cc='',_0x4ed981='',_0x1968e2='';const _0x54300a=[];return _0x307729['forEach'](_0x514569=>{const _0x552e27=_0x514569['map'](_0x4c415b=>(_0x4c415b??'')['toString']()['trim']()),_0x2a0f60=_0x552e27[0x0]??'';if(_0x2a0f60['startsWith']('Course\x20No:')){const _0x547b8b=_0x2a0f60['replace']('Course\x20No:','')['trim'](),_0x3b97bd=_0x547b8b['split'](/\s+/);_0x1968e2=_0x3b97bd[0x0]??'';const [_0x5296bb,_0xa8f3a4]=(_0x3b97bd[0x1]??'')['split']('-');_0x4ed981=_0x5296bb??'';const _0x15b407=(_0xa8f3a4??'')['match'](/[a-z]$/);_0x2777cc=_0x15b407?_0x15b407[0x0]:'';}if(/^\d+$/['test'](_0x2a0f60)){const _0x70a4cc=_0x552e27[0x2]??'';_0x54300a['push']({'subj_code':_0x1968e2,'student_no':_0x70a4cc,'course_id':_0x4ed981,'section':_0x2777cc});}}),{'enrolledCourses':_0x54300a};}
23
+
24
+ async function uploadClassList(_0x35a693,_0x298214,_0x5d569b,_0x56c7a8){try{const _0x394e86=await convertToCSVFile(_0x298214),_0x22e8f1=await _0x394e86['text'](),_0x578e2a=parseClassList(_0x22e8f1),_0x52bd95='subj_code='+_0x5d569b+'&period_id='+_0x56c7a8,_0x28eae3=await fetch(_0x35a693+'/enrolled-courses/upload?'+_0x52bd95,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x578e2a)});if(!_0x28eae3['ok']){const _0x4625cd=await _0x28eae3['json']();throw _0x4625cd;}return _0x28eae3['json']();}catch(_0x1573b5){throw _0x1573b5;}}
25
+
26
+ function parseAssessmentCsv(_0x6ccf99){const {data:_0x452d2f}=_0x4aefdc['parse'](_0x6ccf99,{'skipEmptyLines':!![]}),_0x1530d8=_0x452d2f['filter'](_0xc34218=>_0xc34218['length']>0x0),_0x5510f5=_0x1530d8['find'](_0x2fe06e=>_0x2fe06e['some'](_0x47579b=>_0x47579b?.['includes']('Faculty'))),_0x53dad8=_0x5510f5?_0x5510f5['findIndex'](_0x1769af=>_0x1769af?.['includes']('Faculty')):-1,_0x2cf537=_0x53dad8!==-1&&_0x5510f5?_0x5510f5[_0x53dad8+0x2]?.['replace'](/"/g,'')['trim']()??'':'',_0x9769cc=_0x1530d8['find'](_0x57fe3f=>_0x57fe3f['some'](_0x3bb155=>_0x3bb155?.['includes']('Semester'))),_0x41d9e1=_0x9769cc?_0x9769cc['findIndex'](_0xf0c7ab=>_0xf0c7ab?.['includes']('Semester')):-1,_0x2f6f28=_0x41d9e1!==-1&&_0x9769cc?_0x9769cc[_0x41d9e1+0x2]?.['trim']()??'':'',_0x46e8df=_0x2f6f28['includes']('1st')?0x1:_0x2f6f28['includes']('2nd')?0x2:0x0,_0x229be6=_0x1530d8['find'](_0x1f03d8=>_0x1f03d8['some'](_0x2457d8=>_0x2457d8?.['includes']('Course\x20&\x20Sec'))),_0x4bdd6a=_0x229be6?_0x229be6['findIndex'](_0x1f4484=>_0x1f4484?.['includes']('Course\x20&\x20Sec')):-1,_0x25080e=_0x4bdd6a!==-1&&_0x229be6?_0x229be6[_0x4bdd6a+0x2]?.['trim']()??'':'';let _0x4cee11='',_0x4f89f6='';if(_0x25080e){const _0xc59b77=_0x25080e['match'](/^([A-Za-z0-9]+)-?([A-Za-z]+)?/);_0xc59b77&&(_0x4cee11=_0xc59b77[0x1]??'',_0xc59b77[0x2]&&(_0x4f89f6=_0xc59b77[0x2]['replace'](/^OC/i,'')));}const _0x83877=_0x1530d8['find'](_0x1e700d=>_0x1e700d['some'](_0x5cb693=>_0x5cb693?.['includes']('School\x20Year'))),_0x36112d=_0x83877?_0x83877['findIndex'](_0x1a3860=>_0x1a3860?.['includes']('School\x20Year')):-1,_0x54d909=_0x36112d!==-1&&_0x83877?_0x83877[_0x36112d+0x2]?.['trim']()??'':'';let _0x5029fe=0x0;if(_0x54d909){const _0x5cacf1=_0x54d909['match'](/(\d{4})-(\d{4})/);if(_0x5cacf1){const _0x4c9a7d=(_0x5cacf1[0x1]??'')['slice'](0x2),_0xb9fd87=(_0x5cacf1[0x2]??'')['slice'](0x2);_0x5029fe=parseInt(_0x4c9a7d+_0xb9fd87,0xa);}}const _0x19f17f={'faculty':_0x2cf537,'course':_0x4cee11,'section':_0x4f89f6,'semester':_0x46e8df,'sy':_0x5029fe},_0x387a0d=_0x1530d8['findIndex'](_0x2de900=>_0x2de900['some'](_0x4314a4=>_0x4314a4?.['trim']()==='CO\x20#'));if(_0x387a0d===-1)throw new Error('CO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x23767a=_0x1530d8[_0x387a0d+0x1];if(!_0x23767a)throw new Error('ILO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x4b1a9e={};let _0x2392af=0x1,_0x85b509=0x1;for(let _0x1cd4a6=0x3;_0x1cd4a6<_0x23767a['length'];_0x1cd4a6++){const _0x476dc0=_0x23767a[_0x1cd4a6];if(!_0x476dc0)continue;const _0x426311='co'+_0x2392af;if(!_0x4b1a9e[_0x426311])_0x4b1a9e[_0x426311]=[];_0x4b1a9e[_0x426311]['push']('ilo'+_0x85b509),_0x85b509++,_0x85b509>0x3&&(_0x2392af++,_0x85b509=0x1);}const _0x2e696a=_0x1530d8['findIndex'](_0x25a0a4=>_0x25a0a4['includes']('Name\x20of\x20Students'));if(_0x2e696a===-1)throw new Error('Student\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x2f3cc8=_0x1530d8[_0x2e696a];if(!_0x2f3cc8)throw new Error('Student\x20header\x20row\x20is\x20missing');const _0x55db5d=_0x2f3cc8['findIndex'](_0xb5fe31=>_0xb5fe31?.['includes']('Name\x20of\x20Students'));if(_0x55db5d===-1)throw new Error('Name\x20of\x20Students\x20column\x20not\x20found\x20in\x20CSV');const _0x1c3380=_0x55db5d+0x2,_0x4ec9fb=[];for(let _0x3ab645=_0x2e696a+0x1;_0x3ab645<_0x1530d8['length'];_0x3ab645++){const _0x1706d8=_0x1530d8[_0x3ab645];if(!_0x1706d8)continue;if(_0x1706d8['some'](_0x1bbda4=>_0x1bbda4?.['toUpperCase']()['includes']('TOTAL\x20STUDENTS')||_0x1bbda4?.['toUpperCase']()['includes']('ACHIEVED\x20THE\x20MINIMUM')||_0x1bbda4?.['toUpperCase']()['includes']('INACTIVE')||_0x1bbda4?.['toUpperCase']()['includes']('AVERAGE')))continue;if(!_0x1706d8[_0x55db5d])continue;const _0x1ec0b1=_0x1706d8[_0x55db5d]['replace'](/"/g,'')['trim'](),_0xb629b0=_0x1706d8['slice'](_0x1c3380)['map'](_0x738f31=>_0x738f31&&!isNaN(Number(_0x738f31))?parseFloat(_0x738f31):0x0);let _0x15955a=0x0;const _0x5afeff={};Object['entries'](_0x4b1a9e)['forEach'](([_0x34d167,_0x5d6070])=>{const _0x235b49={};_0x5d6070['forEach'](_0x2420f6=>{_0x235b49[_0x2420f6]=_0xb629b0[_0x15955a]??0x0,_0x15955a++;}),_0x5afeff[_0x34d167]={'transmuted_score':_0x235b49};}),_0x4ec9fb['push']({'student_name':_0x1ec0b1,'coaep':_0x5afeff});}const _0xa8d442=_0x1530d8['find'](_0xfad513=>_0xfad513['some'](_0x4ca460=>_0x4ca460?.['includes']('ACHIEVED\x20THE\x20MINIMUM'))),_0x2ce0bb=_0x1530d8['find'](_0x279d36=>_0x279d36['some'](_0x3e88da=>_0x3e88da?.['includes']('AVERAGE'))),_0x264722=_0xa8d442?_0xa8d442['slice'](_0x1c3380)['map'](_0x41a423=>_0x41a423&&!isNaN(Number(_0x41a423))?parseInt(_0x41a423):0x0):[],_0x4fca45=_0x2ce0bb?_0x2ce0bb['slice'](_0x1c3380)['map'](_0x884b2f=>_0x884b2f&&_0x884b2f!=='#DIV/0!'&&!isNaN(Number(_0x884b2f))?parseInt(_0x884b2f):0x0):[],_0x1b5552={};let _0x46a635=0x0;return Object['entries'](_0x4b1a9e)['forEach'](([_0x3e328f,_0x2bf3d6])=>{if(!_0x1b5552[_0x3e328f])_0x1b5552[_0x3e328f]={};_0x2bf3d6['forEach'](_0x1df0b4=>{_0x1b5552[_0x3e328f][_0x1df0b4]={'achievedMinimum':_0x264722[_0x46a635]??0x0,'average':_0x4fca45[_0x46a635]??0x0},_0x46a635++;});}),{'assessmentData':{'classAssignment':_0x19f17f,'student':_0x4ec9fb,'total':_0x1b5552}};}
27
+
28
+ async function uploadAssessmentData(_0x5098cc,_0x17f81a){try{const _0x3162d6=await convertToCSVFile(_0x17f81a),_0x514dd0=await _0x3162d6['text'](),_0x3c3293=parseAssessmentCsv(_0x514dd0),_0x3d6168=await fetch(_0x5098cc+'/assessment-data/upload',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x3c3293)});if(!_0x3d6168['ok']){const _0x176ff0=await _0x3d6168['json']();throw _0x176ff0;}return _0x3d6168['json']();}catch(_0x46e975){throw _0x46e975;}}
29
+
30
+ class Client{['BASE_URL'];constructor(_0x3ba46e){this['BASE_URL']=_0x3ba46e;}['Parser'](){return {'curriculum':async _0x50f405=>{const _0xf45838=await uploadCurriculum(this['BASE_URL'],_0x50f405);return _0xf45838;},'courseOffering':async _0x23d699=>{const _0x47aba4=await uploadCourseOffering(this['BASE_URL'],_0x23d699);return _0x47aba4;},'coaep':async(_0xf03ba,_0x29adf2)=>{const _0x47e74c=await uploadCOAEP(this['BASE_URL'],_0xf03ba,_0x29adf2);return _0x47e74c;},'enrolledStudent':async _0x2baa0c=>{const _0x24ffd0=await uploadEnrolledStudent(this['BASE_URL'],_0x2baa0c);return _0x24ffd0;},'classlist':async(_0x5de9f2,_0x425a85,_0x5674a6)=>{const _0x1db0ae=await uploadClassList(this['BASE_URL'],_0x5de9f2,_0x425a85,_0x5674a6);return _0x1db0ae;},'assessmentData':async _0x53afdf=>{const _0x58ea89=await uploadAssessmentData(this['BASE_URL'],_0x53afdf);return _0x58ea89;}};}}
31
+
32
+ export { Client as default };
@@ -0,0 +1,4 @@
1
+ export declare function performaceTarget(target: string): {
2
+ performance_target: number | null;
3
+ passing_score: number | null;
4
+ };
package/main.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export default class Client {
2
+ private BASE_URL;
3
+ constructor(url: string);
4
+ Parser(): {
5
+ /**
6
+ * Parse the official curriculum data from the registrar to a digestible format
7
+ * @param curriculum file from registrar
8
+ * @returns status 201
9
+ */
10
+ curriculum: (xls: File) => Promise<Record<string, unknown>>;
11
+ /**
12
+ * Parse the course offering data
13
+ * @param offering file from registrar
14
+ * @returns status 201
15
+ */
16
+ courseOffering: (xls: File) => Promise<Record<string, unknown>>;
17
+ coaep: (xls: File, course_id: string) => Promise<Record<string, unknown>>;
18
+ enrolledStudent: (xls: File) => Promise<Record<string, unknown>>;
19
+ classlist: (xls: File, subj_code: number, period_id: number) => Promise<Record<string, unknown>>;
20
+ assessmentData: (xls: File) => Promise<Record<string, unknown>>;
21
+ };
22
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@obe-loms/coms-parser",
3
+ "version": "1.0.0",
4
+ "license": "ISC",
5
+ "dependencies": {
6
+ "papaparse": "^5.5.3",
7
+ "rollup-obfuscator": "^4.1.1",
8
+ "tslib": "^2.8.1",
9
+ "xlsx": "^0.18.5"
10
+ },
11
+ "devDependencies": {
12
+ "@rollup/plugin-commonjs": "^28.0.6",
13
+ "@rollup/plugin-node-resolve": "^16.0.1",
14
+ "@rollup/plugin-typescript": "^12.1.4",
15
+ "@types/papaparse": "^5.3.16",
16
+ "rollup": "^4.46.2",
17
+ "ts-node": "^10.9.2",
18
+ "typescript": "^5.9.2"
19
+ },
20
+ "main": "bundle.js"
21
+ }
@@ -0,0 +1,4 @@
1
+ import { AssessmentData } from "../types/assessmentdata";
2
+ export declare function parseAssessmentCsv(csv: string): {
3
+ assessmentData: AssessmentData;
4
+ };
@@ -0,0 +1,6 @@
1
+ import { classList } from "../types/classList";
2
+ type ClassListResponse = {
3
+ enrolledCourses: classList[];
4
+ };
5
+ export declare function parseClassList(csvData: string): ClassListResponse;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ import { COAEP } from "../types/coaep";
2
+ export declare function parseCOAEP(csvString: string): {
3
+ COAEP: COAEP;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { CourseOffering } from "../types/courseOffering";
2
+ export declare function parseCourseOffering(csvData: string): CourseOffering[];
@@ -0,0 +1,2 @@
1
+ import { CurriculumCourses } from "../types/curriculum";
2
+ export declare function parseCurriculum(csvData: string): CurriculumCourses[];
@@ -0,0 +1 @@
1
+ export declare function convertToCSVFile(xls: File): Promise<File>;
@@ -0,0 +1 @@
1
+ export declare function uploadAssessmentData(url: string, xls: File): Promise<Record<string, unknown>>;
@@ -0,0 +1 @@
1
+ export declare function uploadCOAEP(url: string, xls: File, course_id: string): Promise<Record<string, unknown>>;
@@ -0,0 +1 @@
1
+ export declare function uploadClassList(url: string, xls: File, subj_code: number, period_id: number): Promise<Record<string, unknown>>;
@@ -0,0 +1 @@
1
+ export declare function uploadCourseOffering(url: string, xls: File): Promise<Record<string, unknown>>;
@@ -0,0 +1 @@
1
+ export declare function uploadCurriculum(url: string, xls: File): Promise<Record<string, unknown>>;
@@ -0,0 +1 @@
1
+ export declare function uploadEnrolledStudent(url: string, xls: File): Promise<Record<string, unknown>>;
@@ -0,0 +1,25 @@
1
+ export type TransmutedScore = Record<string, number>;
2
+ export type Coaep = Record<string, {
3
+ transmuted_score: TransmutedScore;
4
+ }>;
5
+ export type Student = {
6
+ student_name: string;
7
+ coaep: Coaep;
8
+ };
9
+ export type ClassAssignment = {
10
+ faculty: string;
11
+ course: string;
12
+ section: string;
13
+ semester: number;
14
+ sy: number;
15
+ };
16
+ export type TotalIlo = {
17
+ achievedMinimum: number;
18
+ average: number;
19
+ };
20
+ export type Total = Record<string, Record<string, TotalIlo>>;
21
+ export type AssessmentData = {
22
+ classAssignment: ClassAssignment;
23
+ student: Student[];
24
+ total: Total;
25
+ };
@@ -0,0 +1,6 @@
1
+ export interface classList {
2
+ subj_code: string;
3
+ student_no: string;
4
+ course_id: string;
5
+ section: string;
6
+ }
@@ -0,0 +1,19 @@
1
+ export interface ILO {
2
+ statement: string;
3
+ verb: string;
4
+ assessment_tool: string;
5
+ performance_target: number | null;
6
+ passing_score: number | null;
7
+ }
8
+ export interface CO {
9
+ statement: string;
10
+ verb: string;
11
+ ilo: ILO[];
12
+ }
13
+ export interface COAEP {
14
+ faculty: string | null;
15
+ course: string | null;
16
+ sy: string | null;
17
+ semester: number | null;
18
+ co: CO[];
19
+ }
@@ -0,0 +1,12 @@
1
+ export interface CourseOffering {
2
+ sem: string;
3
+ school_year: string;
4
+ code: string;
5
+ course_no: string;
6
+ course_desc: string;
7
+ unit: number;
8
+ time: string;
9
+ days: string;
10
+ faculty: string;
11
+ room: string;
12
+ }
@@ -0,0 +1,12 @@
1
+ export interface CurriculumCourses {
2
+ curr_id: string;
3
+ program_name: string;
4
+ revision_no: number;
5
+ year_level: number;
6
+ sem: number;
7
+ course_id: string;
8
+ course_desc: string;
9
+ total_units?: string;
10
+ lec_unit?: string;
11
+ lab_unit?: string;
12
+ }