-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from AI4Bharat/develop
Develop
- Loading branch information
Showing
149 changed files
with
13,307 additions
and
1,009 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetsByType = createAsyncThunk( | ||
'getDatasetsByType/fetchDatasetsByType', | ||
async (datasetType, { dispatch }) => { | ||
const params = fetchParams(`${ENDPOINTS.getDatasets}instances/?dataset_type=${datasetType}`,"POST"); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const getDatasetsByType = createSlice({ | ||
name: 'getDatasetsByType', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetsByType.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetsByType.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetsByType.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default getDatasetsByType.reducer; |
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,40 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetSearchPopup = createAsyncThunk( | ||
'DatasetSearchPopup/fetchDatasetSearchPopup', | ||
async (taskObj, { dispatch }) => { | ||
const body ={taskObj} | ||
const params = fetchParams(`${ENDPOINTS.getDatasets}dataitems/get_data_items/`,"POST",body); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const DatasetSearchPopup = createSlice({ | ||
name: 'DatasetSearchPopup', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetSearchPopup.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetSearchPopup.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetSearchPopup.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default DatasetSearchPopup.reducer; |
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,46 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDataitemsById = createAsyncThunk( | ||
'GetDataitemsById/fetchDataitemsById', | ||
async (instanceIds, datasetType,selectedFilters,pageNo, countPerPage, { dispatch }) => { | ||
const body ={ | ||
instance_ids: instanceIds, | ||
dataset_type: datasetType, | ||
search_keys:selectedFilters | ||
} | ||
const queryString = `?${pageNo ? "&page="+pageNo : ""}${countPerPage ?"&records="+countPerPage : ""}` | ||
|
||
const params = fetchParams(`${ENDPOINTS.getDatasets}dataitems/get_data_items/${queryString}`,"POST",body); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const GetDataitemsById = createSlice({ | ||
name: 'GetDataitemsById', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDataitemsById.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDataitemsById.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDataitemsById.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default GetDataitemsById.reducer; |
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,52 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetDetailedReports = createAsyncThunk( | ||
'GetDatasetDetailedReports/fetchDatasetDetailedReports', | ||
async (dataId, projectType, userId, statistics, { dispatch }) => { | ||
const body={ | ||
dataset_id: dataId, | ||
user_id: userId, | ||
project_type: projectType, | ||
} | ||
|
||
if(statistics === 1){ | ||
body.annotation_statistics = true; | ||
}else if(statistics === 2){ | ||
body["meta-info_statistics"] = true; | ||
}else if(statistics === 3){ | ||
body.complete_statistics = true; | ||
}; | ||
const params = fetchParams(`/functions/schedule_project_reports_email`,"POST",body); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const GetDatasetDetailedReports = createSlice({ | ||
name: 'GetDatasetDetailedReports', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetDetailedReports.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetDetailedReports.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetDetailedReports.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default GetDatasetDetailedReports.reducer; |
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,40 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetDownloadCSV = createAsyncThunk( | ||
'GetDatasetDownloadCSV/fetchDatasetDownloadCSV', | ||
async (datasetId, { dispatch }) => { | ||
|
||
const params = fetchParams(`}${ENDPOINTS.getDatasets}instances/${datasetId}/download/?export_type=CSV`); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const GetDatasetDownloadCSV = createSlice({ | ||
name: 'GetDatasetDownloadCSV', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetDownloadCSV.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetDownloadCSV.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetDownloadCSV.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default GetDatasetDownloadCSV.reducer; |
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,40 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetDownloadJSON = createAsyncThunk( | ||
'GetDatasetDownloadJSON/fetchDatasetDownloadJSON', | ||
async (datasetId, { dispatch }) => { | ||
|
||
const params = fetchParams(`}${ENDPOINTS.getDatasets}instances/${datasetId}/download/?export_type=JSON`); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const GetDatasetDownloadJSON = createSlice({ | ||
name: 'GetDatasetDownloadJSON', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetDownloadJSON.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetDownloadJSON.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetDownloadJSON.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default GetDatasetDownloadJSON.reducer; |
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,40 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetDownloadTSV = createAsyncThunk( | ||
'GetDatasetDownloadTSV/fetchDatasetDownloadTSV', | ||
async (datasetId, { dispatch }) => { | ||
|
||
const params = fetchParams(`}${ENDPOINTS.getDatasets}instances/${datasetId}/download/?export_type=TSV`); | ||
return fetch(params.url, params.options) | ||
.then(response => response.TSV()) | ||
} | ||
); | ||
|
||
const GetDatasetDownloadTSV = createSlice({ | ||
name: 'GetDatasetDownloadTSV', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetDownloadTSV.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetDownloadTSV.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetDownloadTSV.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default GetDatasetDownloadTSV.reducer; |
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,40 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetLogs = createAsyncThunk( | ||
'GetDatasetLogs/fetchDatasetLogs', | ||
async (instanceId, taskName, { dispatch }) => { | ||
|
||
const params = fetchParams(`${ENDPOINTS.getDatasets}instances/${instanceId}/get_async_task_results/?task_name=${taskName}`); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const GetDatasetLogs = createSlice({ | ||
name: 'GetDatasetLogs', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetLogs.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetLogs.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetLogs.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default GetDatasetLogs.reducer; |
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,42 @@ | ||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; | ||
import fetchParams from '../../fetchParams'; | ||
import ENDPOINTS from "../../../config/apiendpoint" | ||
const initialState = { | ||
data: [], | ||
status: 'idle', | ||
error: null, | ||
}; | ||
|
||
export const fetchDatasetProjects = createAsyncThunk( | ||
'GetDatasetProjects/fetchDatasetProjects', | ||
async (datasetId, { dispatch }) => { | ||
|
||
const params = fetchParams(`${ | ||
ENDPOINTS.getDatasets | ||
}instances/${datasetId}/projects/`); | ||
return fetch(params.url, params.options) | ||
.then(response => response.json()) | ||
} | ||
); | ||
|
||
const GetDatasetProjects = createSlice({ | ||
name: 'GetDatasetProjects', | ||
initialState, | ||
reducers: {}, | ||
extraReducers: (builder) => { | ||
builder | ||
.addCase(fetchDatasetProjects.pending, (state) => { | ||
state.status = 'loading'; | ||
}) | ||
.addCase(fetchDatasetProjects.fulfilled, (state, action) => { | ||
state.status = 'succeeded'; | ||
state.data = action.payload; | ||
}) | ||
.addCase(fetchDatasetProjects.rejected, (state, action) => { | ||
state.status = 'failed'; | ||
state.error = action.error.message; | ||
}); | ||
}, | ||
}); | ||
|
||
export default GetDatasetProjects.reducer; |
Oops, something went wrong.