-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
321 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {} | ||
} | ||
autoprefixer: {}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { error, type NumericRange } from '@sveltejs/kit'; | ||
import { branding } from '$lib/configuration'; | ||
|
||
const base = branding.baseUrl; | ||
|
||
async function send({ | ||
method, | ||
path, | ||
token, | ||
data, | ||
}: { | ||
method: string; | ||
path: string; | ||
token: string; | ||
data?: any; //TODO: Change this | ||
}) { | ||
const opts: { method: string; headers: { [key: string]: string }; body?: string } = { | ||
method, | ||
headers: {}, | ||
}; | ||
|
||
if (data) { | ||
opts.headers['Content-Type'] = 'application/json'; | ||
opts.body = JSON.stringify(data); | ||
} | ||
|
||
if (token) { | ||
opts.headers['Authorization'] = `Token ${token}`; | ||
} | ||
|
||
console.debug('fetching', `${base}${path}`, opts); | ||
const res = await fetch(`${base}${path}`, opts); | ||
if (res.ok || res.status === 422) { | ||
const text = await res.text(); | ||
console.log('text', text); | ||
try { | ||
return JSON.parse(text); | ||
} catch (e) { | ||
return text; //TODO: Change this | ||
} | ||
} | ||
|
||
throw error(res.status as NumericRange<400, 599>, await res.text()); | ||
} | ||
|
||
export function get(path: string, token: string) { | ||
return send({ method: 'GET', path, token }); | ||
} | ||
|
||
export function del(path: string, token: string) { | ||
return send({ method: 'DELETE', path, token }); | ||
} | ||
|
||
export function post(path: string, token: string, data: any) { | ||
return send({ method: 'POST', path, token, data }); | ||
} | ||
|
||
export function put(path: string, token: string, data: any) { | ||
return send({ method: 'PUT', path, token, data }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,75 @@ | ||
export const branding = { | ||
baseUrl: 'https://nhanes-dev.hms.harvard.edu/', | ||
landing: { | ||
searchPlaceholder: 'Search terms or variables of interest…', | ||
description: | ||
'PIC-SURE can be used to search phenotypic variables and genomic variants, apply filters, build cohorts, and export participant-level data.', | ||
actions: [ | ||
{ | ||
description: 'Explore data, apply filters, and build cohorts', | ||
icon: 'fa-solid fa-magnifying-glass fa-5x', | ||
url: '/explorer', | ||
}, | ||
{ | ||
description: 'Manage Previously Saved Datasets', | ||
icon: 'fa-solid fa-table-list fa-5x', | ||
url: '/dataset', | ||
}, | ||
{ | ||
description: 'Explore data, apply filters, and build cohorts', | ||
icon: 'fa-solid fa-magnifying-glass fa-5x', | ||
url: '/dataset', | ||
}, | ||
{ | ||
description: 'Learn more about PIC‑SURE', | ||
icon: 'fa-solid fa-circle-question fa-5x', | ||
url: 'https://pic-sure.org/about', | ||
}, | ||
], | ||
stats: [ | ||
{ | ||
title: 'Data Sources', | ||
value: '10', | ||
valueSrc: undefined, | ||
}, | ||
{ | ||
title: 'Variables', | ||
value: '1,000,000', | ||
valueSrc: undefined, | ||
}, | ||
{ | ||
title: 'Participants with Genomic Data', | ||
value: '1,000', | ||
valueSrc: undefined, | ||
}, | ||
], | ||
}, | ||
help: { | ||
links: [ | ||
{ | ||
title: 'User Guide', | ||
description: 'Complete user manual for seamless navigation and utilization.', | ||
icon: 'fa-solid fa-book fa-5x', | ||
url: '/help/dummy?title=' + encodeURI('User Guide') | ||
url: '/help/dummy?title=' + encodeURI('User Guide'), | ||
}, | ||
{ | ||
title: 'Video Library', | ||
description: "Example 'how-to' video demonstrations.", | ||
icon: 'fa-solid fa-tv fa-5x', | ||
url: '/help/dummy?title=' + encodeURI('Video Library') | ||
url: '/help/dummy?title=' + encodeURI('Video Library'), | ||
}, | ||
{ | ||
title: 'Request Assistance', | ||
description: 'Need help? Submit a service desk ticket, we are here to help!', | ||
icon: 'fa-solid fa-hands-holding-circle fa-5x', | ||
url: '/help/dummy?title=' + encodeURI('Request Assistance') | ||
url: '/help/dummy?title=' + encodeURI('Request Assistance'), | ||
}, | ||
{ | ||
title: 'PIC-Sure Website', | ||
description: 'Check out the PIC-Sure website for information.', | ||
icon: 'fa-solid fa-circle-info fa-5x', | ||
url: '/help/dummy?title=' + encodeURI('PIC-Sure Website') | ||
} | ||
] | ||
} | ||
url: '/help/dummy?title=' + encodeURI('PIC-Sure Website'), | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface Value { | ||
title: string; | ||
value?: string; | ||
valueSrc?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.