@obe-loms/coms-parser 1.4.5 → 1.4.6
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 +23 -23
- package/main.d.ts +1 -1
- package/package.json +1 -1
- package/relay/uploadPOAEP.d.ts +1 -1
package/bundle.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import _0x5ee791 from 'papaparse';
|
|
2
|
+
import * as _0x316aaa from 'xlsx';
|
|
3
3
|
|
|
4
|
-
function parseCurriculum(
|
|
4
|
+
function parseCurriculum(_0x310c5f){let _0x583a7a='',_0x2cc352='',_0x59aa3d=0x0,_0x514440=null;const _0xf45358=[];return _0x5ee791['parse'](_0x310c5f,{'skipEmptyLines':!![],'complete':_0xa24c24=>{_0xa24c24['data']['forEach'](_0x51050f=>{const _0x59dac3=_0x51050f['map'](_0x3b3947=>(_0x3b3947??'')['toString']()['trim']()),_0x447230=_0x59dac3[0x0]??'';if(_0x447230['includes']('Rev#')){const _0x5c3666=_0x447230['match'](/([A-Z0-9]+)\s*-\s*.*:\s*(.*?)\s+Rev#\s*(\d+)/i);_0x5c3666&&(_0x583a7a=_0x5c3666[0x1]?.['trim']()??'',_0x2cc352=_0x5c3666[0x2]?.['trim']()??'',_0x59aa3d=parseInt(_0x5c3666[0x3]??'0',0xa));return;}if(/FIRST YEAR/i['test'](_0x447230)){_0x514440=0x1;return;}if(/SECOND YEAR/i['test'](_0x447230)){_0x514440=0x2;return;}if(/THIRD YEAR/i['test'](_0x447230)){_0x514440=0x3;return;}if(/FOURTH YEAR/i['test'](_0x447230)){_0x514440=0x4;return;}if(/FIFTH YEAR/i['test'](_0x447230)){_0x514440=0x5;return;}if(/First Semester/i['test'](_0x447230)||/Second Semester/i['test'](_0x447230)||/Summer/i['test'](_0x447230))return;const _0x5a3dbf=[{'sem':0x1,'offset':0x0},{'sem':0x2,'offset':0x6},{'sem':0x3,'offset':0xc}];_0x5a3dbf['forEach'](({sem:_0xe7c33b,offset:_0xca86a})=>{const _0x3cd085=_0x59dac3[_0xca86a]??'',_0x4f7a2b=_0x59dac3[_0xca86a+0x1]??'',_0x4278f4=_0x59dac3[_0xca86a+0x2]??'',_0xce7a1e=_0x59dac3[_0xca86a+0x3]??'',_0x5496c5=_0x59dac3[_0xca86a+0x4]??'';_0x3cd085&&_0x514440&&_0xf45358['push']({'curr_id':_0x583a7a,'program_name':_0x2cc352,'revision_no':_0x59aa3d,'year_level':_0x514440,'sem':_0xe7c33b,'course_id':_0x3cd085,'course_desc':_0x4f7a2b,'total_units':_0x4278f4,'lec_unit':_0xce7a1e,'lab_unit':_0x5496c5});});});}}),_0xf45358;}
|
|
5
5
|
|
|
6
|
-
function convertToCSVFile(
|
|
6
|
+
function convertToCSVFile(_0x3144b3){return new Promise((_0x34d0a5,_0x7210b2)=>{const _0x244549=new FileReader();_0x244549['onload']=_0x319d10=>{const _0x144f89=_0x319d10['target']?.['result'];if(!_0x144f89){_0x7210b2(new Error('Failed\x20to\x20read\x20file'));return;}try{const _0x388af4=_0x316aaa['read'](_0x144f89,{'type':'array'}),_0x28a01e=_0x388af4['SheetNames'][0x0];if(!_0x28a01e){_0x7210b2(new Error('No\x20sheets\x20found\x20in\x20workbook'));return;}const _0x4a920b=_0x388af4['Sheets'][_0x28a01e];if(!_0x4a920b){_0x7210b2(new Error('No\x20sheets\x20found\x20in\x20worksheet'));return;}const _0x37b6ea=_0x316aaa['utils']['sheet_to_csv'](_0x4a920b,{'strip':!![]}),_0x5432ed=_0x3144b3['name']['replace'](/\.[^/.]+$/,'.csv'),_0x3cc68c=new File([_0x37b6ea],_0x5432ed,{'type':'text/csv','lastModified':Date['now']()});_0x34d0a5(_0x3cc68c);}catch(_0x3ebe55){_0x7210b2(_0x3ebe55);}},_0x244549['onerror']=()=>{_0x7210b2(new Error('File\x20reading\x20failed'));},_0x244549['readAsArrayBuffer'](_0x3144b3);});}
|
|
7
7
|
|
|
8
|
-
async function uploadCurriculum(
|
|
8
|
+
async function uploadCurriculum(_0x2420bf,_0x6c5d5){try{const _0x2d9f8f=await convertToCSVFile(_0x6c5d5),_0x10775f=await _0x2d9f8f['text'](),_0x527e34=parseCurriculum(_0x10775f),_0x351714=_0x5ee791['unparse'](_0x527e34),_0x36cf44=new File([_0x351714],_0x2d9f8f['name'],{'type':'text/csv'}),_0x4c97df=new FormData();_0x4c97df['append']('csvFile',_0x36cf44);const _0x1dc474=await fetch(_0x2420bf+'/curr-courses/upload',{'method':'POST','body':_0x4c97df});if(!_0x1dc474['ok']){const _0x670512=await _0x1dc474['json']();throw _0x670512;}return _0x1dc474['json']();}catch(_0x54efa2){throw _0x54efa2;}}
|
|
9
9
|
|
|
10
|
-
function parseCourseOffering(
|
|
10
|
+
function parseCourseOffering(_0x1d7165){let _0x570ba6='',_0x82c8cc='';const _0x58d681=[],_0x5333f2=_0x5ee791['parse'](_0x1d7165,{'header':![],'skipEmptyLines':!![],'delimiter':','}),_0x624f16=_0x5333f2['data'];for(let _0x36cc61=0x0;_0x36cc61<Math['min'](0x5,_0x624f16['length']);_0x36cc61++){const _0x3eeb82=_0x624f16[_0x36cc61];if(_0x3eeb82&&_0x3eeb82['length']>0x0){const _0x32eee9=_0x3eeb82[0x0]?.['toString']()||'',_0x2088bf=_0x32eee9['match'](/(First|Second)\s+Sem\s+S\/Y\s+(\d{4}-\d{4})/i);if(_0x2088bf){_0x570ba6=_0x2088bf[0x1]?.['toLowerCase']()==='first'?'1':'2';if(_0x2088bf[0x2]){const _0x31a092=_0x2088bf[0x2]['match'](/(\d{2})(\d{2})-(\d{2})(\d{2})/);_0x31a092&&_0x31a092[0x2]&&_0x31a092[0x4]&&(_0x82c8cc=_0x31a092[0x2]+_0x31a092[0x4]);}}}}let _0x1d3a3d=-1;for(let _0x2b9f13=0x0;_0x2b9f13<_0x624f16['length'];_0x2b9f13++){const _0xb2596b=_0x624f16[_0x2b9f13];if(_0xb2596b&&_0xb2596b['some'](_0x5ac92f=>_0x5ac92f?.['toString']()['toUpperCase']()['includes']('CODE'))){_0x1d3a3d=_0x2b9f13;break;}}if(_0x1d3a3d===-1)throw new Error('Could\x20not\x20find\x20header\x20row\x20in\x20CSV\x20data');let _0x31c5b3={'code':'','description':'','unit':0x0};for(let _0x3933a1=_0x1d3a3d+0x1;_0x3933a1<_0x624f16['length'];_0x3933a1++){const _0x589458=_0x624f16[_0x3933a1];if(!_0x589458||_0x589458['length']<0x8)continue;const _0x995370=_0x589458[0x1]?.['toString']()['trim']()||'',_0x641a45=_0x589458[0x4]?.['toString']()['trim']()||'',_0x3600cd=_0x589458[0x5]?.['toString']()['trim']()||'',_0x185cd7=_0x589458[0x6]?.['toString']()['trim']()||'',_0x7ab52d=_0x589458[0x7]?.['toString']()['trim']()||'',_0x2d9149=_0x589458[0x3]?.['toString']()['trim']()||'';let _0x36bf95=_0x589458[0x0]?.['toString']()['trim']()||'',_0x4b4839=_0x589458[0x2]?.['toString']()['trim']()||'';if(!_0x995370)continue;if(!_0x36bf95)_0x36bf95=_0x31c5b3['code'];if(!_0x4b4839)_0x4b4839=_0x31c5b3['description'];let _0x1d0383=_0x31c5b3['unit'];if(_0x2d9149){const _0x4b56e2=_0x2d9149['match'](/(\d+)/);_0x4b56e2&&_0x4b56e2[0x1]&&(_0x1d0383=parseInt(_0x4b56e2[0x1],0xa));}const _0x2c495d={'sem':_0x570ba6,'school_year':_0x82c8cc,'code':_0x36bf95,'course_no':_0x995370,'course_desc':_0x4b4839,'unit':_0x1d0383,'time':_0x641a45,'days':_0x3600cd,'faculty':_0x185cd7,'room':_0x7ab52d};_0x31c5b3['code']=_0x36bf95,_0x31c5b3['description']=_0x4b4839,_0x31c5b3['unit']=_0x1d0383,_0x58d681['push'](_0x2c495d);}return _0x58d681;}
|
|
11
11
|
|
|
12
|
-
async function uploadCourseOffering(
|
|
12
|
+
async function uploadCourseOffering(_0x2e8ab7,_0x7fb046){try{const _0x16325d=await convertToCSVFile(_0x7fb046),_0x3ebf17=await _0x16325d['text'](),_0x1d853f=parseCourseOffering(_0x3ebf17),_0x158f3f=_0x5ee791['unparse'](_0x1d853f),_0x1c82f8=new File([_0x158f3f],_0x16325d['name'],{'type':'text/csv'}),_0x2b736e=new FormData();_0x2b736e['append']('csvFile',_0x1c82f8);const _0x558522=await fetch(_0x2e8ab7+'/course-offerings/upload',{'method':'POST','body':_0x2b736e});if(!_0x558522['ok']){const _0x1dc451=await _0x558522['json']();throw _0x1dc451;}return _0x558522['json']();}catch(_0x537ff2){throw _0x537ff2;}}
|
|
13
13
|
|
|
14
|
-
function performaceTarget(
|
|
14
|
+
function performaceTarget(_0x30275d){if(!_0x30275d)return {'performance_target':null,'passing_score':null};const _0x1eca61=_0x30275d['match'](/\d+/g);return {'performance_target':_0x1eca61?.[0x0]?parseInt(_0x1eca61[0x0],0xa):null,'passing_score':_0x1eca61?.[0x1]?parseInt(_0x1eca61[0x1],0xa):null};}
|
|
15
15
|
|
|
16
|
-
function extractInstructionalVerb(
|
|
16
|
+
function extractInstructionalVerb(_0x12334c){const _0x1b29b6=_0x12334c['trim'](),_0x13529b=/\b(will|shall)\b\s+(?:be\s+able\s+to\s+)?([a-zA-Z]+)/i,_0x7a05e3=_0x1b29b6['match'](_0x13529b);return _0x7a05e3&&_0x7a05e3[0x2]!==undefined?_0x7a05e3[0x2]:null;}
|
|
17
17
|
|
|
18
|
-
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(
|
|
18
|
+
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(_0x46021b){let _0x756491={'headerRowIndex':-1,'coIdx':-1,'iloIdx':-1,'assessToolIdx':-1,'perfTargetIdx':-1};for(let _0x29a17a=0x0;_0x29a17a<Math['min'](_0x46021b['length'],0x14);_0x29a17a++){const _0x2eef53=(_0x46021b[_0x29a17a]??[])['map'](_0x3c0b0e=>_0x3c0b0e['toLowerCase']()['trim']()),_0x59101d=_0x2eef53['findIndex'](_0x10468c=>HEADERS$1['co']['some'](_0x27d019=>_0x10468c['includes'](_0x27d019))),_0x50c9b7=_0x2eef53['findIndex'](_0x5d93b4=>HEADERS$1['ilo']['some'](_0x4c1724=>_0x5d93b4['includes'](_0x4c1724))),_0x12318d=_0x2eef53['findIndex'](_0x4a4cbf=>HEADERS$1['assessTool']['some'](_0x55da82=>_0x4a4cbf['includes'](_0x55da82))),_0x478c60=_0x2eef53['findIndex'](_0xf08925=>HEADERS$1['perfTarget']['some'](_0xf0bdfc=>_0xf08925['includes'](_0xf0bdfc))),_0x28a28f=[_0x59101d,_0x50c9b7,_0x12318d,_0x478c60]['filter'](_0x348194=>_0x348194!==-1)['length'];if(_0x28a28f>=0x3){_0x756491={'headerRowIndex':_0x29a17a,'coIdx':_0x59101d,'iloIdx':_0x50c9b7,'assessToolIdx':_0x12318d,'perfTargetIdx':_0x478c60};break;}}return _0x756491;}
|
|
19
19
|
|
|
20
|
-
function parseCOAEP(
|
|
20
|
+
function parseCOAEP(_0x152e8b){const _0x351fd=_0x5ee791['parse'](_0x152e8b,{'skipEmptyLines':![]})['data'],_0x404a4c={'COAEP':{'faculty':null,'course':null,'sy':null,'semester':null,'co':[]}},{headerRowIndex:_0x2b78ad,coIdx:_0x588aef,iloIdx:_0x491bfc,assessToolIdx:_0x3d7e7c,perfTargetIdx:_0x31ba31}=getCoaepHeader(_0x351fd);if(_0x2b78ad===-1)return {'error':'Could\x20not\x20auto-detect\x20header\x20row.','message':'Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.'};_0x351fd['forEach'](_0x503946=>{const _0x5c435e=_0x503946['indexOf']('Name\x20of\x20Faculty:'),_0x355e9b=_0x503946['indexOf']('School\x20Year'),_0x4f1994=_0x503946['indexOf']('Course:'),_0x105a96=_0x503946['indexOf']('Semester');_0x5c435e!==-1&&(_0x404a4c['COAEP']['faculty']=_0x503946[_0x5c435e+0x1]?.['trim']()||_0x404a4c['COAEP']['faculty']);_0x355e9b!==-1&&(_0x404a4c['COAEP']['sy']=_0x503946[_0x355e9b+0x1]?.['trim']()||_0x404a4c['COAEP']['sy']);_0x4f1994!==-1&&(_0x404a4c['COAEP']['course']=_0x503946[_0x4f1994+0x1]?.['trim']()||_0x404a4c['COAEP']['course']);if(_0x105a96!==-1){const _0x3e53f7=_0x503946[_0x105a96+0x1]?.['trim']()||'',_0x3306bd=_0x3e53f7['match'](/\d+/)?.[0x0];_0x404a4c['COAEP']['semester']=_0x3306bd?parseInt(_0x3306bd,0xa):_0x404a4c['COAEP']['semester'];}});let _0x4f96f9=null;return _0x351fd['forEach']((_0x18d177,_0x3bf66b)=>{if(_0x3bf66b<=_0x2b78ad)return;let _0x1c575c=_0x18d177[_0x588aef-0x1]?.['trim']()||'',_0x45ea1e=_0x18d177[_0x588aef]?.['trim']()||'';/^\d+$/['test'](_0x18d177[_0x588aef]?.['trim']()||'')&&(_0x1c575c=_0x18d177[_0x588aef]?.['trim']()||'',_0x45ea1e=_0x18d177[_0x588aef+0x1]?.['trim']()||'');const _0x355ea6=_0x18d177[_0x491bfc]?.['trim']()||'',_0x568b17=_0x18d177[_0x3d7e7c]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',_0x3608c2=_0x18d177[_0x31ba31]?.['replace'](/\s+/g,'\x20')['trim']()||'';if(_0x1c575c&&/^\d+$/['test'](_0x1c575c)){_0x4f96f9&&_0x404a4c['COAEP']['co']['push'](_0x4f96f9);const _0x382931=_0x45ea1e,_0x54a450=extractInstructionalVerb(_0x382931)||'';_0x4f96f9={'statement':_0x382931,'verb':_0x54a450,'ilo':[]};}if(_0x4f96f9&&_0x355ea6&&_0x3608c2){const _0x10a282=_0x355ea6['replace'](/^ILO\d+[:.]?\s*/,'');if(_0x10a282['match'](/^(Revision|Prepared|Date|Approved|Effectivity|Page)/i)||_0x10a282['length']<0xa)return;let _0x529ce8=_0x568b17;if(!_0x529ce8&&_0x10a282['includes'](':')){const _0x748aa0=_0x10a282['match'](/^ILO\d+:\s*(.+?)(?:\s*\(|$)/);_0x748aa0&&(_0x529ce8=_0x748aa0[0x1]?.['trim']()||'');}const {performance_target:_0x461bd5,passing_score:_0x5820ca}=performaceTarget(_0x3608c2);_0x4f96f9['ilo']['push']({'statement':_0x10a282,'verb':extractInstructionalVerb(_0x10a282)||'','assessment_tool':_0x529ce8,'performance_target':_0x461bd5,'passing_score':_0x5820ca});}}),_0x4f96f9&&_0x404a4c['COAEP']['co']['push'](_0x4f96f9),_0x404a4c;}
|
|
21
21
|
|
|
22
|
-
async function uploadCOAEP(
|
|
22
|
+
async function uploadCOAEP(_0x302738,_0x425c87,_0x1c957e){try{const _0x2c5e78=await convertToCSVFile(_0x425c87),_0x32ab03=await _0x2c5e78['text'](),_0x46c238=parseCOAEP(_0x32ab03);console['log'](_0x46c238);const _0x10a119=await fetch(_0x302738+'/coaeps/upload?course_id='+_0x1c957e,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x46c238)});if(!_0x10a119['ok']){const _0x4af303=await _0x10a119['json']();throw _0x4af303;}return _0x10a119['json']();}catch(_0x255003){throw _0x255003;}}
|
|
23
23
|
|
|
24
|
-
async function uploadEnrolledStudent(
|
|
24
|
+
async function uploadEnrolledStudent(_0x98aaae,_0x6265e4){try{const _0x50b267=await convertToCSVFile(_0x6265e4),_0x52c83c=new FormData();_0x52c83c['append']('csvFile',_0x50b267);const _0x418126=await fetch(_0x98aaae+'/enrolled-students/upload',{'method':'POST','body':_0x52c83c});if(!_0x418126['ok']){const _0x4f595d=await _0x418126['json']();throw _0x4f595d;}return _0x418126['json']();}catch(_0x4a4e3c){throw _0x4a4e3c;}}
|
|
25
25
|
|
|
26
|
-
function parseClassList(
|
|
26
|
+
function parseClassList(_0x244101){const _0x22dd9b=_0x5ee791['parse'](_0x244101,{'skipEmptyLines':!![]})['data'];let _0x20c89f='',_0x45216d='',_0x2ba966='';const _0x5b509e=[];return _0x22dd9b['forEach'](_0x5edeca=>{const _0x38159c=_0x5edeca['map'](_0x5cec2b=>(_0x5cec2b??'')['toString']()['trim']()),_0x2fb527=_0x38159c[0x0]??'';if(_0x2fb527['startsWith']('Course\x20No:')){const _0x5cafca=_0x2fb527['replace']('Course\x20No:','')['trim'](),_0xa5c70c=_0x5cafca['split'](/\s+/);_0x2ba966=_0xa5c70c[0x0]??'';const [_0x4f8fa5,_0x41650a]=(_0xa5c70c[0x1]??'')['split']('-');_0x45216d=_0x4f8fa5??'';const _0x1b76dd=(_0x41650a??'')['match'](/[a-z]$/);_0x20c89f=_0x1b76dd?_0x1b76dd[0x0]:'';}if(/^\d+$/['test'](_0x2fb527)){const _0x5e203d=_0x38159c[0x2]??'';_0x5b509e['push']({'subj_code':_0x2ba966,'student_no':_0x5e203d,'course_id':_0x45216d,'section':_0x20c89f});}}),{'enrolledCourses':_0x5b509e};}
|
|
27
27
|
|
|
28
|
-
async function uploadClassList(
|
|
28
|
+
async function uploadClassList(_0x5b6dbc,_0x145c92,_0x1d09b1,_0xd69d93){try{const _0x546fa6=await convertToCSVFile(_0x145c92),_0x4797d4=await _0x546fa6['text'](),_0x43171a=parseClassList(_0x4797d4),_0x56b369='subj_code='+_0x1d09b1+'&period_id='+_0xd69d93,_0x120f84=await fetch(_0x5b6dbc+'/enrolled-courses/upload?'+_0x56b369,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x43171a)});if(!_0x120f84['ok']){const _0x54daa9=await _0x120f84['json']();throw _0x54daa9;}return _0x120f84['json']();}catch(_0x4dc938){throw _0x4dc938;}}
|
|
29
29
|
|
|
30
|
-
function parseAssessmentCsv(
|
|
30
|
+
function parseAssessmentCsv(_0x55abe9){const {data:_0x576237}=_0x5ee791['parse'](_0x55abe9,{'skipEmptyLines':!![]}),_0x462691=_0x576237['filter'](_0x402b9f=>_0x402b9f['length']>0x0),_0x13b061=_0x462691['find'](_0x2616b5=>_0x2616b5['some'](_0x40a90b=>_0x40a90b?.['includes']('Faculty'))),_0xd6711d=_0x13b061?_0x13b061['findIndex'](_0x11c666=>_0x11c666?.['includes']('Faculty')):-1,_0x18527b=_0xd6711d!==-1&&_0x13b061?_0x13b061[_0xd6711d+0x2]?.['replace'](/"/g,'')['trim']()??'':'',_0x48a1a9=_0x462691['find'](_0x5a9c33=>_0x5a9c33['some'](_0xe3b683=>_0xe3b683?.['includes']('Semester'))),_0x5aa27c=_0x48a1a9?_0x48a1a9['findIndex'](_0xb5784b=>_0xb5784b?.['includes']('Semester')):-1,_0x2cb230=_0x5aa27c!==-1&&_0x48a1a9?_0x48a1a9[_0x5aa27c+0x2]?.['trim']()??'':'',_0x4abc73=_0x2cb230['includes']('1st')?0x1:_0x2cb230['includes']('2nd')?0x2:0x0,_0x275160=_0x462691['find'](_0xd78ef8=>_0xd78ef8['some'](_0x8f191e=>_0x8f191e?.['includes']('Course\x20&\x20Sec'))),_0x1e4409=_0x275160?_0x275160['findIndex'](_0x45742b=>_0x45742b?.['includes']('Course\x20&\x20Sec')):-1,_0x10dec5=_0x1e4409!==-1&&_0x275160?_0x275160[_0x1e4409+0x2]?.['trim']()??'':'';let _0x21dc7b='',_0x56a1f5='';if(_0x10dec5){const _0xb41ac4=_0x10dec5['match'](/^([A-Za-z0-9]+)-?([A-Za-z]+)?/);_0xb41ac4&&(_0x21dc7b=_0xb41ac4[0x1]??'',_0xb41ac4[0x2]&&(_0x56a1f5=_0xb41ac4[0x2]['replace'](/^OC/i,'')));}const _0x42a7f8=_0x462691['find'](_0x3da517=>_0x3da517['some'](_0x4b77b5=>_0x4b77b5?.['includes']('School\x20Year'))),_0x27e7fd=_0x42a7f8?_0x42a7f8['findIndex'](_0x5635ac=>_0x5635ac?.['includes']('School\x20Year')):-1,_0x297afd=_0x27e7fd!==-1&&_0x42a7f8?_0x42a7f8[_0x27e7fd+0x2]?.['trim']()??'':'';let _0x4550ef=0x0;if(_0x297afd){const _0x40863a=_0x297afd['match'](/(\d{4})-(\d{4})/);if(_0x40863a){const _0x4350bf=(_0x40863a[0x1]??'')['slice'](0x2),_0x3a12e4=(_0x40863a[0x2]??'')['slice'](0x2);_0x4550ef=parseInt(_0x4350bf+_0x3a12e4,0xa);}}const _0xbc8158={'faculty':_0x18527b,'course':_0x21dc7b,'section':_0x56a1f5,'semester':_0x4abc73,'sy':_0x4550ef},_0x21340c=_0x462691['findIndex'](_0x457a80=>_0x457a80['some'](_0x572678=>_0x572678?.['trim']()==='CO\x20#'));if(_0x21340c===-1)throw new Error('CO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x597ac5=_0x462691[_0x21340c+0x1];if(!_0x597ac5)throw new Error('ILO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x384fa5={};let _0x5e24e8=0x1,_0x5c1177=0x1;for(let _0x432713=0x3;_0x432713<_0x597ac5['length'];_0x432713++){const _0x2b8cc5=_0x597ac5[_0x432713];if(!_0x2b8cc5)continue;const _0x41ca3d='co'+_0x5e24e8;if(!_0x384fa5[_0x41ca3d])_0x384fa5[_0x41ca3d]=[];_0x384fa5[_0x41ca3d]['push']('ilo'+_0x5c1177),_0x5c1177++,_0x5c1177>0x3&&(_0x5e24e8++,_0x5c1177=0x1);}const _0x289093=_0x462691['findIndex'](_0x637fb8=>_0x637fb8['includes']('Name\x20of\x20Students'));if(_0x289093===-1)throw new Error('Student\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x38e8b7=_0x462691[_0x289093];if(!_0x38e8b7)throw new Error('Student\x20header\x20row\x20is\x20missing');const _0x107ce9=_0x38e8b7['findIndex'](_0x10a819=>_0x10a819?.['includes']('Name\x20of\x20Students'));if(_0x107ce9===-1)throw new Error('Name\x20of\x20Students\x20column\x20not\x20found\x20in\x20CSV');const _0x4cd96c=_0x107ce9+0x2,_0x3fbb5d=[];for(let _0x2198ab=_0x289093+0x1;_0x2198ab<_0x462691['length'];_0x2198ab++){const _0xc56b9a=_0x462691[_0x2198ab];if(!_0xc56b9a)continue;if(_0xc56b9a['some'](_0x58be93=>_0x58be93?.['toUpperCase']()['includes']('TOTAL\x20STUDENTS')||_0x58be93?.['toUpperCase']()['includes']('ACHIEVED\x20THE\x20MINIMUM')||_0x58be93?.['toUpperCase']()['includes']('INACTIVE')||_0x58be93?.['toUpperCase']()['includes']('AVERAGE')))continue;if(!_0xc56b9a[_0x107ce9])continue;const _0x2a57b8=_0xc56b9a[_0x107ce9]['replace'](/"/g,'')['trim'](),_0x431eb8=_0xc56b9a['slice'](_0x4cd96c)['map'](_0x7d4d19=>_0x7d4d19===null?null:!isNaN(Number(_0x7d4d19))?parseFloat(_0x7d4d19):0x0);let _0xa0ce33=0x0;const _0x55b2f9={};Object['entries'](_0x384fa5)['forEach'](([_0x5eb048,_0x60fbd8])=>{const _0x526b95={};_0x60fbd8['forEach'](_0x1d5542=>{_0x526b95[_0x1d5542]=_0x431eb8[_0xa0ce33]??0x0,_0xa0ce33++;}),_0x55b2f9[_0x5eb048]={'transmuted_score':_0x526b95};}),_0x3fbb5d['push']({'student_name':_0x2a57b8,'coaep':_0x55b2f9});}const _0x497424=_0x462691['find'](_0x3b3778=>_0x3b3778['some'](_0x4bf868=>_0x4bf868?.['includes']('ACHIEVED\x20THE\x20MINIMUM'))),_0x12262a=_0x462691['find'](_0x1031b7=>_0x1031b7['some'](_0x3090fa=>_0x3090fa?.['includes']('AVERAGE'))),_0x51510e=_0x497424?_0x497424['slice'](_0x4cd96c)['map'](_0x35ef93=>_0x35ef93&&!isNaN(Number(_0x35ef93))?parseInt(_0x35ef93):0x0):[],_0x122168=_0x12262a?_0x12262a['slice'](_0x4cd96c)['map'](_0x3e2a09=>_0x3e2a09&&_0x3e2a09!=='#DIV/0!'&&!isNaN(Number(_0x3e2a09))?parseInt(_0x3e2a09):0x0):[],_0x53627a={};let _0x510639=0x0;return Object['entries'](_0x384fa5)['forEach'](([_0x113a4b,_0x480260])=>{if(!_0x53627a[_0x113a4b])_0x53627a[_0x113a4b]={};_0x480260['forEach'](_0x34d375=>{_0x53627a[_0x113a4b][_0x34d375]={'achievedMinimum':_0x51510e[_0x510639]??0x0,'average':_0x122168[_0x510639]??0x0},_0x510639++;});}),{'assessmentData':{'classAssignment':_0xbc8158,'student':_0x3fbb5d,'total':_0x53627a}};}
|
|
31
31
|
|
|
32
|
-
async function uploadAssessmentData(
|
|
32
|
+
async function uploadAssessmentData(_0x3bcaeb,_0x39c6bc){try{const _0x227464=await convertToCSVFile(_0x39c6bc),_0x13a7c4=await _0x227464['text'](),_0x1629a5=parseAssessmentCsv(_0x13a7c4),_0x8d7295=await fetch(_0x3bcaeb+'/assessment-data/upload',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x1629a5)});if(!_0x8d7295['ok']){const _0x4188ec=await _0x8d7295['json']();throw _0x4188ec;}return _0x8d7295['json']();}catch(_0x21c9ca){throw _0x21c9ca;}}
|
|
33
33
|
|
|
34
|
-
async function uploadDeptFaculty(
|
|
34
|
+
async function uploadDeptFaculty(_0x2bf78c,_0x3e3301){try{const _0x1ee107=await convertToCSVFile(_0x3e3301),_0x36187b=new FormData();_0x36187b['append']('csvFile',_0x1ee107);const _0x6f0a12=await fetch(_0x2bf78c+'/dept-faculties/upload',{'method':'POST','body':_0x36187b});if(!_0x6f0a12['ok']){const _0x1bdd22=await _0x6f0a12['json']();throw _0x1bdd22;}return _0x6f0a12['json']();}catch(_0x1cb34b){throw _0x1cb34b;}}
|
|
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(_0x53883f){let _0x329b13={'headerIdx':-1,'poIdx':-1,'tlIdx':-1,'piIdx':-1,'fcIdx':-1,'scIdx':-1,'atIdx':-1,'ptIdx':-1};for(let _0x3cd5bc=0x0;_0x3cd5bc<Math['min'](_0x53883f['length'],0x14);_0x3cd5bc++){const _0x395357=(_0x53883f[_0x3cd5bc]??[])['map'](_0x52768d=>_0x52768d['toLowerCase']()['trim']()),_0x244d43=_0x395357['findIndex'](_0x4e349a=>HEADERS['po']['some'](_0x1c3db1=>_0x4e349a['toLowerCase']()['includes'](_0x1c3db1))),_0x58cab4=_0x395357['findIndex'](_0x5349ff=>HEADERS['tl']['some'](_0x528bc9=>_0x5349ff['toLowerCase']()['includes'](_0x528bc9))),_0x4370d6=_0x395357['findIndex'](_0xd3dc46=>HEADERS['pi']['some'](_0x3089e9=>_0xd3dc46['toLowerCase']()['includes'](_0x3089e9))),_0x12ff08=_0x395357['findIndex'](_0x30880a=>HEADERS['fc']['some'](_0x41454f=>_0x30880a['toLowerCase']()['includes'](_0x41454f))),_0x9fd5d2=_0x395357['findIndex'](_0x304834=>HEADERS['sc']['some'](_0x4f78d2=>_0x304834['toLowerCase']()['includes'](_0x4f78d2))),_0x44e137=_0x395357['findIndex'](_0xb10196=>HEADERS['at']['some'](_0x2000f3=>_0xb10196['toLowerCase']()['includes'](_0x2000f3))),_0x1cb25b=_0x395357['findIndex'](_0x2b5eb1=>HEADERS['pt']['some'](_0x1941c8=>_0x2b5eb1['toLowerCase']()['includes'](_0x1941c8))),_0x9e2a31=[_0x244d43,_0x58cab4,_0x4370d6,_0x12ff08,_0x9fd5d2,_0x44e137,_0x1cb25b]['filter'](_0x4d9ddc=>_0x4d9ddc!==-1)['length'];if(_0x9e2a31>=0x3){_0x329b13={'headerIdx':_0x3cd5bc,'poIdx':_0x244d43,'tlIdx':_0x58cab4,'piIdx':_0x4370d6,'fcIdx':_0x12ff08,'scIdx':_0x9fd5d2,'atIdx':_0x44e137,'ptIdx':_0x1cb25b};break;}}if(_0x329b13['headerIdx']===-1)throw new Error('No\x20valid\x20headers\x20found\x20in\x20POAEP\x20file.');return _0x329b13;}
|
|
37
37
|
|
|
38
|
-
const parseFormativeCourses=
|
|
38
|
+
const parseFormativeCourses=_0x2fb0da=>{let _0xf59e19=_0x2fb0da['split'](',')['reduce']((_0x585aee,_0x2d7595)=>{const _0x4ae2c7=_0x2d7595['trim']();if(_0x4ae2c7)_0x585aee['push'](_0x4ae2c7);return _0x585aee;},[]);return _0xf59e19;};
|
|
39
39
|
|
|
40
|
-
const parsePOAEP=
|
|
40
|
+
const parsePOAEP=_0x56efc0=>{try{const _0xcbc543=_0x5ee791['parse'](_0x56efc0,{'skipEmptyLines':![]})['data'],{headerIdx:_0x1bc4e7,poIdx:_0x5d5b49,tlIdx:_0x43a1e2,piIdx:_0x1c7a06,fcIdx:_0x116b24,scIdx:_0xe6b68d,atIdx:_0x3a8fd5,ptIdx:_0x45e437}=getPoaepHeader(_0xcbc543),_0x42c80b=[];let _0x4026ba={'po_desc':'','seq_no':0x0,'PerfIndicators':[]},_0x357925='',_0x8ace82='',_0x1ba71d='';for(let _0x36d49f=_0x1bc4e7+0x1;_0x36d49f<_0xcbc543['length'];_0x36d49f++){const _0x2a7026=_0xcbc543[_0x36d49f];if(!_0x2a7026)break;const _0x219e75=_0x2a7026[_0x5d5b49]?.['trim']()||'';_0x219e75!==''&&(_0x4026ba={'po_desc':_0x219e75,'seq_no':_0x4026ba['seq_no']+0x1,'PerfIndicators':[]},_0x42c80b['push'](_0x4026ba),_0x357925='',_0x8ace82='',_0x1ba71d='');if(_0x4026ba['po_desc']==='')throw new Error('Invalid\x20Program\x20Outcome\x20at\x20row\x20'+_0x36d49f+'.');const _0xc029b3=_0x2a7026[_0x1c7a06]?.['trim']()||'';if(_0xc029b3==='')break;const _0x2f3e9e=_0x2a7026[_0x116b24]?.['trim']()||'';if(_0x2f3e9e==='')throw new Error('Empty\x20Formative\x20Courses\x20at\x20row\x20'+_0x36d49f+'.');const _0x5c3639=_0x2a7026[_0xe6b68d]?.['trim']()||_0x357925;if(_0x5c3639==='')throw new Error('Empty\x20Summative\x20Course\x20at\x20row\x20'+_0x36d49f+'.');_0x357925=_0x5c3639;const _0x2a59cf=_0x2a7026[_0x3a8fd5]?.['trim']()||_0x8ace82;if(_0x2a59cf==='')throw new Error('Empty\x20Assessment\x20Tool\x20at\x20row\x20'+_0x36d49f+'.');_0x8ace82=_0x2a59cf;const _0x497695=_0x2a7026[_0x45e437]?.['trim']()||_0x1ba71d;if(_0x497695==='')throw new Error('Empty\x20Performance\x20Target\x20at\x20row\x20'+_0x36d49f+'.');_0x1ba71d=_0x497695;const _0x563f79=parseFormativeCourses(_0x2f3e9e);if(_0x563f79['length']===0x0)throw new Error('Invalid\x20Formative\x20Courses\x20format\x20at\x20row\x20'+_0x36d49f+'.');const _0x44cb8f=performaceTarget(_0x497695);if(!_0x44cb8f['performance_target']||!_0x44cb8f['passing_score'])throw new Error('Invalid\x20Performance\x20Targets\x20format\x20at\x20row\x20'+_0x36d49f+'.');const _0x534347={'pi_desc':_0xc029b3,'FormativeCourses':_0x563f79['map'](_0x1ddde2=>({'course_id':_0x1ddde2,'cognitive_level':0x0})),'SummativeCourse':{'course_id':_0x5c3639},'AssessmentTool':{'at_desc':_0x2a59cf},'PerformanceTargets':{'target_percent':_0x44cb8f['performance_target'],'min_score':_0x44cb8f['passing_score']}};_0x4026ba['PerfIndicators']['push'](_0x534347);}return {'success':!![],'message':'Successfully\x20parsed\x20POAEP\x20file.','data':{'POAEP':_0x42c80b}};}catch(_0x2c2eac){return {'success':![],'error':_0x2c2eac instanceof Error?_0x2c2eac['message']:_0x2c2eac,'message':'Please\x20ensure\x20the\x20file\x20follows\x20the\x20POAEP\x20template.'};}};
|
|
41
41
|
|
|
42
|
-
async function uploadPOAEP(
|
|
42
|
+
async function uploadPOAEP(_0x472082,_0x479972,_0x2e96e6,_0x3f406e,_0x3f6c34){try{const _0x4209e8=await convertToCSVFile(_0x479972),_0x2032d2=await _0x4209e8['text'](),_0x115385=parsePOAEP(_0x2032d2),_0x3e1d15=await fetch(_0x472082+'/program-outcomes/poaep/upload?curr_id='+_0x3f406e+'&period_id='+_0x3f6c34,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2e96e6},'credentials':'include','body':JSON['stringify'](_0x115385)});if(!_0x3e1d15['ok']){const _0x133835=await _0x3e1d15['json']();throw _0x133835;}return _0x3e1d15['json']();}catch(_0x59e7e7){throw _0x59e7e7;}}
|
|
43
43
|
|
|
44
|
-
class Client{['BASE_URL'];constructor(
|
|
44
|
+
class Client{['BASE_URL'];constructor(_0x2a1169){this['BASE_URL']=_0x2a1169;}['Parser'](){return {'curriculum':async _0x1156be=>{const _0x24b860=await uploadCurriculum(this['BASE_URL'],_0x1156be);return _0x24b860;},'courseOffering':async _0x8fb045=>{const _0x46e355=await uploadCourseOffering(this['BASE_URL'],_0x8fb045);return _0x46e355;},'coaep':async(_0x54d1d7,_0x32ae68)=>{const _0xf47ec8=await uploadCOAEP(this['BASE_URL'],_0x54d1d7,_0x32ae68);return _0xf47ec8;},'enrolledStudent':async _0x4b309d=>{const _0x554639=await uploadEnrolledStudent(this['BASE_URL'],_0x4b309d);return _0x554639;},'classlist':async(_0x3aeef8,_0x3f20bb,_0x3fdd17)=>{const _0x490485=await uploadClassList(this['BASE_URL'],_0x3aeef8,_0x3f20bb,_0x3fdd17);return _0x490485;},'assessmentData':async _0x355d8e=>{const _0x26b1c6=await uploadAssessmentData(this['BASE_URL'],_0x355d8e);return _0x26b1c6;},'deptFaculty':async _0x5cee7c=>{const _0x442f70=await uploadDeptFaculty(this['BASE_URL'],_0x5cee7c);return _0x442f70;},'poaep':async(_0x2e3252,_0x1d320f,_0x2bc0f4,_0x577c35)=>{const _0x37f4b5=await uploadPOAEP(this['BASE_URL'],_0x2e3252,_0x1d320f,_0x2bc0f4,_0x577c35);return _0x37f4b5;}};}}
|
|
45
45
|
|
|
46
46
|
export { Client as default };
|
package/main.d.ts
CHANGED
|
@@ -19,6 +19,6 @@ export default class Client {
|
|
|
19
19
|
classlist: (xls: File, subj_code: number, period_id: number) => Promise<Record<string, unknown>>;
|
|
20
20
|
assessmentData: (xls: File) => Promise<Record<string, unknown>>;
|
|
21
21
|
deptFaculty: (xls: File) => Promise<Record<string, unknown>>;
|
|
22
|
-
poaep: (xls: File, token: string, curr_id: string, period_id: number
|
|
22
|
+
poaep: (xls: File, token: string, curr_id: string, period_id: number) => Promise<Record<string, unknown>>;
|
|
23
23
|
};
|
|
24
24
|
}
|
package/package.json
CHANGED
package/relay/uploadPOAEP.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function uploadPOAEP(url: string, xls: File, token: string, curr_id: string, period_id: number
|
|
1
|
+
export declare function uploadPOAEP(url: string, xls: File, token: string, curr_id: string, period_id: number): Promise<Record<string, unknown>>;
|