Open valduze opened 4 years ago
On positive case phone, you go to upload, press next, press next on step 1, then enter your pin code, this will fire upload of records from the phone and uploadDataProcess will be execute on firebase.
I made it work, but as far as I understood from the source code there are 2 issues here:
Tokens have to be previously created in the collection "codes" of the database . Nothing about this is explained in the Readme file.
The processUploadedData function is not implemented in the code. const processUploadedData = async (object: ObjectMetadata) => { throw new functions.https.HttpsError('unimplemented', 'Not implemented yet'); }; What does this function do?
1 => yes there is opened issue about this https://github.com/opentrace-community/opentrace-cloud-functions/issues/9 2 => yes you need to implement that one with the wanted behaviour, but it's already fired after an history upload.
On positive case phone, you go to upload, press next, press next on step 1, then enter your pin code, this will fire upload of records from the phone and uploadDataProcess will be execute on firebase.
How can I get/generate the pin?
Please see https://github.com/opentrace-community/opentrace-cloud-functions/issues/9#issuecomment-614786773 for the upload code generation.
Logic for processUploadedData
is not included yet. For now you can use this to read the file content and parse it:
const fileContentBuffer = admin.storage().bucket(object.bucket).download();
const {token, records, events} = JSON.parse(fileContentBuffer.toString());
// validate upload token
const {uid, uploadCode} = await validateToken(token, validateTokenTimestamp); // validateToken from getUploadToken.ts
// decrypt TempIDs in records
// ...
// store/share validated records
// ...
Please see #9 (comment) for the upload code generation.
Logic for
processUploadedData
is not included yet. For now you can use this to read the file content and parse it:
const fileContentBuffer = admin.storage().bucket(object.bucket).download();
const {token, records, events} = JSON.parse(fileContentBuffer.toString());
// validate upload token
const {uid, uploadCode} = await validateToken(token, validateTokenTimestamp); // validateToken from getUploadToken.ts
// decrypt TempIDs in records
// ...
// store/share validated records
// ...
Hi @qtangs
On const fileContentBuffer = admin.storage().bucket(object.bucket).download();
, it gives out an error Property 'download' does not exist on type 'Bucket'
. Is this implemented inside the processUploadedData function?
Need help on this.
Please see #9 (comment) for the upload code generation. Logic for
processUploadedData
is not included yet. For now you can use this to read the file content and parse it:
const fileContentBuffer = admin.storage().bucket(object.bucket).download();
const {token, records, events} = JSON.parse(fileContentBuffer.toString());
// validate upload token
const {uid, uploadCode} = await validateToken(token, validateTokenTimestamp); // validateToken from getUploadToken.ts
// decrypt TempIDs in records
// ...
// store/share validated records
// ...
Hi @qtangs On
const fileContentBuffer = admin.storage().bucket(object.bucket).download();
, it gives out an errorProperty 'download' does not exist on type 'Bucket'
. Is this implemented inside the processUploadedData function? Need help on this.
+1
We have shared a reference implementation for processUploadedData
, you can find the logic here:
Hi guys, I got everything working, now I would like to know, how to I simulate a active case, for example, I have installed this on two Android phones close by, so I want the other phone to act a a user who is positive and upload data.
Trigger the upload code.
Any Documentation for that. Thanks, Jongi