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

Fix clinical data value casing #11281

Open
wants to merge 1 commit into
base: demo-rfc80-poc
Choose a base branch
from

Conversation

alisman
Copy link
Contributor

@alisman alisman commented Dec 13, 2024

Initial SQL was upper casing all clinical data values in order to elide casing inconsistencies. We need to respect the casing of imported data, while still grouping in a case-insensitive way

@alisman alisman changed the title Fx casing Fix clinical data casing Dec 13, 2024
@alisman alisman changed the base branch from master to demo-rfc80-poc December 13, 2024 16:52
@alisman alisman changed the title Fix clinical data casing Fix clinical data value casing Dec 13, 2024
Comment on lines 28 to +37
items.forEach(attr -> {
Map<String, List<ClinicalDataCount>> countsPerType = attr.getCounts().stream()
.collect(Collectors.groupingBy(ClinicalDataCount::getValue));
.collect(Collectors.groupingBy(a -> a.getValue().toLowerCase()));
List<ClinicalDataCount> res = countsPerType.entrySet().stream().map(entry -> {
ClinicalDataCount mergedCount = new ClinicalDataCount();
mergedCount.setAttributeId(attr.getAttributeId());
mergedCount.setValue(entry.getKey());
// we are just going to choose the value of the first item
// due to failure in data normalization in source files, we may find values
// have inconsistent casing. we choose to merge and choose an arbitrary casing
mergedCount.setValue(entry.getValue().stream().findFirst().get().getValue());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably avoid modifying this method by reusing normalizeDataCounts. So, something like this after this line might be better.

var result = studyViewRepository.getClinicalDataCounts(context, filteredAttributes);

result.forEach(item -> item.setCounts(StudyViewColumnarServiceUtil.normalizeDataCounts(item.getCounts())));

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

Successfully merging this pull request may close these issues.

2 participants