diff --git a/.gitignore b/.gitignore index 7d05c29..f076304 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .env env \__pycache__ -venv/ \ No newline at end of file +venv/ +temp \ No newline at end of file diff --git a/examples/ebDetails.csv b/examples/ebDetails.csv index 7ebd9fa..598caad 100644 --- a/examples/ebDetails.csv +++ b/examples/ebDetails.csv @@ -1,29 +1,29 @@ -Name,Position,Discord,Email,LinkedIn,GitHub,Description,Year -Asish Kumar Dalai,Club Coordinator,-,-,-,-,-,- -Ojasva Jain,Secretary,Ojasva#4398,ojasva.20bcn7062@vitap.ac.in ,https://www.linkedin.com/in/ojasva-jain-9958071b2,https://github.com/ojasva,"Windows user, but Open source supporter. ",2021 -N. Krishna Raj,Technical Lead,KodeReaper#7759,krishna.19bce7357@vitap.ac.in,https://www.linkedin.com/in/n-krishna-raj/,https://github.com/kode-logger,"Octocats never die, they only Evolve.",2021 -Mahesh Dasika,Developer,Tech-Dynamo#5367,mahesh.20bci7075@vitap.ac.in,https://www.linkedin.com/in/mahesh-d-178b681b8/,https://github.com/mahesh-11102,Tech and Auto enthusiast,2021 -Sai Pranay,Technical Lead,sai pranay#9087,pranay.20bci7061@vitap.ac.in,https://www.linkedin.com/in/saipranay47/,https://github.com/saipranay47,I build things for the web,2021 -S Vijay Balaji,Community Leader,StranGe#9634,vijaykumar.19bce75741@vitap.ac.in,https://www.linkedin.com/in/svijayb/,https://github.com/SVijayB,"The more you sweat in peace, the less you bleed in war.",2021 -M Abhiram Kalyan,Head of videography,Abhiram#3959,kalyan.19bcd7118@vitap.ac.in,https://www.linkedin.com/in/abhiram-kalyan-883445190/,https://github.com/abhiram-kalyan,,2021 -GVS Sai Madhav,Technical Lead,DarthVader#3395,surya.19bcn7228@vitap.ac.in,https://www.linkedin.com/in/gvssmadhav,https://github.com/gvssaimadhav,"Soon, We Are Going to Live in the Era of AI.",2021 -Ch.Sabareesh Reddy,Social Media Lead,Sabareesh Reddy#1907,sabareesh.19bce7210@vitap.ac.in,https://www.linkedin.com/in/sabareesh-reddy-chowkacherla-6834a6196/,https://github.com/Sabareesh000,,2021 -Bhargavi Chada,Vice President,bhargavi#2592,bhargavi.19bcn7021@vitap.ac.in,https://www.linkedin.com/in/bhargavi-chada/,https://github.com/BhargaviChada,I like trains.,2021 -S.V.HarshaVardhan,Director,cody07#0153,harshavardhan.19BCD7149@vitap.ac.in,https://www.linkedin.com/in/harsha-samudrala-3ba66a216/,https://github.com/harsha0703,Think different for a better future. ,2021 -Datta Adithya G V,President,Hel#3566,adithya.19bce7119@vitap.ac.in,https://www.linkedin.com/in/datta-adithya/,https://github.com/dat-adi,Kind of a pogchamp.,2021 -Chirag Gupta,Chief Editor,chiragg#1721,chirag.20bce7453@vitap.ac.in,https://www.linkedin.com/in/chirag-gupta-8a16161ba,https://github.com/chiragg06,I overthink the niche.,2021 -T. Chethan,Event lead,Chethan#4848,tirpati.19bce7427@vitap.ac.in,https://www.linkedin.com/in/chethan-tirupati-523251194,https://github.com/chethantirupati,,2021 -Tarini Guttula,Head of public relations,Tarini#3832,tarini.19bce7758@vitap.ac.in,https://www.linkedin.com/in/tarinig/,https://github.com/tatiniG/,when day dreams become reality,2021 -Kaarthik,Chairman ,-,-,-,-,-,- -M V S S Maruti Kameshwar,Event lead,maruti kameshawar#5033,maruti.19bce7243@vitap.ac.in,https://www.linkedin.com/in/maruti-kameshwar-6b8846215/,https://github.com/marutikameshwar,,2021 -Aryan Mohanty,Developer,Aryan Mohanty#1066,aryan.21bce8377@vitapstudent.ac.in,https://www.linkedin.com/in/aryan-mohanty-230160221/,https://GitHub.com/AryanVIT,Better never means better for everyone it always means worse for some,2021 -Lakshmi Teja P,Treasurer,Lakshmi Teja#5620,lakshmi.19bcn7002@vitap.ac.in,https://www.linkedin.com/in/lakshmi-teja-bb45861a1/,https://github.com/LakshmiTejaP,A simple soul who gets really excited when the sky is in pretty colors.,2021 -Ashutosh Patel,Developer,Ashutosh#8081,ashutosh.20bce7053@vitap.ac.in,https://www.linkedin.com/in/ashutosh-patel-a828a4221/,https://github.com/ashu168,Don't complain just work harder,2021 -Rahul Alokkan,Organizer,RA7#0512,rahul.20bcn7006@vitap.ac.in,https://www.linkedin.com/in/rahul-alokkan-16384b196/,https://github.com/Rahul-Alokkan,Tech Entusiast ,2021 -Sai Shaket Kalivarapu,Documentation Specialist,Fushiguro#6451,shaket.19bce7547@vitap.ac.in,https://www.linkedin.com/in/sai-shaket-kalivarapu-51327618a/,https://github.com/KilluaZ06,I try to be the fun one,2021 -Dhruv Jha,Track lead,fullmeteor172#9084,dhruv.21bce7902@vitapstudent.ac.in,https://www.linkedin.com/in/dhruv-jha-2002/,https://github.com/fullmeteor172,"Not lazy, just on power saving mode ;-;",2021 -Praseeda kallakuri,Designer,praseeda kallakuri#8374,praseedha.21bce8649@vitapstudent.ac.in,https://www.linkedin.com/in/praseeda-kallakuri-970334221,https://github.com/praseedakallakuri,creative soul!!,2021 -Nishita Singh,Organizer,Nishita Singh#8630,nishita.21bce8684@vitapstudent.ac.in,,,,2021 -A. Loukya,Developer,loukya#7114,loukya.21bce7404@vitapstudent.ac.in,https://www.linkedin.com/in/adepu-loukya-67a345221/,https://github.com/A-Loukya,,2021 -Angel Maria Stanley,HR Lead,BlacDarc#9677,maria.21bce7363@vitapstudent.ac.in,https://www.linkedin.com/in/angel-stanly-218a0893/,https://github.com/Maiden23,"I dont know , and who cares , nobody is gonna read this anyways XD.",2021 -P. Kaarthik Sai,Head of marketing,CYRUS PLAGUE#3634,Kaarthik.19bcd7142@vitap.ac.in,https://www.linkedin.com/in/kaarthik-patibandla-30017219a/,https://github.com/kaarthik01,That which does not kill us makes us stronger,2021 +Name,Position,Discord,Email,LinkedIn,GitHub,Description +Asish Kumar Dalai,Club Coordinator,-,asish.d@vitap.ac.in,https://www.linkedin.com/in/asish-kumar-dalai-7b25ab169?originalSubdomain=in,-,- +Ojasva Jain,Secretary,Ojasva#4398,ojasva.20bcn7062@vitap.ac.in ,https://www.linkedin.com/in/ojasva-jain-9958071b2,https://github.com/ojasva,"Windows user, but Open source supporter. " +N. Krishna Raj,Technical Lead,KodeReaper#7759,krishna.19bce7357@vitap.ac.in,https://www.linkedin.com/in/n-krishna-raj/,https://github.com/kode-logger,"Octocats never die, they only Evolve." +Mahesh Dasika,Developer,Tech-Dynamo#5367,mahesh.20bci7075@vitap.ac.in,https://www.linkedin.com/in/mahesh-d-178b681b8/,https://github.com/mahesh-11102,Tech and Auto enthusiast +Sai Pranay,Technical Lead,sai pranay#9087,pranay.20bci7061@vitap.ac.in,https://www.linkedin.com/in/saipranay47/,https://github.com/saipranay47,I build things for the web +S Vijay Balaji,Community Leader,StranGe#9634,vijaykumar.19bce75741@vitap.ac.in,https://www.linkedin.com/in/svijayb/,https://github.com/SVijayB,"The more you sweat in peace, the less you bleed in war." +M Abhiram Kalyan,Head of videography,Abhiram#3959,kalyan.19bcd7118@vitap.ac.in,https://www.linkedin.com/in/abhiram-kalyan-883445190/,https://github.com/abhiram-kalyan, +GVS Sai Madhav,Technical Lead,DarthVader#3395,surya.19bcn7228@vitap.ac.in,https://www.linkedin.com/in/gvssmadhav,https://github.com/gvssaimadhav,"Soon, We Are Going to Live in the Era of AI." +Ch.Sabareesh Reddy,Social Media Lead,Sabareesh Reddy#1907,sabareesh.19bce7210@vitap.ac.in,https://www.linkedin.com/in/sabareesh-reddy-chowkacherla-6834a6196/,https://github.com/Sabareesh000, +Bhargavi Chada,Vice President,bhargavi#2592,bhargavi.19bcn7021@vitap.ac.in,https://www.linkedin.com/in/bhargavi-chada/,https://github.com/BhargaviChada,I like trains. +S.V.HarshaVardhan,Director,cody07#0153,harshavardhan.19BCD7149@vitap.ac.in,https://www.linkedin.com/in/harsha-samudrala-3ba66a216/,https://github.com/harsha0703,Think different for a better future. +Datta Adithya G V,President,Hel#3566,adithya.19bce7119@vitap.ac.in,https://www.linkedin.com/in/datta-adithya/,https://github.com/dat-adi,Kind of a pogchamp. +Chirag Gupta,Chief Editor,chiragg#1721,chirag.20bce7453@vitap.ac.in,https://www.linkedin.com/in/chirag-gupta-8a16161ba,https://github.com/chiragg06,I overthink the niche. +T. Chethan,Event lead,Chethan#4848,tirpati.19bce7427@vitap.ac.in,https://www.linkedin.com/in/chethan-tirupati-523251194,https://github.com/chethantirupati, +Tarini Guttula,Head of public relations,Tarini#3832,tarini.19bce7758@vitap.ac.in,https://www.linkedin.com/in/tarinig/,https://github.com/tatiniG/,when day dreams become reality +TBA ,Chairman ,-,-,-,-,- +M V S S Maruti Kameshwar,Event lead,maruti kameshawar#5033,maruti.19bce7243@vitap.ac.in,https://www.linkedin.com/in/maruti-kameshwar-6b8846215/,https://github.com/marutikameshwar, +Aryan Mohanty,Developer,Aryan Mohanty#1066,aryan.21bce8377@vitapstudent.ac.in,https://www.linkedin.com/in/aryan-mohanty-230160221/,https://GitHub.com/AryanVIT,Better never means better for everyone it always means worse for some +Lakshmi Teja P,Treasurer,Lakshmi Teja#5620,lakshmi.19bcn7002@vitap.ac.in,https://www.linkedin.com/in/lakshmi-teja-bb45861a1/,https://github.com/LakshmiTejaP,A simple soul who gets really excited when the sky is in pretty colors. +Ashutosh Patel,Developer,Ashutosh#8081,ashutosh.20bce7053@vitap.ac.in,https://www.linkedin.com/in/ashutosh-patel-a828a4221/,https://github.com/ashu168,Don't complain just work harder +Rahul Alokkan,Organizer,RA7#0512,rahul.20bcn7006@vitap.ac.in,https://www.linkedin.com/in/rahul-alokkan-16384b196/,https://github.com/Rahul-Alokkan,Tech Entusiast +Sai Shaket Kalivarapu,Documentation Specialist,Fushiguro#6451,shaket.19bce7547@vitap.ac.in,https://www.linkedin.com/in/sai-shaket-kalivarapu-51327618a/,https://github.com/KilluaZ06,I try to be the fun one +Dhruv Jha,Track lead,fullmeteor172#9084,dhruv.21bce7902@vitapstudent.ac.in,https://www.linkedin.com/in/dhruv-jha-2002/,https://github.com/fullmeteor172,"Not lazy, just on power saving mode ;-;" +Praseeda kallakuri,Designer,praseeda kallakuri#8374,praseedha.21bce8649@vitapstudent.ac.in,https://www.linkedin.com/in/praseeda-kallakuri-970334221,https://github.com/praseedakallakuri,creative soul!! +Nishita Singh,Organizer,Nishita Singh#8630,nishita.21bce8684@vitapstudent.ac.in,,, +A. Loukya,Developer,loukya#7114,loukya.21bce7404@vitapstudent.ac.in,https://www.linkedin.com/in/adepu-loukya-67a345221/,https://github.com/A-Loukya, +Angel Maria Stanley,HR Lead,BlacDarc#9677,maria.21bce7363@vitapstudent.ac.in,https://www.linkedin.com/in/angel-stanly-218a0893/,https://github.com/Maiden23,"I dont know , and who cares , nobody is gonna read this anyways XD." +P. Kaarthik Sai,Head of marketing,CYRUS PLAGUE#3634,Kaarthik.19bcd7142@vitap.ac.in,https://www.linkedin.com/in/kaarthik-patibandla-30017219a/,https://github.com/kaarthik01,That which does not kill us makes us stronger diff --git a/examples/ebDetails.json b/examples/ebDetails.json index 25d3891..12fb03b 100644 --- a/examples/ebDetails.json +++ b/examples/ebDetails.json @@ -1,334 +1,295 @@ { - "Club Coordinator": [ - { - "Name": "Asish Kumar Dalai", - "Position": "Club Coordinator", - "Discord": "-", - "Email": "-", - "LinkedIn": "-", - "GitHub": "-", - "Description": "-", - "Year": "-" - } - ], - "Community Leader": [ - { - "Name": "S Vijay Balaji", - "Position": "Community Leader", - "Discord": "StranGe#9634", - "Email": "vijaykumar.19bce75741@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/svijayb/", - "GitHub": "https://github.com/SVijayB", - "Description": "The more you sweat in peace, the less you bleed in war.", - "Year": "2021" - } - ], - "Vice President": [ - { - "Name": "Bhargavi Chada", - "Position": "Vice President", - "Discord": "bhargavi#2592", - "Email": "bhargavi.19bcn7021@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/bhargavi-chada/", - "GitHub": "https://github.com/BhargaviChada", - "Description": "I like trains.", - "Year": "2021" + "2021": { + "Admin Department": { + "Club coordinator": [ + { + "Name": "Asish Kumar Dalai", + "Position": "Club Coordinator", + "Discord": "-", + "Email": "asish.d@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/asish-kumar-dalai-7b25ab169?originalSubdomain=in", + "GitHub": "-", + "Description": "-" + } + ], + "Community leader": [ + { + "Name": "S Vijay Balaji", + "Position": "Community Leader", + "Discord": "StranGe#9634", + "Email": "vijaykumar.19bce75741@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/svijayb/", + "GitHub": "https://github.com/SVijayB", + "Description": "The more you sweat in peace, the less you bleed in war." + } + ], + "President": [ + { + "Name": "Datta Adithya G V", + "Position": "President", + "Discord": "Hel#3566", + "Email": "adithya.19bce7119@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/datta-adithya/", + "GitHub": "https://github.com/dat-adi", + "Description": "Kind of a pogchamp." + } + ], + "Director": [ + { + "Name": "S.V.HarshaVardhan", + "Position": "Director", + "Discord": "cody07#0153", + "Email": "harshavardhan.19BCD7149@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/harsha-samudrala-3ba66a216/", + "GitHub": "https://github.com/harsha0703", + "Description": "Think different for a better future. " + } + ], + "Treasurer": [ + { + "Name": "Lakshmi Teja P", + "Position": "Treasurer", + "Discord": "Lakshmi Teja#5620", + "Email": "lakshmi.19bcn7002@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/lakshmi-teja-bb45861a1/", + "GitHub": "https://github.com/LakshmiTejaP", + "Description": "A simple soul who gets really excited when the sky is in pretty colors." + } + ], + "Vice president": [ + { + "Name": "Bhargavi Chada", + "Position": "Vice President", + "Discord": "bhargavi#2592", + "Email": "bhargavi.19bcn7021@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/bhargavi-chada/", + "GitHub": "https://github.com/BhargaviChada", + "Description": "I like trains." + } + ], + "Secretary": [ + { + "Name": "Ojasva Jain", + "Position": "Secretary", + "Discord": "Ojasva#4398", + "Email": "ojasva.20bcn7062@vitap.ac.in ", + "LinkedIn": "https://www.linkedin.com/in/ojasva-jain-9958071b2", + "GitHub": "https://github.com/ojasva", + "Description": "Windows user, but Open source supporter. " + } + ], + "Head of public relations": [ + { + "Name": "Tarini Guttula", + "Position": "Head of public relations", + "Discord": "Tarini#3832", + "Email": "tarini.19bce7758@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/tarinig/", + "GitHub": "https://github.com/tatiniG/", + "Description": "when day dreams become reality" + } + ], + "Track lead": [ + { + "Name": "Dhruv Jha", + "Position": "Track lead", + "Discord": "fullmeteor172#9084", + "Email": "dhruv.21bce7902@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/dhruv-jha-2002/", + "GitHub": "https://github.com/fullmeteor172", + "Description": "Not lazy, just on power saving mode ;-;" + } + ], + "Hr lead": [ + { + "Name": "Angel Maria Stanley", + "Position": "HR Lead", + "Discord": "BlacDarc#9677", + "Email": "maria.21bce7363@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/angel-stanly-218a0893/", + "GitHub": "https://github.com/Maiden23", + "Description": "I dont know , and who cares , nobody is gonna read this anyways XD." + } + ] }, - { - "Name": "Bhargavi Chada", - "Position": "Vice President", - "Discord": "bhargavi#2592", - "Email": "bhargavi.19bcn7021@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/bhargavi-chada/", - "GitHub": "https://github.com/BhargaviChada", - "Description": "I like trains.", - "Year": "2021" - } - ], - "President": [ - { - "Name": "Datta Adithya G V", - "Position": "President", - "Discord": "Hel#3566", - "Email": "adithya.19bce7119@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/datta-adithya/", - "GitHub": "https://github.com/dat-adi", - "Description": "Kind of a pogchamp.", - "Year": "2021" - } - ], - "Director": [ - { - "Name": "S.V.HarshaVardhan", - "Position": "Director", - "Discord": "cody07#0153", - "Email": "harshavardhan.19BCD7149@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/harsha-samudrala-3ba66a216/", - "GitHub": "https://github.com/harsha0703", - "Description": "Think different for a better future. ", - "Year": "2021" - } - ], - "Chairman ": [ - { - "Name": "Kaarthik", - "Position": "Chairman ", - "Discord": "-", - "Email": "-", - "LinkedIn": "-", - "GitHub": "-", - "Description": "-", - "Year": "-" - } - ], - "Treasurer": [ - { - "Name": "Lakshmi Teja P", - "Position": "Treasurer", - "Discord": "Lakshmi Teja#5620", - "Email": "lakshmi.19bcn7002@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/lakshmi-teja-bb45861a1/", - "GitHub": "https://github.com/LakshmiTejaP", - "Description": "A simple soul who gets really excited when the sky is in pretty colors.", - "Year": "2021" - } - ], - "Secretary": [ - { - "Name": "Ojasva Jain", - "Position": "Secretary", - "Discord": "Ojasva#4398", - "Email": "ojasva.20bcn7062@vitap.ac.in ", - "LinkedIn": "https://www.linkedin.com/in/ojasva-jain-9958071b2", - "GitHub": "https://github.com/ojasva", - "Description": "Windows user, but Open source supporter. ", - "Year": "2021" - } - ], - "Head of public relations": [ - { - "Name": "Tarini Guttula", - "Position": "Head of public relations", - "Discord": "Tarini#3832", - "Email": "tarini.19bce7758@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/tarinig/", - "GitHub": "https://github.com/tatiniG/", - "Description": "when day dreams become reality", - "Year": "2021" - } - ], - "Track lead": [ - { - "Name": "Dhruv Jha", - "Position": "Track lead", - "Discord": "fullmeteor172#9084", - "Email": "dhruv.21bce7902@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/dhruv-jha-2002/", - "GitHub": "https://github.com/fullmeteor172", - "Description": "Not lazy, just on power saving mode ;-;", - "Year": "2021" - } - ], - "HR Lead": [ - { - "Name": "Angel Maria Stanley", - "Position": "HR Lead", - "Discord": "BlacDarc#9677", - "Email": "maria.21bce7363@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/angel-stanly-218a0893/", - "GitHub": "https://github.com/Maiden23", - "Description": "I dont know , and who cares , nobody is gonna read this anyways XD.", - "Year": "2021" - } - ], - "Event lead": [ - { - "Name": "T. Chethan", - "Position": "Event lead", - "Discord": "Chethan#4848", - "Email": "tirpati.19bce7427@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/chethan-tirupati-523251194", - "GitHub": "https://github.com/chethantirupati", - "Description": "", - "Year": "2021" + "Event Department": { + "Event lead": [ + { + "Name": "T. Chethan", + "Position": "Event lead", + "Discord": "Chethan#4848", + "Email": "tirpati.19bce7427@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/chethan-tirupati-523251194", + "GitHub": "https://github.com/chethantirupati", + "Description": "" + }, + { + "Name": "M V S S Maruti Kameshwar", + "Position": "Event lead", + "Discord": "maruti kameshawar#5033", + "Email": "maruti.19bce7243@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/maruti-kameshwar-6b8846215/", + "GitHub": "https://github.com/marutikameshwar", + "Description": "" + } + ], + "Social media lead": [ + { + "Name": "Ch.Sabareesh Reddy", + "Position": "Social Media Lead", + "Discord": "Sabareesh Reddy#1907", + "Email": "sabareesh.19bce7210@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/sabareesh-reddy-chowkacherla-6834a6196/", + "GitHub": "https://github.com/Sabareesh000", + "Description": "" + } + ], + "Organizer": [ + { + "Name": "Rahul Alokkan", + "Position": "Organizer", + "Discord": "RA7#0512", + "Email": "rahul.20bcn7006@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/rahul-alokkan-16384b196/", + "GitHub": "https://github.com/Rahul-Alokkan", + "Description": "Tech Entusiast " + }, + { + "Name": "Nishita Singh", + "Position": "Organizer", + "Discord": "Nishita Singh#8630", + "Email": "nishita.21bce8684@vitapstudent.ac.in", + "LinkedIn": "", + "GitHub": "", + "Description": "" + } + ] }, - { - "Name": "M V S S Maruti Kameshwar", - "Position": "Event lead", - "Discord": "maruti kameshawar#5033", - "Email": "maruti.19bce7243@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/maruti-kameshwar-6b8846215/", - "GitHub": "https://github.com/marutikameshwar", - "Description": "", - "Year": "2021" - } - ], - "Social Media Lead": [ - { - "Name": "Ch.Sabareesh Reddy", - "Position": "Social Media Lead", - "Discord": "Sabareesh Reddy#1907", - "Email": "sabareesh.19bce7210@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/sabareesh-reddy-chowkacherla-6834a6196/", - "GitHub": "https://github.com/Sabareesh000", - "Description": "", - "Year": "2021" - } - ], - "Organizer": [ - { - "Name": "Rahul Alokkan", - "Position": "Organizer", - "Discord": "RA7#0512", - "Email": "rahul.20bcn7006@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/rahul-alokkan-16384b196/", - "GitHub": "https://github.com/Rahul-Alokkan", - "Description": "Tech Entusiast ", - "Year": "2021" + "Tech Department": { + "Technical lead": [ + { + "Name": "N. Krishna Raj", + "Position": "Technical Lead", + "Discord": "KodeReaper#7759", + "Email": "krishna.19bce7357@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/n-krishna-raj/", + "GitHub": "https://github.com/kode-logger", + "Description": "Octocats never die, they only Evolve." + }, + { + "Name": "Sai Pranay", + "Position": "Technical Lead", + "Discord": "sai pranay#9087", + "Email": "pranay.20bci7061@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/saipranay47/", + "GitHub": "https://github.com/saipranay47", + "Description": "I build things for the web" + }, + { + "Name": "GVS Sai Madhav", + "Position": "Technical Lead", + "Discord": "DarthVader#3395", + "Email": "surya.19bcn7228@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/gvssmadhav", + "GitHub": "https://github.com/gvssaimadhav", + "Description": "Soon, We Are Going to Live in the Era of AI." + } + ], + "Developer": [ + { + "Name": "Mahesh Dasika", + "Position": "Developer", + "Discord": "Tech-Dynamo#5367", + "Email": "mahesh.20bci7075@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/mahesh-d-178b681b8/", + "GitHub": "https://github.com/mahesh-11102", + "Description": "Tech and Auto enthusiast" + }, + { + "Name": "Aryan Mohanty", + "Position": "Developer", + "Discord": "Aryan Mohanty#1066", + "Email": "aryan.21bce8377@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/aryan-mohanty-230160221/", + "GitHub": "https://GitHub.com/AryanVIT", + "Description": "Better never means better for everyone it always means worse for some" + }, + { + "Name": "Ashutosh Patel", + "Position": "Developer", + "Discord": "Ashutosh#8081", + "Email": "ashutosh.20bce7053@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/ashutosh-patel-a828a4221/", + "GitHub": "https://github.com/ashu168", + "Description": "Don't complain just work harder" + }, + { + "Name": "A. Loukya", + "Position": "Developer", + "Discord": "loukya#7114", + "Email": "loukya.21bce7404@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/adepu-loukya-67a345221/", + "GitHub": "https://github.com/A-Loukya", + "Description": "" + } + ] }, - { - "Name": "Nishita Singh", - "Position": "Organizer", - "Discord": "Nishita Singh#8630", - "Email": "nishita.21bce8684@vitapstudent.ac.in", - "LinkedIn": "", - "GitHub": "", - "Description": "", - "Year": "2021" - } - ], - "Technical Lead": [ - { - "Name": "N. Krishna Raj", - "Position": "Technical Lead", - "Discord": "KodeReaper#7759", - "Email": "krishna.19bce7357@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/n-krishna-raj/", - "GitHub": "https://github.com/kode-logger", - "Description": "Octocats never die, they only Evolve.", - "Year": "2021" - }, - { - "Name": "Sai Pranay", - "Position": "Technical Lead", - "Discord": "sai pranay#9087", - "Email": "pranay.20bci7061@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/saipranay47/", - "GitHub": "https://github.com/saipranay47", - "Description": "I build things for the web", - "Year": "2021" - }, - { - "Name": "GVS Sai Madhav", - "Position": "Technical Lead", - "Discord": "DarthVader#3395", - "Email": "surya.19bcn7228@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/gvssmadhav", - "GitHub": "https://github.com/gvssaimadhav", - "Description": "Soon, We Are Going to Live in the Era of AI.", - "Year": "2021" - } - ], - "Developer": [ - { - "Name": "Mahesh Dasika", - "Position": "Developer", - "Discord": "Tech-Dynamo#5367", - "Email": "mahesh.20bci7075@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/mahesh-d-178b681b8/", - "GitHub": "https://github.com/mahesh-11102", - "Description": "Tech and Auto enthusiast", - "Year": "2021" - }, - { - "Name": "Aryan Mohanty", - "Position": "Developer", - "Discord": "Aryan Mohanty#1066", - "Email": "aryan.21bce8377@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/aryan-mohanty-230160221/", - "GitHub": "https://GitHub.com/AryanVIT", - "Description": "Better never means better for everyone it always means worse for some", - "Year": "2021" - }, - { - "Name": "Ashutosh Patel", - "Position": "Developer", - "Discord": "Ashutosh#8081", - "Email": "ashutosh.20bce7053@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/ashutosh-patel-a828a4221/", - "GitHub": "https://github.com/ashu168", - "Description": "Don't complain just work harder", - "Year": "2021" - }, - { - "Name": "A. Loukya", - "Position": "Developer", - "Discord": "loukya#7114", - "Email": "loukya.21bce7404@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/adepu-loukya-67a345221/", - "GitHub": "https://github.com/A-Loukya", - "Description": "", - "Year": "2021" - } - ], - "Head of marketing": [ - { - "Name": "P. Kaarthik Sai", - "Position": "Head of marketing", - "Discord": "CYRUS PLAGUE#3634", - "Email": "Kaarthik.19bcd7142@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/kaarthik-patibandla-30017219a/", - "GitHub": "https://github.com/kaarthik01", - "Description": "That which does not kill us makes us stronger", - "Year": "2021" - } - ], - "Chief Editor": [ - { - "Name": "Chirag Gupta", - "Position": "Chief Editor", - "Discord": "chiragg#1721", - "Email": "chirag.20bce7453@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/chirag-gupta-8a16161ba", - "GitHub": "https://github.com/chiragg06", - "Description": "I overthink the niche.", - "Year": "2021" - } - ], - "Head of videography": [ - { - "Name": "M Abhiram Kalyan", - "Position": "Head of videography", - "Discord": "Abhiram#3959", - "Email": "kalyan.19bcd7118@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/abhiram-kalyan-883445190/", - "GitHub": "https://github.com/abhiram-kalyan", - "Description": "", - "Year": "2021" - } - ], - "Documentation Specialist": [ - { - "Name": "Sai Shaket Kalivarapu", - "Position": "Documentation Specialist", - "Discord": "Fushiguro#6451", - "Email": "shaket.19bce7547@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/sai-shaket-kalivarapu-51327618a/", - "GitHub": "https://github.com/KilluaZ06", - "Description": "I try to be the fun one", - "Year": "2021" - } - ], - "Designer": [ - { - "Name": "Praseeda kallakuri", - "Position": "Designer", - "Discord": "praseeda kallakuri#8374", - "Email": "praseedha.21bce8649@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/praseeda-kallakuri-970334221", - "GitHub": "https://github.com/praseedakallakuri", - "Description": "creative soul!!", - "Year": "2021" + "Design Team": { + "Head of marketing": [ + { + "Name": "P. Kaarthik Sai", + "Position": "Head of marketing", + "Discord": "CYRUS PLAGUE#3634", + "Email": "Kaarthik.19bcd7142@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/kaarthik-patibandla-30017219a/", + "GitHub": "https://github.com/kaarthik01", + "Description": "That which does not kill us makes us stronger" + } + ], + "Chief editor": [ + { + "Name": "Chirag Gupta", + "Position": "Chief Editor", + "Discord": "chiragg#1721", + "Email": "chirag.20bce7453@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/chirag-gupta-8a16161ba", + "GitHub": "https://github.com/chiragg06", + "Description": "I overthink the niche." + } + ], + "Head of videography": [ + { + "Name": "M Abhiram Kalyan", + "Position": "Head of videography", + "Discord": "Abhiram#3959", + "Email": "kalyan.19bcd7118@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/abhiram-kalyan-883445190/", + "GitHub": "https://github.com/abhiram-kalyan", + "Description": "" + } + ], + "Documentation specialist": [ + { + "Name": "Sai Shaket Kalivarapu", + "Position": "Documentation Specialist", + "Discord": "Fushiguro#6451", + "Email": "shaket.19bce7547@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/sai-shaket-kalivarapu-51327618a/", + "GitHub": "https://github.com/KilluaZ06", + "Description": "I try to be the fun one" + } + ], + "Designer": [ + { + "Name": "Praseeda kallakuri", + "Position": "Designer", + "Discord": "praseeda kallakuri#8374", + "Email": "praseedha.21bce8649@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/praseeda-kallakuri-970334221", + "GitHub": "https://github.com/praseedakallakuri", + "Description": "creative soul!!" + } + ] } - ] + } } diff --git a/requirements.txt b/requirements.txt index 5004c63..e9cc42e 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/scripts/csv_to_json.py b/scripts/csv_to_json.py index d446826..27fab97 100644 --- a/scripts/csv_to_json.py +++ b/scripts/csv_to_json.py @@ -1,5 +1,6 @@ import csv import json +from pprint import pprint """ Convert CSV to JSON. @@ -11,7 +12,8 @@ def csv_to_json(csvFile, jsonFile): json_data = {} - heirarchy_order = { + position_data = {} + hierarchy_order = { "Admin Department": [ "Club Coordinator", "Community Leader", @@ -43,21 +45,33 @@ def csv_to_json(csvFile, jsonFile): ], } All_positions = [] - for key, value in heirarchy_order.items(): + for key, value in hierarchy_order.items(): for i in value: - All_positions.append(i) + All_positions.append(i.capitalize()) with open(csvFile, encoding="utf-8") as f: csvReader = list(csv.DictReader(f)) for position in All_positions: for rows in csvReader: - key = rows["Position"] - print(position, rows["Position"]) - if position in rows["Position"]: - if key in json_data: - json_data[key].append(rows) + key = rows["Position"].capitalize() + if position in key: + if key in position_data: + position_data[key].append(rows) else: - json_data[key] = [rows] + position_data[key] = [rows] + + for key in json_data.keys(): + for i in range(len(json_data[key])): + del json_data[key][i]["Position"] + + dept_list = hierarchy_order.keys() + for dept in dept_list: + json_data[dept] = {} + for position, value in position_data.items(): + for i in range(len(hierarchy_order[dept])): + if position in hierarchy_order[dept][i].capitalize(): + if dept in json_data: + json_data[dept][position] = value with open(jsonFile, "w", encoding="utf-8") as f: f.write(json.dumps(json_data, indent=4, separators=(",", ": "))) diff --git a/scripts/get_current_eb.py b/scripts/get_current_eb.py new file mode 100644 index 0000000..e230a39 --- /dev/null +++ b/scripts/get_current_eb.py @@ -0,0 +1,34 @@ +import json +from pprint import pprint +from datetime import datetime + + +def getLatestEb(): + jsonFile = "examples\ebDetails.json" + with open(jsonFile, "r") as f: + data = json.load(f) + + x = str(datetime.now()) + year = x.strip()[0:4] + next_year = eval(year) + 1 + + # print(len(data["Tech Department"]["Developer"])) + # print(data["Admin Department"]["Community leader"][0]["endYear"]) + + current_eb = {} + for dept in data.keys(): + for position in data[dept].keys(): + for num in range(len(data[dept][position])): + current_year = data[dept][position][num]["endYear"] + if current_year == str(year) or current_year == str(next_year): + if dept in current_eb: + current_eb[dept][position] = data[dept][position] + else: + current_eb[dept] = {position: data[dept][position]} + + return current_eb + + +# Try to avoid sorting data -> Maintain hierarchy structure. +result = getLatestEb() +pprint(result) diff --git a/src/app.py b/src/app.py index c310c14..fb6f350 100644 --- a/src/app.py +++ b/src/app.py @@ -16,6 +16,7 @@ def create_app(): ] } CORS(app, resources={"/*": api_cors_config}) + app.config["SECRET_KEY"] = os.getenv("SECRET_KEY") @app.route("/", methods=["GET"]) def index(): diff --git a/src/routes/__init__.py b/src/routes/__init__.py index adef4fe..beac332 100644 --- a/src/routes/__init__.py +++ b/src/routes/__init__.py @@ -1,8 +1,10 @@ from flask import Blueprint from src.routes.events import event +from src.routes.eb_details import eb api_blueprint = Blueprint("API", __name__, url_prefix="/api/") api_blueprint.register_blueprint(event.event_bp) +api_blueprint.register_blueprint(eb.eb_bp) @api_blueprint.route("/", methods=["GET"]) diff --git a/src/routes/eb_details/db_connection.py b/src/routes/eb_details/db_connection.py new file mode 100644 index 0000000..1cf86ee --- /dev/null +++ b/src/routes/eb_details/db_connection.py @@ -0,0 +1,64 @@ +from pymongo import MongoClient +from bson import json_util +from dotenv import load_dotenv +import pymongo +import json +import os + + +def connection(): + load_dotenv() + CONNECTION_STRING = os.getenv("MONGO_DB_CON") + db = MongoClient(CONNECTION_STRING).ebDetails + collection = db["details"] + return collection + + +def addContent(data, year): + collection = connection() + if collection.count_documents({"Year": year}) == 0: + collection.insert_one(data) + else: + collection.update_one( + {"Year": year}, + { + "$set": { + "Admin Department": data["Admin Department"], + "Event Department": data["Event Department"], + "Tech Department": data["Tech Department"], + "Design Team": data["Design Team"], + } + }, + ) + return {"status": "success"} + + +def deleteData(year): + collection = connection() + try: + collection.delete_one({"Year": year}) + return {"status": "success", "message": "Data deleted"} + except: + return {"status": "fail", "message": "Year not found"}, 400 + + +def getData(year, department): + collection = connection() + try: + data = collection.find_one({"Year": year}) + del data["_id"] + if not department == None: + department = department.replace("-", " ") + department = department.title() + data = data[department] + except: + return False + data = json.loads(json_util.dumps(data)) + return data + + +def getCurrentEB(department): + collection = connection() + latest = collection.find({}).sort("Year", pymongo.DESCENDING).limit(1) + year = latest[0]["Year"] + return getData(year, department) diff --git a/src/routes/eb_details/eb.py b/src/routes/eb_details/eb.py new file mode 100644 index 0000000..e96b842 --- /dev/null +++ b/src/routes/eb_details/eb.py @@ -0,0 +1,88 @@ +from flask import request, Blueprint, flash, current_app, jsonify +from pymongo import results +from werkzeug.utils import secure_filename +from dotenv import load_dotenv +import os + +from src.routes.eb_details.db_connection import * +from src.utils.csv_to_json import csv_to_json + + +load_dotenv() +UPLOAD_FOLDER = "temp" +ALLOWED_EXTENSIONS = {"csv"} +eb_bp = Blueprint("eb", __name__, url_prefix="/eb") + + +@eb_bp.route("/", methods=["GET"]) +def get_data(year): + department = request.args.get("dept") + result = getData(year, department) + if not result: + return ("ERROR: Data corresponding to search queries not found"), 404 + return jsonify(result) + + +@eb_bp.route("/current", methods=["GET"]) +def get_current_eb(): + department = request.args.get("dept") + result = getCurrentEB(department) + if not result: + return ("ERROR: Data corresponding to search queries not found"), 404 + return jsonify(result) + + +@eb_bp.route("/delete_data", methods=["DELETE"]) +def delete_data(): + key, year = request.args.get("key"), int(request.args.get("year")) + if not key == os.getenv("API_KEY"): + return "Unauthorized: Invalid API Key", 401 + else: + return deleteData(year) + + +@eb_bp.route("/add_data", methods=["GET", "POST"]) +def uploadFiles(): + current_app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER + if request.method == "POST": + key, year = request.args.get("key"), int(request.args.get("year")) + if not key == os.getenv("API_KEY"): + return "Unauthorized: Invalid API Key", 401 + if not year: + return ( + "Error: Please provide the year for which you want to upload EB details", + 400, + ) + if "file" not in request.files: + return ( + "ERROR: File not found. Please upload a CSV file containing details", + 400, + ) + file = request.files["file"] + filename = file.filename + if filename == "": + flash("No file selected") + return "ERROR: File not found.", 400 + allowed_file = "." in filename and filename.rsplit(".", 1)[1].lower() in {"csv"} + if file and allowed_file: + filename = secure_filename(filename) + file.save(os.path.join(current_app.config["UPLOAD_FOLDER"], filename)) + try: + result = csv_to_json(f"{UPLOAD_FOLDER}/{filename}", year) + except: + return ( + "ERROR: Make sure to follow exact structure as provided in examples/ebDetails.csv", + 400, + ) + return result + else: + return ("ERROR: Only CSV files are allowed", 400) + return """ + + Upload new File +

