-
Notifications
You must be signed in to change notification settings - Fork 49
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
List datasets + files from core + staging sources #700
Changes from 1 commit
a3d863f
94c100e
07c0796
d48d0e6
c547a0c
02fe52f
eed3a2d
f13a7cd
99c2c83
8cb84fe
8940561
cac3780
a00b8e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,18 +39,25 @@ class CoreSource extends Source { | |
async collectResources() { | ||
if (!this._allResources) this._allResources = new Map(); | ||
const s3objects = await parseInventory(); | ||
const datasets = new Map(); | ||
const datasets = new Map(), files = new Map(); | ||
s3objects.forEach((object) => { | ||
const [name, resourceType] = CoreCollectedResources.objectName(object); | ||
if (!name) return; | ||
if (resourceType!=='dataset') return; | ||
datasets.has(name) ? datasets.get(name).push(object) : datasets.set(name, [object]); | ||
if (resourceType === 'dataset') { | ||
datasets.has(name) ? datasets.get(name).push(object) : datasets.set(name, [object]); | ||
} else if (resourceType === 'file') { | ||
files.has(name) ? files.get(name).push(object) : files.set(name, [object]); | ||
} | ||
}) | ||
this._allResources.set( | ||
'dataset', | ||
Array.from(datasets).map(([, objects]) => new CoreCollectedResources(this, objects)) | ||
); | ||
// TODO XXX narratives + files (etc) | ||
this._allResources.set( | ||
'file', | ||
Array.from(files).map(([, objects]) => new CoreCollectedResources(this, objects)) | ||
); | ||
// TODO XXX narratives | ||
} | ||
|
||
// DEPRECATED availableDatasets is used by /charon/getAvailable and will be replaced once we move to a new API | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is slightly confusing to me, but maybe I don't understand your intent. Do you expect/intend Auspice to start using /charon/getAvailable/v2? |
||
|
@@ -180,11 +187,17 @@ class CoreCollectedResources extends CollectedResources { | |
} | ||
|
||
nextstrainUrl(version=this._versions[0]) { | ||
if (this._resourceType!=='dataset') return false; | ||
// if the version is not the latest (in S3 terminology), then we don't yet have the | ||
// ability to access it via Auspice. Or perhaps we do via /fetch? TODO | ||
if (version.IsLatest!=="true") return false; | ||
return version.Key.replace('.json', '').replace(/_/g, '/') | ||
if (this._resourceType === 'file') { | ||
if (version.IsLatest!=="true") return false; | ||
return `https://nextstrain-data.s3.amazonaws.com/${version.Key}` | ||
} | ||
if (this._resourceType === 'dataset') { | ||
if (version.IsLatest!=="true") return false; | ||
// if the version is not the latest (in S3 terminology), then we don't yet have the | ||
// ability to access it via Auspice. Or perhaps we do via /fetch? TODO | ||
return version.Key.replace('.json', '').replace(/_/g, '/') | ||
} | ||
return false; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,10 @@ exports.createPages = ({graphql, actions}) => { | |
path: "/pathogens", | ||
component: path.resolve("src/sections/pathogens.jsx") | ||
}); | ||
createPage({ | ||
path: "/pathogens/inputs", | ||
component: path.resolve("src/sections/remote-inputs.jsx") | ||
}); | ||
Comment on lines
+258
to
+261
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The stuff under |
||
|
||
/* NOTE: we are using "influenza" URLs for dev purposes only. This will be switched to "flu" | ||
when this functionality is released & publicized. For unknown reasons, if the component is named | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from "react"; | ||
import {Link} from 'gatsby'; | ||
import {SmallSpacer,HugeSpacer,FlexCenter} from "../layouts/generalComponents"; | ||
import * as splashStyles from "../components/splash/styles"; | ||
import GenericPage from "../layouts/generic-page"; | ||
import CardsV2 from "../components/CardsV2/index"; | ||
|
||
const title = "Nextstrain-maintained pathogen analyses"; | ||
const abstract = ( | ||
<> | ||
This page lists Nextstrain's publicly available intermediate files. | ||
Most of these files are used to generate phylogenetic analyses shown on{` `} | ||
<Link to="/">the (core) pathogens page</Link> | ||
. | ||
</> | ||
); | ||
|
||
class Index extends React.Component { | ||
render() { | ||
console.log('<Pathogens>') | ||
return ( | ||
<GenericPage location={this.props.location}> | ||
<splashStyles.H1>{title}</splashStyles.H1> | ||
<SmallSpacer /> | ||
|
||
<FlexCenter> | ||
<splashStyles.CenteredFocusParagraph> | ||
{abstract} | ||
</splashStyles.CenteredFocusParagraph> | ||
</FlexCenter> | ||
|
||
<HugeSpacer /> | ||
<CardsV2 apiQuery={'prefix=/&versions&type=file'} dataType='file'/> | ||
<HugeSpacer /> | ||
</GenericPage> | ||
); | ||
} | ||
} | ||
|
||
|
||
export default Index; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an inherent linking between (some) datasets and (some) intermediate files. It would be nice to surface this - e.g. when looking at the card for zika you could see the available intermediate files as well. I ummed and ahhed about trying to build this into this version but ultimately left it as a future todo. Beyond the obvious "how do we programmatically know which datasets are connected to which files", the desired UI needs to be worked out before we know how best to approach it. Note that such a linking is cross-source, so if it's done ahead of time on the server, we'll have to perform a per-linked-resource authz filtering (e.g. the intermediate files for a dataset might be stored in a source you don't have permission to view).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this belies a misunderstanding here: that the Source classes are about everything in e.g. a bucket or a GitHub repo. They're very much not. They're just about the datasets and narratives (the Resource classes). I don't think we should be thinking about the intermediates we're trying to expose here thru the lens of our Source classes.