Skip to content

Kg explorer flat files#2233

Open
edlu77 wants to merge 19 commits intodevelopfrom
kg-explorer-flat-files
Open

Kg explorer flat files#2233
edlu77 wants to merge 19 commits intodevelopfrom
kg-explorer-flat-files

Conversation

@edlu77
Copy link
Copy Markdown
Contributor

@edlu77 edlu77 commented Apr 17, 2026

@edlu77 edlu77 requested a review from axdanbol April 17, 2026 10:30
@edlu77 edlu77 self-assigned this Apr 17, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 17, 2026

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit c07a57c

Command Status Duration Result
nx affected --targets=lint,test,compodoc --conf... ❌ Failed 1m 54s View ↗
nx affected --target=build,build-webcomponent,b... ✅ Succeeded 4m 20s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-29 23:20:17 UTC

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

🚀 Preview Deploy Report

✅ Successfully deployed preview here


this.digitalObjects = toSignal(this.kg.digitalObjects(), { initialValue: {} });
private setPageTitle() {
this.http.get('https://cdn.humanatlas.io/digital-objects/kg/digital-objects.jsonld').subscribe((data) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You will definitely have to refactor everywhere you directly reference https://cdn.humanatlas.io/digital-objects/ . This will be customized as an input to the app and can be changed based on the mirror it's deployed to.

@edlu77 edlu77 marked this pull request as ready for review April 21, 2026 19:29
Comment thread apps/kg-explorer/src/app/app.routes.ts Outdated
ontologyTree: ontologyResolver(),
cellTypeTree: cellTypeResolver(),
biomarkerTree: biomarkersResolver(),
data: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Refactor these functions into a helper (utils/kg-resolver.ts) instead of repeating the same logic over and over

searchTerm: null,
};

export function withFilters() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This store feature should be split into 2. The first should handle the data itself, i.e. data, allRows, versionCounts. The second should be this feature and should only handle the filtering. This is the same structure we used for the cns website's current-team and research pages.

Comment thread apps/kg-explorer/src/app/utils/utils.ts Outdated
return processedValue.charAt(0).toUpperCase() + processedValue.slice(1);
}

export function handleValue(value: string | string[] | undefined): string[] | undefined {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename this to something more descriptive like castArray or coerceArray

providedIn: 'root',
})
export class SearchService {
doSearch(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just call it search

},
): Observable<string[]> {
const { organs, versions, ontologyTerms, cellTypeTerms, biomarkerTerms, searchTerm, digitalObjects } = options;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The current implementation creates a lot of intermediate arrays and iterates over the values multiple times. I would restructure something like:

search() {
  const filters = [
    this.createDigitalObjectFilter(digitalObjects),
    this.createVersionFilter(versions)
    // ...
  ];
  const result = rows.filter((item) => filters.every(fn => fn(item)));
  const ids = result.map(item => item.purl)
  return of(ids);
}

private createDigitalObjectFilter(options): (item: ItemType) => boolean {
  // Set#has is more efficient than Array#includes when there are a lot of options
  const ids = new Set(options);
  return (item) => ids.has(row.doType)
}

// Add the same for other filters

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use effect rather that observables

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use effect rather than observables

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Put all this logic in a private helper method

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Put all this logic into one or more private helper methods


effect(() => {
this.attachDownloadOptions();
this.digitalObjectSearch().subscribe((results) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should not subscribe inside of effect. Use rxResource instead

export const environment = {
production: true,
remoteApiEndpoint: 'https://apps.humanatlas.io/api--staging',
mirrorUrl: 'https://cdn.humanatlas.io/hra-kg--staging',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Staging will soon have the same flat file system, so you will want to revert that once it's up (probably friday morning).

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

Successfully merging this pull request may close these issues.

3 participants