Upload new File

+
+ + +
+ """ diff --git a/src/routes/events/db_connection.py b/src/routes/events/db_connection.py index 2af6635..9e55bbc 100644 --- a/src/routes/events/db_connection.py +++ b/src/routes/events/db_connection.py @@ -4,10 +4,15 @@ import json -def connection(): +def connection(type=None, *args): conn = psycopg2.connect(os.getenv("DATABASE_URL")) cursor = conn.cursor() - query = """SELECT * FROM eventreg_event""" + if not type: + query = """SELECT * FROM eventreg_event""" + elif type == "latest": + query = """SELECT * FROM eventreg_event ORDER BY id DESC LIMIT 1""" + elif type == "eventID": + query = f"""SELECT * FROM eventreg_event WHERE id = {args[0]}""" cursor.execute(query) data = cursor.fetchall() conn.close() @@ -36,6 +41,9 @@ def connection(): } ) + if not result: + return None + result.sort(key=lambda x: x["id"]) json_data = json.dumps(result, indent=4, default=str) return json.loads(json_data) diff --git a/src/routes/events/event.py b/src/routes/events/event.py index ec30ab8..d117c86 100644 --- a/src/routes/events/event.py +++ b/src/routes/events/event.py @@ -8,32 +8,25 @@ @event_bp.route("/", methods=["GET"]) def get_data(): - data = connection() - return jsonify(data) - - -@event_bp.route("/", methods=["GET"]) -def get_id(id): - data = connection() - temp = 0 - for event in data: - if event["id"] == id: - temp = 1 - break - else: - temp = 0 - if temp == 1: - event = jsonify(event) - return event + event_id = request.args.get("id") + if not event_id: + data = connection() else: - return "ERROR 404: CANNOT GET {}".format(request.path) + data = connection("eventID", event_id) + if data: + return jsonify(data) + else: + return ( + "ERROR 404: Event with ID {} not found".format(event_id), + 404, + ) + return jsonify(data) @event_bp.route("/latest", methods=["GET"]) def latest_event(): - data = connection() - latest = data[-1] - return latest + data = connection("latest") + return jsonify(data) @event_bp.route("/announcement", methods=["GET"]) @@ -53,15 +46,15 @@ def make_announcement(): 500, ) - data = connection() - print(event_id) if not event_id: - required_event = data[-1] - - for event in data: - if event_id == str(event["id"]): - required_event = event - break - + required_event = connection("latest") + else: + required_event = connection("eventID", event_id) + if not required_event: + return ( + "ERROR 404: Event with ID {} not found".format(event_id), + 404, + ) + print(required_event) status = send_discord_announcement(WEBHOOK_URL, required_event) return jsonify({"success": status}) diff --git a/src/utils/csv_to_json.py b/src/utils/csv_to_json.py new file mode 100644 index 0000000..50f76fe --- /dev/null +++ b/src/utils/csv_to_json.py @@ -0,0 +1,76 @@ +import csv +import os + +# import json +from src.routes.eb_details.db_connection import * + + +def csv_to_json(csvFile, year): + json_data = {} + position_data = {} + hierarchy_order = { + "Admin Department": [ + "Club Coordinator", + "Community Leader", + "President", + "Director", + "Chairman", + "Treasurer", + "Vice President", + "Secretary", + "Head of public relations", + "Track lead", + "HR Lead", + ], + "Event Department": [ + "Event lead", + "Social Media Lead", + "Organizer", + ], + "Tech Department": [ + "Technical Lead", + "Developer", + ], + "Design Team": [ + "Head of marketing", + "Chief Editor", + "Head of videography", + "Documentation Specialist", + "Designer", + ], + } + All_positions = [] + for key, value in hierarchy_order.items(): + for i in value: + All_positions.append(i.capitalize()) + + with open(csvFile, encoding="utf-8") as f: + csvReader = list(csv.DictReader(f)) + for position in All_positions: + for rows in csvReader: + key = rows["Position"].capitalize() + if position in key: + if key in position_data: + position_data[key].append(rows) + else: + position_data[key] = [rows] + + for key in json_data.keys(): + for i in range(len(json_data[key])): + del json_data[key][i]["Position"] + + dept_list = hierarchy_order.keys() + for dept in dept_list: + json_data[dept] = {} + for position, value in position_data.items(): + for i in range(len(hierarchy_order[dept])): + if position in hierarchy_order[dept][i].capitalize(): + if dept in json_data: + json_data[dept][position] = value + json_data["Year"] = year + # jsonFile = "temp/temp_json_file.json" + # with open(jsonFile, "w", encoding="utf-8") as f: + # f.write(json.dumps(json_data, indent=4, separators=(",", ": "))) + os.remove(csvFile) + + return addContent(json_data, year) diff --git a/src/utils/discord_webhook.py b/src/utils/discord_webhook.py index c891bc0..5a4ae54 100644 --- a/src/utils/discord_webhook.py +++ b/src/utils/discord_webhook.py @@ -1,10 +1,11 @@ -from typing import Dict +from typing import List from dhooks import Embed, Webhook import traceback -def send_discord_announcement(webhook_url: str, event: Dict) -> bool: +def send_discord_announcement(webhook_url: str, event: List) -> bool: try: + event = event[0] w = Webhook(webhook_url) embed = Embed( title="📢 " + event["eventName"], diff --git a/temp/.gitkeep b/temp/.gitkeep new file mode 100644 index 0000000..e69de29