@obe-loms/coms-parser 1.3.2 → 1.4.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 +19 -19
- package/helper/header-getter/getPoaepHeader.d.ts +10 -0
- package/helper/parseFormativeCourses.helper.d.ts +2 -0
- package/main.d.ts +1 -1
- package/package.json +1 -1
- package/parser/poaep.d.ts +13 -0
- package/relay/uploadCOAEP.d.ts +1 -1
- 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 _0x1b82a8 from 'papaparse';
|
|
2
|
+
import * as _0x787c13 from 'xlsx';
|
|
3
3
|
|
|
4
|
-
function parseCurriculum(
|
|
4
|
+
function parseCurriculum(_0x44fabc){let _0x3a888c='',_0x176dbb='',_0x5ee526=0x0,_0x4bc480=null;const _0xb70030=[];return _0x1b82a8['parse'](_0x44fabc,{'skipEmptyLines':!![],'complete':_0x396794=>{_0x396794['data']['forEach'](_0x25bcd4=>{const _0x2db680=_0x25bcd4['map'](_0x12a41c=>(_0x12a41c??'')['toString']()['trim']()),_0x38caa5=_0x2db680[0x0]??'';if(_0x38caa5['includes']('Rev#')){const _0x3d200d=_0x38caa5['match'](/([A-Z0-9]+)\s*-\s*.*:\s*(.*?)\s+Rev#\s*(\d+)/i);_0x3d200d&&(_0x3a888c=_0x3d200d[0x1]?.['trim']()??'',_0x176dbb=_0x3d200d[0x2]?.['trim']()??'',_0x5ee526=parseInt(_0x3d200d[0x3]??'0',0xa));return;}if(/FIRST YEAR/i['test'](_0x38caa5)){_0x4bc480=0x1;return;}if(/SECOND YEAR/i['test'](_0x38caa5)){_0x4bc480=0x2;return;}if(/THIRD YEAR/i['test'](_0x38caa5)){_0x4bc480=0x3;return;}if(/FOURTH YEAR/i['test'](_0x38caa5)){_0x4bc480=0x4;return;}if(/FIFTH YEAR/i['test'](_0x38caa5)){_0x4bc480=0x5;return;}if(/First Semester/i['test'](_0x38caa5)||/Second Semester/i['test'](_0x38caa5)||/Summer/i['test'](_0x38caa5))return;const _0x4ae836=[{'sem':0x1,'offset':0x0},{'sem':0x2,'offset':0x6},{'sem':0x3,'offset':0xc}];_0x4ae836['forEach'](({sem:_0x595a06,offset:_0x3c1b8b})=>{const _0x2dc78f=_0x2db680[_0x3c1b8b]??'',_0x2f2f2d=_0x2db680[_0x3c1b8b+0x1]??'',_0xfafe7=_0x2db680[_0x3c1b8b+0x2]??'',_0x1ef752=_0x2db680[_0x3c1b8b+0x3]??'',_0x59ca28=_0x2db680[_0x3c1b8b+0x4]??'';_0x2dc78f&&_0x4bc480&&_0xb70030['push']({'curr_id':_0x3a888c,'program_name':_0x176dbb,'revision_no':_0x5ee526,'year_level':_0x4bc480,'sem':_0x595a06,'course_id':_0x2dc78f,'course_desc':_0x2f2f2d,'total_units':_0xfafe7,'lec_unit':_0x1ef752,'lab_unit':_0x59ca28});});});}}),_0xb70030;}
|
|
5
5
|
|
|
6
|
-
function convertToCSVFile(
|
|
6
|
+
function convertToCSVFile(_0x58ace7){return new Promise((_0x3d740b,_0x2b0ca5)=>{const _0x1feb0d=new FileReader();_0x1feb0d['onload']=_0x314804=>{const _0x3adc21=_0x314804['target']?.['result'];if(!_0x3adc21){_0x2b0ca5(new Error('Failed\x20to\x20read\x20file'));return;}try{const _0x34c9c9=_0x787c13['read'](_0x3adc21,{'type':'array'}),_0x5c65e1=_0x34c9c9['SheetNames'][0x0];if(!_0x5c65e1){_0x2b0ca5(new Error('No\x20sheets\x20found\x20in\x20workbook'));return;}const _0x250397=_0x34c9c9['Sheets'][_0x5c65e1];if(!_0x250397){_0x2b0ca5(new Error('No\x20sheets\x20found\x20in\x20worksheet'));return;}const _0x1253ea=_0x787c13['utils']['sheet_to_csv'](_0x250397,{'strip':!![]}),_0x373a36=_0x58ace7['name']['replace'](/\.[^/.]+$/,'.csv'),_0x54e444=new File([_0x1253ea],_0x373a36,{'type':'text/csv','lastModified':Date['now']()});_0x3d740b(_0x54e444);}catch(_0x5ec5fe){_0x2b0ca5(_0x5ec5fe);}},_0x1feb0d['onerror']=()=>{_0x2b0ca5(new Error('File\x20reading\x20failed'));},_0x1feb0d['readAsArrayBuffer'](_0x58ace7);});}
|
|
7
7
|
|
|
8
|
-
async function uploadCurriculum(
|
|
8
|
+
async function uploadCurriculum(_0x10f2c0,_0x3263e8){try{const _0x31ef1f=await convertToCSVFile(_0x3263e8),_0x416eae=await _0x31ef1f['text'](),_0x56e763=parseCurriculum(_0x416eae),_0x4f92c0=_0x1b82a8['unparse'](_0x56e763),_0x359416=new File([_0x4f92c0],_0x31ef1f['name'],{'type':'text/csv'}),_0x4a24e6=new FormData();_0x4a24e6['append']('csvFile',_0x359416);const _0x5f33fc=await fetch(_0x10f2c0+'/curr-courses/upload',{'method':'POST','body':_0x4a24e6});if(!_0x5f33fc['ok']){const _0x55e702=await _0x5f33fc['json']();throw _0x55e702;}return _0x5f33fc['json']();}catch(_0x185d49){throw _0x185d49;}}
|
|
9
9
|
|
|
10
|
-
function parseCourseOffering(
|
|
10
|
+
function parseCourseOffering(_0x29ba1d){let _0x3f8050='',_0x344efe='';const _0x5dffa5=[],_0x1841d6=_0x1b82a8['parse'](_0x29ba1d,{'header':![],'skipEmptyLines':!![],'delimiter':','}),_0x218d3a=_0x1841d6['data'];for(let _0x1ea3a7=0x0;_0x1ea3a7<Math['min'](0x5,_0x218d3a['length']);_0x1ea3a7++){const _0xbbae6c=_0x218d3a[_0x1ea3a7];if(_0xbbae6c&&_0xbbae6c['length']>0x0){const _0x3dc4c3=_0xbbae6c[0x0]?.['toString']()||'',_0x1879be=_0x3dc4c3['match'](/(First|Second)\s+Sem\s+S\/Y\s+(\d{4}-\d{4})/i);if(_0x1879be){_0x3f8050=_0x1879be[0x1]?.['toLowerCase']()==='first'?'1':'2';if(_0x1879be[0x2]){const _0x38d397=_0x1879be[0x2]['match'](/(\d{2})(\d{2})-(\d{2})(\d{2})/);_0x38d397&&_0x38d397[0x2]&&_0x38d397[0x4]&&(_0x344efe=_0x38d397[0x2]+_0x38d397[0x4]);}}}}let _0x3bc00a=-1;for(let _0x2f1d11=0x0;_0x2f1d11<_0x218d3a['length'];_0x2f1d11++){const _0x57d316=_0x218d3a[_0x2f1d11];if(_0x57d316&&_0x57d316['some'](_0x595fbd=>_0x595fbd?.['toString']()['toUpperCase']()['includes']('CODE'))){_0x3bc00a=_0x2f1d11;break;}}if(_0x3bc00a===-1)throw new Error('Could\x20not\x20find\x20header\x20row\x20in\x20CSV\x20data');let _0x1fb0f2={'code':'','description':'','unit':0x0};for(let _0x32208b=_0x3bc00a+0x1;_0x32208b<_0x218d3a['length'];_0x32208b++){const _0x562f56=_0x218d3a[_0x32208b];if(!_0x562f56||_0x562f56['length']<0x8)continue;const _0x3ab6f=_0x562f56[0x1]?.['toString']()['trim']()||'',_0x1969ba=_0x562f56[0x4]?.['toString']()['trim']()||'',_0x13d602=_0x562f56[0x5]?.['toString']()['trim']()||'',_0x12903f=_0x562f56[0x6]?.['toString']()['trim']()||'',_0x21adb4=_0x562f56[0x7]?.['toString']()['trim']()||'',_0x55fcc9=_0x562f56[0x3]?.['toString']()['trim']()||'';let _0x239b56=_0x562f56[0x0]?.['toString']()['trim']()||'',_0x480301=_0x562f56[0x2]?.['toString']()['trim']()||'';if(!_0x3ab6f)continue;if(!_0x239b56)_0x239b56=_0x1fb0f2['code'];if(!_0x480301)_0x480301=_0x1fb0f2['description'];let _0x509478=_0x1fb0f2['unit'];if(_0x55fcc9){const _0x254dfc=_0x55fcc9['match'](/(\d+)/);_0x254dfc&&_0x254dfc[0x1]&&(_0x509478=parseInt(_0x254dfc[0x1],0xa));}const _0x19dbc2={'sem':_0x3f8050,'school_year':_0x344efe,'code':_0x239b56,'course_no':_0x3ab6f,'course_desc':_0x480301,'unit':_0x509478,'time':_0x1969ba,'days':_0x13d602,'faculty':_0x12903f,'room':_0x21adb4};_0x1fb0f2['code']=_0x239b56,_0x1fb0f2['description']=_0x480301,_0x1fb0f2['unit']=_0x509478,_0x5dffa5['push'](_0x19dbc2);}return _0x5dffa5;}
|
|
11
11
|
|
|
12
|
-
async function uploadCourseOffering(
|
|
12
|
+
async function uploadCourseOffering(_0x39a74d,_0x19ab3d){try{const _0x15b578=await convertToCSVFile(_0x19ab3d),_0x4a116b=await _0x15b578['text'](),_0x3d55b9=parseCourseOffering(_0x4a116b),_0x36b16c=_0x1b82a8['unparse'](_0x3d55b9),_0x23d76b=new File([_0x36b16c],_0x15b578['name'],{'type':'text/csv'}),_0x3f9480=new FormData();_0x3f9480['append']('csvFile',_0x23d76b);const _0x3c56b2=await fetch(_0x39a74d+'/course-offerings/upload',{'method':'POST','body':_0x3f9480});if(!_0x3c56b2['ok']){const _0x5a854a=await _0x3c56b2['json']();throw _0x5a854a;}return _0x3c56b2['json']();}catch(_0x261f9c){throw _0x261f9c;}}
|
|
13
13
|
|
|
14
|
-
function performaceTarget(
|
|
14
|
+
function performaceTarget(_0x4dc1ea){if(!_0x4dc1ea)return {'performance_target':null,'passing_score':null};const _0x56643d=_0x4dc1ea['match'](/\d+/g);return {'performance_target':_0x56643d?.[0x0]?parseInt(_0x56643d[0x0],0xa):null,'passing_score':_0x56643d?.[0x1]?parseInt(_0x56643d[0x1],0xa):null};}
|
|
15
15
|
|
|
16
|
-
function extractInstructionalVerb(
|
|
16
|
+
function extractInstructionalVerb(_0x4a5f2e){const _0x3ec3e8=_0x4a5f2e['trim'](),_0x33e565=/\b(will|shall)\b\s+(?:be\s+able\s+to\s+)?([a-zA-Z]+)/i,_0x15cd5f=_0x3ec3e8['match'](_0x33e565);return _0x15cd5f&&_0x15cd5f[0x2]!==undefined?_0x15cd5f[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(_0x43edce){let _0x23a0e2={'headerRowIndex':-1,'coIdx':-1,'iloIdx':-1,'assessToolIdx':-1,'perfTargetIdx':-1};for(let _0x48e41a=0x0;_0x48e41a<Math['min'](_0x43edce['length'],0x14);_0x48e41a++){const _0x3b5fb6=(_0x43edce[_0x48e41a]??[])['map'](_0x173926=>_0x173926['toLowerCase']()['trim']()),_0x5388ba=_0x3b5fb6['findIndex'](_0x2bd9d1=>HEADERS['co']['some'](_0x5a772a=>_0x2bd9d1['includes'](_0x5a772a))),_0x2137dc=_0x3b5fb6['findIndex'](_0x264448=>HEADERS['ilo']['some'](_0x3598dd=>_0x264448['includes'](_0x3598dd))),_0xd2b590=_0x3b5fb6['findIndex'](_0x5e2026=>HEADERS['assessTool']['some'](_0x1110a9=>_0x5e2026['includes'](_0x1110a9))),_0x3126c7=_0x3b5fb6['findIndex'](_0x186127=>HEADERS['perfTarget']['some'](_0x15af65=>_0x186127['includes'](_0x15af65))),_0x2aeadf=[_0x5388ba,_0x2137dc,_0xd2b590,_0x3126c7]['filter'](_0x44440c=>_0x44440c!==-1)['length'];if(_0x2aeadf>=0x3){_0x23a0e2={'headerRowIndex':_0x48e41a,'coIdx':_0x5388ba,'iloIdx':_0x2137dc,'assessToolIdx':_0xd2b590,'perfTargetIdx':_0x3126c7};break;}}return _0x23a0e2;}
|
|
19
19
|
|
|
20
|
-
function parseCOAEP(
|
|
20
|
+
function parseCOAEP(_0x3f3f79){const _0x3b8929=_0x1b82a8['parse'](_0x3f3f79,{'skipEmptyLines':![]})['data'],_0x24b986={'COAEP':{'faculty':null,'course':null,'sy':null,'semester':null,'co':[]}},{headerRowIndex:_0x3113f3,coIdx:_0x1f5f9b,iloIdx:_0x2428a6,assessToolIdx:_0x1b8754,perfTargetIdx:_0x2e2ae4}=getCoaepHeader(_0x3b8929);if(_0x3113f3===-1)return {'error':'Could\x20not\x20auto-detect\x20header\x20row.','message':'Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.'};_0x3b8929['forEach'](_0x423223=>{const _0x41ec1e=_0x423223['indexOf']('Name\x20of\x20Faculty:'),_0xf1efaa=_0x423223['indexOf']('School\x20Year'),_0x3e36e3=_0x423223['indexOf']('Course:'),_0x25af56=_0x423223['indexOf']('Semester');_0x41ec1e!==-1&&(_0x24b986['COAEP']['faculty']=_0x423223[_0x41ec1e+0x1]?.['trim']()||_0x24b986['COAEP']['faculty']);_0xf1efaa!==-1&&(_0x24b986['COAEP']['sy']=_0x423223[_0xf1efaa+0x1]?.['trim']()||_0x24b986['COAEP']['sy']);_0x3e36e3!==-1&&(_0x24b986['COAEP']['course']=_0x423223[_0x3e36e3+0x1]?.['trim']()||_0x24b986['COAEP']['course']);if(_0x25af56!==-1){const _0x192c37=_0x423223[_0x25af56+0x1]?.['trim']()||'',_0x417fa6=_0x192c37['match'](/\d+/)?.[0x0];_0x24b986['COAEP']['semester']=_0x417fa6?parseInt(_0x417fa6,0xa):_0x24b986['COAEP']['semester'];}});let _0x17383d=null;return _0x3b8929['forEach']((_0x24a2d8,_0x13c2fb)=>{if(_0x13c2fb<=_0x3113f3)return;let _0x545ecb=_0x24a2d8[_0x1f5f9b-0x1]?.['trim']()||'',_0x5656e9=_0x24a2d8[_0x1f5f9b]?.['trim']()||'';/^\d+$/['test'](_0x24a2d8[_0x1f5f9b]?.['trim']()||'')&&(_0x545ecb=_0x24a2d8[_0x1f5f9b]?.['trim']()||'',_0x5656e9=_0x24a2d8[_0x1f5f9b+0x1]?.['trim']()||'');const _0x5d004a=_0x24a2d8[_0x2428a6]?.['trim']()||'',_0x3a3f10=_0x24a2d8[_0x1b8754]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',_0x4885ba=_0x24a2d8[_0x2e2ae4]?.['replace'](/\s+/g,'\x20')['trim']()||'';if(_0x545ecb&&/^\d+$/['test'](_0x545ecb)){_0x17383d&&_0x24b986['COAEP']['co']['push'](_0x17383d);const _0x2822e2=_0x5656e9,_0x44ef6d=extractInstructionalVerb(_0x2822e2)||'';_0x17383d={'statement':_0x2822e2,'verb':_0x44ef6d,'ilo':[]};}if(_0x17383d&&_0x5d004a&&_0x4885ba){const _0x2fa15e=_0x5d004a['replace'](/^ILO\d+[:.]?\s*/,'');if(_0x2fa15e['match'](/^(Revision|Prepared|Date|Approved|Effectivity|Page)/i)||_0x2fa15e['length']<0xa)return;let _0x1b715d=_0x3a3f10;if(!_0x1b715d&&_0x2fa15e['includes'](':')){const _0x54b4f6=_0x2fa15e['match'](/^ILO\d+:\s*(.+?)(?:\s*\(|$)/);_0x54b4f6&&(_0x1b715d=_0x54b4f6[0x1]?.['trim']()||'');}const {performance_target:_0x33d47f,passing_score:_0x267c6c}=performaceTarget(_0x4885ba);_0x17383d['ilo']['push']({'statement':_0x2fa15e,'verb':extractInstructionalVerb(_0x2fa15e)||'','assessment_tool':_0x1b715d,'performance_target':_0x33d47f,'passing_score':_0x267c6c});}}),_0x17383d&&_0x24b986['COAEP']['co']['push'](_0x17383d),_0x24b986;}
|
|
21
21
|
|
|
22
|
-
async function uploadCOAEP(
|
|
22
|
+
async function uploadCOAEP(_0x2341b9,_0x135a10,_0x5332fb){try{const _0x433460=await convertToCSVFile(_0x135a10),_0x5328f6=await _0x433460['text'](),_0x475694=parseCOAEP(_0x5328f6);console['log'](_0x475694);}catch(_0x7f8db8){throw _0x7f8db8;}}
|
|
23
23
|
|
|
24
|
-
async function uploadEnrolledStudent(
|
|
24
|
+
async function uploadEnrolledStudent(_0xdd4cd9,_0x36a08f){try{const _0x4984ac=await convertToCSVFile(_0x36a08f),_0x291662=new FormData();_0x291662['append']('csvFile',_0x4984ac);const _0x5bfb2a=await fetch(_0xdd4cd9+'/enrolled-students/upload',{'method':'POST','body':_0x291662});if(!_0x5bfb2a['ok']){const _0x4fe997=await _0x5bfb2a['json']();throw _0x4fe997;}return _0x5bfb2a['json']();}catch(_0x4558a1){throw _0x4558a1;}}
|
|
25
25
|
|
|
26
|
-
function parseClassList(
|
|
26
|
+
function parseClassList(_0xa7a332){const _0x51df74=_0x1b82a8['parse'](_0xa7a332,{'skipEmptyLines':!![]})['data'];let _0x486956='',_0x3a210='',_0x4e149d='';const _0x33e77d=[];return _0x51df74['forEach'](_0x573135=>{const _0x538ede=_0x573135['map'](_0x51a788=>(_0x51a788??'')['toString']()['trim']()),_0x1d5763=_0x538ede[0x0]??'';if(_0x1d5763['startsWith']('Course\x20No:')){const _0x2a6924=_0x1d5763['replace']('Course\x20No:','')['trim'](),_0x273809=_0x2a6924['split'](/\s+/);_0x4e149d=_0x273809[0x0]??'';const [_0xb4cfff,_0x1e8367]=(_0x273809[0x1]??'')['split']('-');_0x3a210=_0xb4cfff??'';const _0x579480=(_0x1e8367??'')['match'](/[a-z]$/);_0x486956=_0x579480?_0x579480[0x0]:'';}if(/^\d+$/['test'](_0x1d5763)){const _0x5579fa=_0x538ede[0x2]??'';_0x33e77d['push']({'subj_code':_0x4e149d,'student_no':_0x5579fa,'course_id':_0x3a210,'section':_0x486956});}}),{'enrolledCourses':_0x33e77d};}
|
|
27
27
|
|
|
28
|
-
async function uploadClassList(
|
|
28
|
+
async function uploadClassList(_0x38d7bb,_0x41cc66,_0x295076,_0x3c3cf8){try{const _0x2e77c7=await convertToCSVFile(_0x41cc66),_0x373573=await _0x2e77c7['text'](),_0x53e69a=parseClassList(_0x373573),_0x23b5f5='subj_code='+_0x295076+'&period_id='+_0x3c3cf8,_0x2f36ab=await fetch(_0x38d7bb+'/enrolled-courses/upload?'+_0x23b5f5,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x53e69a)});if(!_0x2f36ab['ok']){const _0x16c872=await _0x2f36ab['json']();throw _0x16c872;}return _0x2f36ab['json']();}catch(_0x1966e6){throw _0x1966e6;}}
|
|
29
29
|
|
|
30
|
-
function parseAssessmentCsv(
|
|
30
|
+
function parseAssessmentCsv(_0x5eed18){const {data:_0x28c889}=_0x1b82a8['parse'](_0x5eed18,{'skipEmptyLines':!![]}),_0x4b5f17=_0x28c889['filter'](_0x57f270=>_0x57f270['length']>0x0),_0x2050b7=_0x4b5f17['find'](_0x3f14a8=>_0x3f14a8['some'](_0x3cb2b1=>_0x3cb2b1?.['includes']('Faculty'))),_0x43b57a=_0x2050b7?_0x2050b7['findIndex'](_0x3afdbb=>_0x3afdbb?.['includes']('Faculty')):-1,_0x1abe02=_0x43b57a!==-1&&_0x2050b7?_0x2050b7[_0x43b57a+0x2]?.['replace'](/"/g,'')['trim']()??'':'',_0x240261=_0x4b5f17['find'](_0x39b38a=>_0x39b38a['some'](_0x531e01=>_0x531e01?.['includes']('Semester'))),_0x530450=_0x240261?_0x240261['findIndex'](_0x57f945=>_0x57f945?.['includes']('Semester')):-1,_0x5c0188=_0x530450!==-1&&_0x240261?_0x240261[_0x530450+0x2]?.['trim']()??'':'',_0x234fa1=_0x5c0188['includes']('1st')?0x1:_0x5c0188['includes']('2nd')?0x2:0x0,_0x164756=_0x4b5f17['find'](_0x19b75c=>_0x19b75c['some'](_0x587839=>_0x587839?.['includes']('Course\x20&\x20Sec'))),_0x155270=_0x164756?_0x164756['findIndex'](_0x4afdd4=>_0x4afdd4?.['includes']('Course\x20&\x20Sec')):-1,_0x162c74=_0x155270!==-1&&_0x164756?_0x164756[_0x155270+0x2]?.['trim']()??'':'';let _0x2ee5fa='',_0x32b6da='';if(_0x162c74){const _0x4d5a8b=_0x162c74['match'](/^([A-Za-z0-9]+)-?([A-Za-z]+)?/);_0x4d5a8b&&(_0x2ee5fa=_0x4d5a8b[0x1]??'',_0x4d5a8b[0x2]&&(_0x32b6da=_0x4d5a8b[0x2]['replace'](/^OC/i,'')));}const _0x439099=_0x4b5f17['find'](_0x254076=>_0x254076['some'](_0x21abc8=>_0x21abc8?.['includes']('School\x20Year'))),_0x2b8b8e=_0x439099?_0x439099['findIndex'](_0xfa8a07=>_0xfa8a07?.['includes']('School\x20Year')):-1,_0x2a8f90=_0x2b8b8e!==-1&&_0x439099?_0x439099[_0x2b8b8e+0x2]?.['trim']()??'':'';let _0x5e8d40=0x0;if(_0x2a8f90){const _0x1f0098=_0x2a8f90['match'](/(\d{4})-(\d{4})/);if(_0x1f0098){const _0x42dcd4=(_0x1f0098[0x1]??'')['slice'](0x2),_0x54583f=(_0x1f0098[0x2]??'')['slice'](0x2);_0x5e8d40=parseInt(_0x42dcd4+_0x54583f,0xa);}}const _0x3e88a0={'faculty':_0x1abe02,'course':_0x2ee5fa,'section':_0x32b6da,'semester':_0x234fa1,'sy':_0x5e8d40},_0x4d3b4c=_0x4b5f17['findIndex'](_0x5ae1bd=>_0x5ae1bd['some'](_0x46d7d9=>_0x46d7d9?.['trim']()==='CO\x20#'));if(_0x4d3b4c===-1)throw new Error('CO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x155bd2=_0x4b5f17[_0x4d3b4c+0x1];if(!_0x155bd2)throw new Error('ILO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x607ea6={};let _0xd5e4aa=0x1,_0x17cf19=0x1;for(let _0x449b21=0x3;_0x449b21<_0x155bd2['length'];_0x449b21++){const _0xfd766c=_0x155bd2[_0x449b21];if(!_0xfd766c)continue;const _0xee6e3f='co'+_0xd5e4aa;if(!_0x607ea6[_0xee6e3f])_0x607ea6[_0xee6e3f]=[];_0x607ea6[_0xee6e3f]['push']('ilo'+_0x17cf19),_0x17cf19++,_0x17cf19>0x3&&(_0xd5e4aa++,_0x17cf19=0x1);}const _0x1a5b90=_0x4b5f17['findIndex'](_0x1e58b4=>_0x1e58b4['includes']('Name\x20of\x20Students'));if(_0x1a5b90===-1)throw new Error('Student\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x6bebe5=_0x4b5f17[_0x1a5b90];if(!_0x6bebe5)throw new Error('Student\x20header\x20row\x20is\x20missing');const _0x1b427d=_0x6bebe5['findIndex'](_0x4dee22=>_0x4dee22?.['includes']('Name\x20of\x20Students'));if(_0x1b427d===-1)throw new Error('Name\x20of\x20Students\x20column\x20not\x20found\x20in\x20CSV');const _0xfbbb15=_0x1b427d+0x2,_0x34f4e9=[];for(let _0xc9d9f8=_0x1a5b90+0x1;_0xc9d9f8<_0x4b5f17['length'];_0xc9d9f8++){const _0x39713d=_0x4b5f17[_0xc9d9f8];if(!_0x39713d)continue;if(_0x39713d['some'](_0x2def7a=>_0x2def7a?.['toUpperCase']()['includes']('TOTAL\x20STUDENTS')||_0x2def7a?.['toUpperCase']()['includes']('ACHIEVED\x20THE\x20MINIMUM')||_0x2def7a?.['toUpperCase']()['includes']('INACTIVE')||_0x2def7a?.['toUpperCase']()['includes']('AVERAGE')))continue;if(!_0x39713d[_0x1b427d])continue;const _0x74a7a2=_0x39713d[_0x1b427d]['replace'](/"/g,'')['trim'](),_0x1b5bab=_0x39713d['slice'](_0xfbbb15)['map'](_0x582262=>_0x582262===null?null:!isNaN(Number(_0x582262))?parseFloat(_0x582262):0x0);let _0x4254c6=0x0;const _0x36320c={};Object['entries'](_0x607ea6)['forEach'](([_0x1f32a6,_0x5d6728])=>{const _0x523e19={};_0x5d6728['forEach'](_0x292135=>{_0x523e19[_0x292135]=_0x1b5bab[_0x4254c6]??0x0,_0x4254c6++;}),_0x36320c[_0x1f32a6]={'transmuted_score':_0x523e19};}),_0x34f4e9['push']({'student_name':_0x74a7a2,'coaep':_0x36320c});}const _0x55e5bd=_0x4b5f17['find'](_0x5d20eb=>_0x5d20eb['some'](_0x22be7f=>_0x22be7f?.['includes']('ACHIEVED\x20THE\x20MINIMUM'))),_0x22dcad=_0x4b5f17['find'](_0x4da915=>_0x4da915['some'](_0x3bf022=>_0x3bf022?.['includes']('AVERAGE'))),_0xe5eb2b=_0x55e5bd?_0x55e5bd['slice'](_0xfbbb15)['map'](_0x52fe20=>_0x52fe20&&!isNaN(Number(_0x52fe20))?parseInt(_0x52fe20):0x0):[],_0x33b1cb=_0x22dcad?_0x22dcad['slice'](_0xfbbb15)['map'](_0x3104fb=>_0x3104fb&&_0x3104fb!=='#DIV/0!'&&!isNaN(Number(_0x3104fb))?parseInt(_0x3104fb):0x0):[],_0x3420e3={};let _0x367056=0x0;return Object['entries'](_0x607ea6)['forEach'](([_0x30946e,_0x5f3e8a])=>{if(!_0x3420e3[_0x30946e])_0x3420e3[_0x30946e]={};_0x5f3e8a['forEach'](_0x247ac6=>{_0x3420e3[_0x30946e][_0x247ac6]={'achievedMinimum':_0xe5eb2b[_0x367056]??0x0,'average':_0x33b1cb[_0x367056]??0x0},_0x367056++;});}),{'assessmentData':{'classAssignment':_0x3e88a0,'student':_0x34f4e9,'total':_0x3420e3}};}
|
|
31
31
|
|
|
32
|
-
async function uploadAssessmentData(
|
|
32
|
+
async function uploadAssessmentData(_0x356300,_0x59454e){try{const _0x57c7ab=await convertToCSVFile(_0x59454e),_0x12d9a6=await _0x57c7ab['text'](),_0x144596=parseAssessmentCsv(_0x12d9a6),_0x53504f=await fetch(_0x356300+'/assessment-data/upload',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x144596)});if(!_0x53504f['ok']){const _0x4f6dfb=await _0x53504f['json']();throw _0x4f6dfb;}return _0x53504f['json']();}catch(_0x4790f0){throw _0x4790f0;}}
|
|
33
33
|
|
|
34
|
-
async function uploadDeptFaculty(
|
|
34
|
+
async function uploadDeptFaculty(_0x36db14,_0x262c14){try{const _0x5b9206=await convertToCSVFile(_0x262c14),_0x2d9cd8=new FormData();_0x2d9cd8['append']('csvFile',_0x5b9206);const _0x28c8c2=await fetch(_0x36db14+'/dept-faculties/upload',{'method':'POST','body':_0x2d9cd8});if(!_0x28c8c2['ok']){const _0x39a1e9=await _0x28c8c2['json']();throw _0x39a1e9;}return _0x28c8c2['json']();}catch(_0x264292){throw _0x264292;}}
|
|
35
35
|
|
|
36
|
-
class Client{['BASE_URL'];constructor(
|
|
36
|
+
class Client{['BASE_URL'];constructor(_0x581906){this['BASE_URL']=_0x581906;}['Parser'](){return {'curriculum':async _0x2ee520=>{const _0x38a76b=await uploadCurriculum(this['BASE_URL'],_0x2ee520);return _0x38a76b;},'courseOffering':async _0x292438=>{const _0x2f2f82=await uploadCourseOffering(this['BASE_URL'],_0x292438);return _0x2f2f82;},'coaep':async(_0x125b65,_0x173c79)=>{const _0x2b4bd5=await uploadCOAEP(this['BASE_URL'],_0x125b65);return _0x2b4bd5;},'enrolledStudent':async _0x3bc634=>{const _0x320e13=await uploadEnrolledStudent(this['BASE_URL'],_0x3bc634);return _0x320e13;},'classlist':async(_0x399b2f,_0x292fa1,_0x341db2)=>{const _0x48e08f=await uploadClassList(this['BASE_URL'],_0x399b2f,_0x292fa1,_0x341db2);return _0x48e08f;},'assessmentData':async _0x313b0e=>{const _0x3f60a5=await uploadAssessmentData(this['BASE_URL'],_0x313b0e);return _0x3f60a5;},'deptFaculty':async _0x3a9e8c=>{const _0x108aec=await uploadDeptFaculty(this['BASE_URL'],_0x3a9e8c);return _0x108aec;}};}}
|
|
37
37
|
|
|
38
38
|
export { Client as default };
|
package/main.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export default class Client {
|
|
|
14
14
|
* @returns status 201
|
|
15
15
|
*/
|
|
16
16
|
courseOffering: (xls: File) => Promise<Record<string, unknown>>;
|
|
17
|
-
coaep: (xls: File, course_id: string) => Promise<
|
|
17
|
+
coaep: (xls: File, course_id: string) => Promise<void>;
|
|
18
18
|
enrolledStudent: (xls: File) => Promise<Record<string, unknown>>;
|
|
19
19
|
classlist: (xls: File, subj_code: number, period_id: number) => Promise<Record<string, unknown>>;
|
|
20
20
|
assessmentData: (xls: File) => Promise<Record<string, unknown>>;
|
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;
|
package/relay/uploadCOAEP.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function uploadCOAEP(url: string, xls: File, course_id: string): Promise<
|
|
1
|
+
export declare function uploadCOAEP(url: string, xls: File, course_id: string): Promise<void>;
|
|
@@ -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
|
+
}
|