advweb-grp1 / advanced-web-final-year-project

Final year advanced web develop unit project
MIT License
1 stars 0 forks source link

feature/addData #35

Closed D4ni3l8 closed 1 year ago

D4ni3l8 commented 1 year ago

This is the initial add data page. I will make a dropbox where the user is able to insert files and upload them to firebase.

github-actions[bot] commented 1 year ago

Visit the preview URL for this PR (updated for commit 253f600):

https://adv-web-grp1--pr35-feature-adddata-j8sq5b9b.web.app

(expires Sun, 30 Apr 2023 11:27:44 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: e45f8bd17b7de44787580bea572e36aa09784b8c

LiamSingh64 commented 1 year ago

added bootstrap so it looks better, input-types changed so they reflect data-types more appropriately, added html element to upload a file

LiamSingh64 commented 1 year ago

Is the user only allowed to upload .csv data? If yes, I will change <input type="file"> to <input type="file" accept=".csv">

rwx-yxu commented 1 year ago

Is the user only allowed to upload .csv data? If yes, I will change <input type="file"> to <input type="file" accept=".csv">

I would suggest to review the usecase for add data #8

rwx-yxu commented 1 year ago

current layout for reference: image

LiamSingh64 commented 1 year ago

Please lemme know if i'm missing anything from the hcm json data being added to firestore Here's how it currently looks with example: { ACTCmutation: 0 AgeatMRI: 45, ApicalHCM: 1, Diabetes: 1, Hypertension: 1, MYBPC3mutation: MYH7: 0, MYL2: 0, Myectomy: 0, SuddenCardiacDeath: 0, TNNCI: 0, TNNI3: 0, TNNT2mutation: 0, TPM1: 0, TT: 0, female: 0, ledv: 0, lesv: 2, lsv: 8, lvef: 4, lvmass: 6, redv: 1, resv: 3, rsv: 9, rvef: 5, rvmass: 7, scar: 0 }

LiamSingh64 commented 1 year ago

TODO:

LiamSingh64 commented 1 year ago

Think I MIGHT have added loads of empty test documents to prod database! :dizzy_face:

Good thing we can just reset/reupload dataset right?😬

LiamSingh64 commented 1 year ago

https://firebase.google.com/docs/extensions/official/firestore-send-email We need to trigger an email to the user after a doc has been added to comply with the usecase, which this extension does exactly!

Looks like to use this however, we will need to setup our own SMTP server? I'll try to find an alternative but this looks like the prime method for sending user emails at the moment😢 image

"SendGrid" looks like it will get the job done and it's free tier limits to 100 emails/day (which is fine)

LiamSingh64 commented 1 year ago

I will set up an account with SendGrid and download the TriggerEmail extension, to hopefully implement a triggered email on document uploads for HCM data...:crossed_fingers:

LiamSingh64 commented 1 year ago
LiamSingh64 commented 1 year ago

build failing due to NavBar.vue, have a fix ready!

LiamSingh64 commented 1 year ago
LiamSingh64 commented 1 year ago

This PR:

LiamSingh64 commented 1 year ago
LiamSingh64 commented 1 year ago

Converting JS Date to/from Excel 'Date'

function JSDateToExcelDate(inDate) {
  inDate = new Date(inDate);
  var returnDateTime = 25569.0 + ((inDate.getTime() - (inDate.getTimezoneOffset() * 60 * 1000)) / (1000 * 60 * 60 * 24));
  return returnDateTime;
}
  function ExcelDateToJSDate(serial) {
   var utc_days  = Math.floor(serial - 25569);
   var utc_value = utc_days * 86400;                                        
   var date_info = new Date(utc_value * 1000);

   var fractional_day = serial - Math.floor(serial) + 0.0000001;

   var total_seconds = Math.floor(86400 * fractional_day);

   var seconds = total_seconds % 60;

   total_seconds -= seconds;

   var hours = Math.floor(total_seconds / (60 * 60));
   var minutes = Math.floor(total_seconds / 60) % 60;

   return new Date(date_info.getFullYear(), date_info.getMonth(), date_info.getDate(), hours, minutes, seconds);
}
rwx-yxu commented 1 year ago

Bulk upload and manual upload works. Only change I would suggest is to clear the forms after a successful submission. There is also a question around if we should make it okay for 0 values but probs something that our tutor can answer tbh.