Skip to content

Commit 4590fea

Browse files
committed
feat: get the parent directory of baseDirectoryPath and append outputs for ingest info
1 parent b52e1fd commit 4590fea

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

src/components/User/Dashboard/DatasetOrganizer/DropZone.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ const DropZone: React.FC<DropZoneProps> = ({
216216
/>
217217
</Paper>
218218
<TextField
219-
label="Base Directory Path (optional)"
219+
label="Directory Path (actual data path)"
220220
placeholder="example: /Users/username/Desktop/Downloads"
221221
// value={basePath} // change
222222
// onChange={(e) => setBasePath(e.target.value)} //change

src/components/User/Dashboard/DatasetOrganizer/LLMPanel.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,10 @@ const LLMPanel: React.FC<LLMPanelProps> = ({
800800

801801
const handleDownloadPackage = async () => {
802802
const zip = new JSZip();
803-
const outputDir = "bids-output";
803+
// const outputDir = "outputs";
804804

805805
// _staging/ files
806-
const ingestInfo = buildIngestInfo(baseDirectoryPath, outputDir);
806+
const ingestInfo = buildIngestInfo(baseDirectoryPath);
807807
zip.file("_staging/ingest_info.json", JSON.stringify(ingestInfo, null, 2));
808808
zip.file("_staging/BIDSPlan.yaml", bidsPlan); // your already-generated YAML
809809
zip.file(
@@ -834,7 +834,7 @@ const LLMPanel: React.FC<LLMPanelProps> = ({
834834
const url = URL.createObjectURL(blob);
835835
const a = document.createElement("a");
836836
a.href = url;
837-
a.download = "bids-output.zip";
837+
a.download = "outputs.zip";
838838
a.click();
839839
URL.revokeObjectURL(url);
840840
};
@@ -960,7 +960,7 @@ const LLMPanel: React.FC<LLMPanelProps> = ({
960960
<TextField
961961
fullWidth
962962
required
963-
label="Base Directory Path (required)"
963+
label="Directory Path (required)"
964964
value={baseDirectoryPath}
965965
onChange={(e) => setBaseDirectoryPath(e.target.value)}
966966
placeholder="Enter the folder path where these files are located"
@@ -1091,7 +1091,7 @@ const LLMPanel: React.FC<LLMPanelProps> = ({
10911091
{loading ? "Generating..." : "3a. Generate BIDSPlan.yaml"}
10921092
</Button>
10931093

1094-
<Button
1094+
{/* <Button
10951095
fullWidth
10961096
variant="contained"
10971097
startIcon={
@@ -1111,7 +1111,7 @@ const LLMPanel: React.FC<LLMPanelProps> = ({
11111111
}}
11121112
>
11131113
{loading ? "Generating..." : "3b. Generate Script"}
1114-
</Button>
1114+
</Button> */}
11151115

11161116
{/* cancel button*/}
11171117
{(generatingTrio || loading) && (

src/components/User/Dashboard/DatasetOrganizer/utils/llmHelpers.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,18 @@ export const extractSubjectsFromFiles = (
391391
};
392392

393393
export const buildIngestInfo = (
394-
baseDirectoryPath: string,
395-
outputDir: string
394+
baseDirectoryPath: string
395+
// outputDir: string
396396
): object => {
397+
// Remove trailing slash if any
398+
const cleanPath = baseDirectoryPath.replace(/\/$/, "");
399+
400+
// Get parent directory
401+
const parentDir = cleanPath.substring(0, cleanPath.lastIndexOf("/"));
402+
403+
// Append outputs: "/home/.../test3-web/outputs"
404+
const outputDir = `${parentDir}/outputs`;
405+
397406
return {
398407
step: "ingest",
399408
timestamp: new Date().toISOString(),

0 commit comments

Comments
 (0)