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

enh: add dandi-asset as an additional parameter to external services #1655

Closed
wants to merge 2 commits into from

Conversation

satra
Copy link
Member

@satra satra commented Jul 15, 2023

to address passing additional info this adds a new parameter for external services.

@@ -388,7 +392,7 @@ function getExternalServices(path: AssetPath) {
.filter((service) => servicePredicate(service, path))
.map((service) => ({
name: service.name,
url: `${service.endpoint}${trimEnd((path.asset as AssetFile).url, '/')}`,
url: `${service.endpoint}${trimEnd((path.asset as AssetFile).url, '/')}&dandi-asset=${assetMetadataURI((path.asset as AssetFile).asset_id)}`,
Copy link
Member

Choose a reason for hiding this comment

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

why not just provide as a separate kwarg to be used in definition of the url to jump to in the service? i.e.

Suggested change
url: `${service.endpoint}${trimEnd((path.asset as AssetFile).url, '/')}&dandi-asset=${assetMetadataURI((path.asset as AssetFile).asset_id)}`,
url: `${service.endpoint}${trimEnd((path.asset as AssetFile).url, '/')}`,
asset_id: `${assetMetadataURI((path.asset as AssetFile).asset_id)}`,

?

Copy link
Member

Choose a reason for hiding this comment

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

AH -- I just now saw that we didn't follow the original design idea here and had only prefix for the url:

  {
    name: 'Neurosift',
    regex: /\.nwb$/,
    maxsize: Infinity,
    endpoint: 'https://flatironinstitute.github.io/neurosift?p=/nwb&url=',
  },

my bad -- we ideally would need to RF it to provide all those "format" kwargs, so here it would become

  {
    name: 'Neurosift',
    regex: /\.nwb$/,
    maxsize: Infinity,
    endpoint: 'https://flatironinstitute.github.io/neurosift?p=/nwb&url={url}&dandi-asset={asset_id}',
  },

or some other way java script allows for such embeddings...

Copy link
Member

Choose a reason for hiding this comment

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

according to chatgpt JS/vue has similar to python f-strings so we can easily do that.

const struct = { field1: "value" };
const v = `something ${struct.field1}`;

@waxlamp
Copy link
Member

waxlamp commented Dec 1, 2023

Closing this as superseded by #1706 and its followups.

@waxlamp waxlamp closed this Dec 1, 2023
@waxlamp waxlamp deleted the enh/add-dandiasset-externalservice branch December 1, 2023 22:59
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