Skip to content

Commit

Permalink
Merge pull request #315 from NCIEVS/pva/browser-CDISC-feedback
Browse files Browse the repository at this point in the history
Pva/browser cdisc feedback
  • Loading branch information
peter-va authored Nov 27, 2024
2 parents 7bd5955 + 3fcebed commit 3acaeae
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
# Checkout the pull request code
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# Set up Java 17 for the environment
- name: Set up JDK 17
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
# Checkout the pull request code
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install Trivy if not cached
- name: Install Trivy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@
<span *ngIf="prop.type == 'Extensible_List'">{{ prop.value }}</span>
</span>
</td>
<td class="w-20">{{ titleDesc }}</td>
<td class="w-20">{{ subsetFormat === 'CDISC' ? getCdiscSynonym() : titleDesc }}</td>
<td class="w-10">{{ getCdiscSubmissionValue(value) }}</td>
<td class="w-20">
<span *ngFor="let syn of value.getSynonymNames('CDISC', 'SY'); last as isLast">
<span *ngFor="let syn of value.getSynonymNames(cdiscSubsetSource, 'SY'); last as isLast">
<span
>{{ syn }} <span *ngIf="!isLast"><br /></span>
</span>
Expand All @@ -248,7 +248,7 @@

<td class="w-20">
<span *ngFor="let def of value.definitions; last as isLast">
<span *ngIf="def.source == subsetFormat"> {{ def.definition }} </span>
<span *ngIf="def.source == cdiscSubsetSource"> {{ def.definition }} </span>
</span>
</td>
<td class="w-20">{{ value.name }}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class SubsetDetailsComponent implements OnInit {
subsetLink: string;
subsetDescription: any;
terminology: string;
cdiscSubsetSource: string;

currentSortColumn = 'code';
currentSortDirection = false;
Expand Down Expand Up @@ -103,16 +104,23 @@ export class SubsetDetailsComponent implements OnInit {
this.subsetFormat = 'CTRP';
}
// CHECK FOR CDISC
else if (ContSource[0].value === 'CDISC') {
else if (ContSource[0].value.startsWith('CDISC') || ContSource[0].value.startsWith('MRCT-Ctr')) {
this.subsetFormat = 'CDISC';
this.cdiscSubsetSource = ContSource[0].value;
if (!this.titleDesc) {
this.titleDesc = this.getSynonymNames(this.selectedSubset, 'CDISC', 'PT')[0];
}
} else {
this.subsetFormat = ContSource[0].value;
}
} else {
this.subsetFormat = 'NCIt';

if (ContSource.some(entry => entry.value.startsWith('CDISC') || entry.value.startsWith('MRCT-Ctr'))) {
this.subsetFormat = 'CDISC';
this.cdiscSubsetSource = ContSource[0].value;
} else {
this.subsetFormat = 'NCIt';
}
}
this.subsetLink = this.selectedSubset.getSubsetLink();

Expand Down Expand Up @@ -264,6 +272,9 @@ export class SubsetDetailsComponent implements OnInit {
const pages = Math.ceil(Math.min(exportMax, this.hitsFound) / exportPageSize);
const pageList = Array.from(Array(pages).keys());

if(this.subsetFormat === "CDISC") {
subsetText += this.exportCodeFormatter(this.selectedSubset, true);
}
for (const page of pageList) {
await this.subsetDetailService
.getSubsetExport(this.titleCode, page * exportPageSize, exportPageSize, term)
Expand All @@ -285,7 +296,7 @@ export class SubsetDetailsComponent implements OnInit {
}

// format the export file
exportCodeFormatter(concept: Concept) {
exportCodeFormatter(concept: Concept, firstCDISC = false) {
let rowText = '';
if (this.subsetFormat === 'NCIt') {
rowText += concept.code + '\t';
Expand Down Expand Up @@ -313,19 +324,22 @@ export class SubsetDetailsComponent implements OnInit {
// cdisc code
rowText += concept.code + '\t';
// codelist code
rowText += this.titleCode + '\t';
if(firstCDISC) {
rowText += '\t';
} else {
rowText += this.titleCode + '\t';
}
// codelist extensible
const extensible = concept.properties.filter((prop) => prop.type == 'Extensible_List')[0]?.value;
rowText += (extensible ? extensible : '') + '\t';
// codelist name
rowText += this.titleDesc + '\t';

rowText += this.getCdiscSynonym() + '\t';
// cdisc submission value
rowText += concept.synonyms.filter((sy) => sy.source == 'CDISC' && sy.termType == 'PT')[0]?.name + '\t';
rowText += this.getCdiscSubmissionValue(concept) + '\t';
// cdisc synonyms
rowText += '"' + this.getSynonymNames(concept, 'CDISC', 'SY').join('\n') + '"' + '\t';
// cdisc definition
rowText += concept.definitions.filter((def) => def.source == 'CDISC')[0]?.definition + '\t';
rowText += concept.definitions.filter((def) => def.source.startsWith('CDISC') || def.source.startsWith("MRCT-Ctr"))[0]?.definition + '\t';
// NCIt pref term
rowText += concept.name;
} else {
Expand Down Expand Up @@ -402,7 +416,7 @@ export class SubsetDetailsComponent implements OnInit {
// Uses this.submissionValueCode to determine the submission value column for CDISC display
getCdiscSubmissionValue(concept: Concept): string {
// If a single CDISC/PT, return it
const matchingSynonyms = concept.synonyms.filter((sy) => sy.source === 'CDISC' && sy.termType === 'PT');
const matchingSynonyms = concept.synonyms.filter((sy) => sy.source === this.cdiscSubsetSource && sy.termType === 'PT');
if (matchingSynonyms.length===1) {
return matchingSynonyms[0].name;
}
Expand All @@ -424,4 +438,15 @@ export class SubsetDetailsComponent implements OnInit {
const desc = this.selectedSubset.properties.find((item) => item.type === "Term_Browser_Value_Set_Description");
return (this.selectedSubset.subsetLink !== undefined && desc !== undefined && !desc.value.includes(this.selectedSubset.subsetLink));
}

getCdiscSynonym() {
if (this.selectedSubset?.synonyms && this.cdiscSubsetSource) {
const synonym = this.selectedSubset.synonyms.find(syn => syn.source === this.cdiscSubsetSource && syn.termType === "SY");
if(synonym?.name)
return synonym?.name;
}
// use NCI PT if CDISC SY isn't there
return this.selectedSubset.synonyms.find(syn => syn.source === "NCI" && syn.termType === "PT").name;
}

}

0 comments on commit 3acaeae

Please sign in to comment.