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

feat: add data use restriction column to HCA Data Explorer (#4136) #4294

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

jpaten
Copy link
Contributor

@jpaten jpaten commented Nov 23, 2024

Ticket

Closes #4136 .

Reviewers

@MillenniumFalconMechanic .

Changes

  • Added "Data Use Restriction" column to the Projects and Files entity on the Managed Access config
  • Added "Data Use Restriction" term facet to the Managed Access config

Notes

Note that the projects.dataUseRestriction endpoint contains only null values on the dev backend, so in order to see any values for this column it is necessary to use the prod site

@jpaten jpaten linked an issue Nov 23, 2024 that may be closed by this pull request
@github-actions github-actions bot added the canary Done by the Clever Canary team label Nov 23, 2024
@jpaten jpaten requested review from frano-m and removed request for MillenniumFalconMechanic November 26, 2024 18:44
Copy link
Contributor

@frano-m frano-m left a comment

Choose a reason for hiding this comment

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

Hi @jpaten would you mind taking a look at each comment and resolving please! Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

@jpaten I think we should revert this change and update the type in site-config/hca-dcp/cc-ma-dev/index/common/constants.ts to:

export const COLUMN: PickSome<
  Record<keyof typeof HCA_DCP_CATEGORY_KEY, ColumnConfig>,
  "ACCESSIBLE" | "DATA_USE_RESTRICTION"
> = {}

Copy link
Contributor

Choose a reason for hiding this comment

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

Change to:

export const COLUMN: PickSome<
  Record<keyof typeof HCA_DCP_CATEGORY_KEY, ColumnConfig>,
  "ACCESSIBLE" | "DATA_USE_RESTRICTION"
> = {}

// Clone columns.
const cloneColumns = [...cloneList.columns];
// Add data use restriction column.
cloneColumns.splice(2, 0, COLUMN.DATA_USE_RESTRICTION);
Copy link
Contributor

@frano-m frano-m Nov 27, 2024

Choose a reason for hiding this comment

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

The shape returned for files's project is different to projects's project response. e.g.

dataUseRestriction: [null]
  1. I believe you will need to add to AggregatedProjectResponse dataUseRestriction: (null | string)[].
  2. On line 19, remove the reference COLUMN.DATA_USE_RESTRICTION because this is projects response related. I think for now let's just insert the new config like this:
  cloneColumns.splice(2, 0, {
    componentConfig: {
      component: C.BasicCell,
      viewBuilder: V.buildAggregatedDataUseRestriction,
    } as ComponentConfig<typeof C.BasicCell>,
    header: HCA_DCP_CATEGORY_LABEL.DATA_USE_RESTRICTION,
    id: HCA_DCP_CATEGORY_KEY.DATA_USE_RESTRICTION,
    width: { max: "1fr", min: "146px" },
  });

The viewBuilder V.buildDataUseRestrictions should probably look something like this:

export const buildAggregatedDataUseRestriction = (
  filesResponse: FilesResponse
): React.ComponentProps<typeof C.BasicCell> => {
  return {
    value: processEntityArrayValue(
      filesResponse.projects,
      "dataUseRestriction"
    ),
  };
};

Confirm on the files tab that you can see in the Data Use Restriction column, data such as "NRES" or "Unspecified".

image

return getMAProjectsEntityConfig(entity);
}
if (entity.route === "files") {
return getMAFilesEntityConfig(entity);
}
return getMAProjectsEntityConfig(entity);
Copy link
Contributor

@frano-m frano-m Nov 27, 2024

Choose a reason for hiding this comment

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

I believe the default returned value, will always be projects related entity config. This means on the samples tab the column config is now projects related.

I think the default return value on line 43 should be just entity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Not sure how I missed that one

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave line 144 as is:

return processNullElements(values, label) ?? [label];

However, I think the ?? [label] is probably no longer required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that confused me - it was like this before, and I don't think it ever was required?

*/
export const buildAggregatedDataUseRestriction = (
filesResponse: FilesResponse
): React.ComponentProps<typeof C.BasicCell> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry @jpaten - I might have given you incorrect suggestion for the buildAggregatedDataUseRestriction. I wonder if we should make this an NTagCell and return all possible values from the filesResponse?

If so, update:

  • lines 192 and 194 with NTagCell in the comments.
  • line 198 with C.NTagCell
  • the return values to be an array of values.

Comment on lines 27 to 29
component: C.BasicCell,
viewBuilder: V.buildAggregatedDataUseRestriction,
} as ComponentConfig<typeof C.BasicCell>,
Copy link
Contributor

Choose a reason for hiding this comment

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

@jpaten, if we should be displaying all possible dataUseRestriction values on the filesResponse, let's change the component on lines 27 and 29 to C.NTagCell.

Copy link
Contributor

@frano-m frano-m left a comment

Choose a reason for hiding this comment

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

Sorry @jpaten I may have given you a bit of misdirection - can you confirm with @MillenniumFalconMechanic or @NoopDog as to whether we should show all possible dataUseRestriction values on the filesResponse? If so, update as per my comments. Thank you again!

@jpaten
Copy link
Contributor Author

jpaten commented Dec 3, 2024

Hi @frano-m! I've updated the Data Use Restriction cell on Files to use an NTagCell. I had one remaining question regarding the filters - I noticed they show "Unspecified" when the displayed value is blank, is that acceptable here?

Screenshot 2024-12-02 at 9 37 54 PM

@jpaten
Copy link
Contributor Author

jpaten commented Dec 3, 2024

Hi @frano-m! I've updated the Data Use Restriction cell on Files to use an NTagCell. I had one remaining question regarding the filters - I noticed they show "Unspecified" when the displayed value is blank, is that acceptable here?

Screenshot 2024-12-02 at 9 37 54 PM

Resolved!

@jpaten jpaten force-pushed the jonah/4136-data-use-restriction branch from 800945a to ca69bc7 Compare December 3, 2024 07:05
@jpaten jpaten requested a review from frano-m December 3, 2024 07:10
@NoopDog NoopDog changed the title feat: added data use restriction BasicCell column (#4136) feat: added data use restriction column (#4136) Dec 3, 2024
@NoopDog NoopDog changed the title feat: added data use restriction column (#4136) feat: add data use restriction column (#4136) Dec 3, 2024
@NoopDog NoopDog changed the title feat: add data use restriction column (#4136) feat: add data use restriction column to HCA Data Explorer (#4136) Dec 3, 2024
Copy link
Contributor

@frano-m frano-m left a comment

Choose a reason for hiding this comment

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

Perfect @jpaten! Thank you!

@frano-m frano-m merged commit 0aa7b66 into main Dec 3, 2024
4 checks passed
@frano-m frano-m deleted the jonah/4136-data-use-restriction branch December 4, 2024 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
canary Done by the Clever Canary team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HCA DX] Add data use restriction facet and column
3 participants