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

Duplicate columns on Patient List export #558

Closed
olayemiibrahim opened this issue Aug 31, 2022 · 2 comments
Closed

Duplicate columns on Patient List export #558

olayemiibrahim opened this issue Aug 31, 2022 · 2 comments

Comments

@olayemiibrahim
Copy link

Hello everyone,

Is anyone else experiencing an issue with Leafs export? It looks like when we export patient information from the patient list tab all the columns are duplicated without their column headers.

Screen Shot 2022-08-31 at 2 26 17 PM

I had attempted to follow the export function in the dataExport.ts to see where the columns are being duplicated. It looks like the error would be in the getMultirowDatasetCSV function call on line 55, which leads to the patientListWebWorker.ts file. Going through the addMultiRowDataset function (assuming that is the correct one to look at) there doesn't seem to be any flaws in the logic.

Has anyone seen this issue and been able to fix it?

@ndobb
Copy link
Member

ndobb commented Sep 9, 2022

Thanks for pointing this out, @olayemiibrahim .

TLDR;

The problem is in the duplicate for loop in the WebWorkerContext.ts file. This only happens when the user is exporting a dataset with a one-to-many relationship with patients (i.e., a patient can have more than one row of data).

Background

Basically, web workers are odd. Especially when using npm and webpack compilation and so on, things get wonky. You've probably noticed that everything under /ui-client/src/providers has both a *WebWorker.ts file and a *WebWorkerContext.ts file.

The *WebWorker.ts workerContext() function is written in TypeScript, but not actually used in the app.

Why? Well, writing it in TypeScript allows us to get type checking and helpful stuff like that. However due to oddities of how the browser initializes webworkers (specifically, you just send a big blob of code as a string), basically that won't work. This causes all sorts of headaches. I've seen quite a few workarounds in the past (and maybe there are better, more recent, solutions), but to my knowledge none really do a reliable job of making this easier.

Anyway, I've never felt that the way we do this with Leaf as ideal or the best solution (clearly, given this issue and possible others, it's not), but I convert the TypeScript workerContext() function into a big string, then plop that in the *WebWorkerContext.ts file. That's what is actually run in the webworker.

If you look at the line linked above, you can see that the for loop gets unnecessarily repeated, but only in the *WebWorkerContext.ts file. It must have been a copy/paste error or something I missed.

I'll make a fix for this of course, but in the meantime, if necessary, you can just manually cut out those 4 unnecessary lines of the for loop, then recompile and redeploy. That should fix it.

@ndobb ndobb closed this as completed Apr 24, 2023
@ndobb
Copy link
Member

ndobb commented Apr 24, 2023

Fixed in 3.11.3

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

2 participants