Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulate Positive case, trigger upload code #12

Open
valduze opened this issue Apr 15, 2020 · 8 comments
Open

Simulate Positive case, trigger upload code #12

valduze opened this issue Apr 15, 2020 · 8 comments

Comments

@valduze
Copy link

valduze commented Apr 15, 2020

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

@amauryVedana
Copy link

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.

@jcavieres
Copy link

I made it work, but as far as I understood from the source code there are 2 issues here:

  1. Tokens have to be previously created in the collection "codes" of the database . Nothing about this is explained in the Readme file.

  2. 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?

@amauryVedana
Copy link

1 => yes there is opened issue about this #9
2 => yes you need to implement that one with the wanted behaviour, but it's already fired after an history upload.

@egottardo
Copy link

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?

@qtangs
Copy link
Contributor

qtangs commented Apr 16, 2020

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
// ...

@redlight55
Copy link

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.

@rburhum
Copy link

rburhum commented Apr 21, 2020

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.

+1

@qtangs
Copy link
Contributor

qtangs commented May 3, 2020

We have shared a reference implementation for processUploadedData, you can find the logic here:

https://github.com/opentrace-community/opentrace-cloud-functions/blob/master/functions/src/opentrace/processUploadedData.ts#L24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants