Skip to content

Commit

Permalink
Merge pull request #950 from AI4Bharat/develop
Browse files Browse the repository at this point in the history
Shoonya v2.6.2 Patch
  • Loading branch information
ishvindersethi22 authored Mar 7, 2024
2 parents 9ce1ac4 + d68e511 commit 9d537d2
Show file tree
Hide file tree
Showing 30 changed files with 736 additions and 464 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@ai4bharat/indic-transliterate": "^1.2.14",
"@ai4bharat/indic-transliterate": "github:AI4Bharat/indic-transliterate-js-new",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@heartexlabs/label-studio": "^1.4.0",
Expand Down
31 changes: 31 additions & 0 deletions src/IndicTransliterate/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/config/dropDownValues.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const participationType = ["FULL_TIME", "PART_TIME", "NA"];
export const participationType = ["FULL_TIME", "PART_TIME", "NA", "CONTRACT_BASIS"];
Original file line number Diff line number Diff line change
@@ -1,42 +1,88 @@
import API from "../../../api";
import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class DeallocationAnnotatorsAndReviewersAPI extends API {
constructor(projectId,radiobutton,annotatorsUser,reviewerssUser,annotationStatus,reviewStatus,superCheckUser,SuperCheckStatus,projectObj, timeout = 2000) {
super("GET", timeout, false);
this.projectObj = projectObj;
const queryString = radiobutton === "annotation" ? `unassign_tasks/?annotator_id=${annotatorsUser}&annotation_status=["${annotationStatus}"]` : radiobutton === "review"? `unassign_review_tasks/?reviewer_id=${reviewerssUser}&review_status=["${reviewStatus}"]`:`unassign_supercheck_tasks/?superchecker_id=${superCheckUser}&supercheck_status=["${SuperCheckStatus}"]`;
console.log(queryString,"queryStringqueryString")
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/${queryString}`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.deallocationAnnotatorsAndReviewers= res;
}
}

apiEndPoint() {
return this.endpoint;
}
getBody() {
return this.projectObj;
}

getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization":`JWT ${localStorage.getItem('shoonya_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.deallocationAnnotatorsAndReviewers
}

export class DeallocateTaskById extends API {
constructor(projectId, taskId, selectedUser, timeout = 2000) {
super("POST", timeout, false);
this.projectId = projectId;

this.payload = {
task_ids: Array.isArray(taskId) ? taskId.map(id => parseInt(id)) : [parseInt(taskId)],
};
const baseEndpoint = `${super.apiEndPointAuto()}/${ENDPOINTS.getProjects}${projectId}/`;

const endpointMap = {
annotation: 'unassign_tasks/',
review: `unassign_review_tasks/`,
superChecker: 'unassign_supercheck_task/',
};

const selectedUserEndpoint = endpointMap[selectedUser];

if (selectedUserEndpoint) {
this.endpoint = baseEndpoint + selectedUserEndpoint;
} else {
console.error('Invalid selectedUser:', selectedUser);
}
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.deallocateTaskById = res;
}
}
apiEndPoint() {
return this.endpoint;
}
getBody() {
return this.payload;
}
getHeaders() {
return {
"Content-Type": "application/json",
Authorization: `JWT ${localStorage.getItem("shoonya_access_token")}`,
};
}
getPayload() {
return this.deallocateTaskById;
}
}

export default class DeallocationAnnotatorsAndReviewersAPI extends API {
constructor(projectId,radiobutton,annotatorsUser,reviewerssUser,annotationStatus,reviewStatus,superCheckUser,SuperCheckStatus,projectObj, timeout = 2000) {
super("POST", timeout, false);
this.projectObj = projectObj;
const queryString = radiobutton === "annotation" ? `unassign_tasks/?annotator_id=${annotatorsUser}&annotation_status=["${annotationStatus}"]` : radiobutton === "review"? `unassign_review_tasks/?reviewer_id=${reviewerssUser}&review_status=["${reviewStatus}"]`:`unassign_supercheck_tasks/?superchecker_id=${superCheckUser}&supercheck_status=["${SuperCheckStatus}"]`;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/${queryString}`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.deallocationAnnotatorsAndReviewers= res;
}
}

apiEndPoint() {
return this.endpoint;
}
getBody() {
return this.projectObj;
}


getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization":`JWT ${localStorage.getItem('shoonya_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.deallocationAnnotatorsAndReviewers
}
}
2 changes: 1 addition & 1 deletion src/redux/actions/api/Tasks/DeAllocateSuperCheckerTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import constants from "../../../constants";
export default class DeallocateSuperCheckerTasksAPI extends API {

constructor(projectId,selectedFilters, timeout = 2000) {
super("GET", timeout, false);
super("POST", timeout, false);
this.projectId = projectId;
this.type = constants.DE_ALLOCATE_SUPERCHECKER_TASKS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/unassign_supercheck_tasks/?supercheck_status=['${selectedFilters}']`;
Expand Down
2 changes: 1 addition & 1 deletion src/redux/actions/api/Tasks/DeallocateReviewTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export default class DeallocateReviewTasksAPI extends API {

constructor(projectId,selectedFilters, timeout = 2000) {
super("GET", timeout, false);
super("POST", timeout, false);
this.projectId = projectId;
this.type = constants.DE_ALLOCATE_REVIEW_TASKS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/unassign_review_tasks/?review_status=['${selectedFilters}']`;
Expand Down
2 changes: 1 addition & 1 deletion src/redux/actions/api/Tasks/DeallocateTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

export default class DeallocateTasksAPI extends API {
constructor(projectId,selectedFilters, timeout = 2000) {
super("GET", timeout, false);
super("POST", timeout, false);
this.projectId = projectId;
this.type = constants.DE_ALLOCATE_TASKS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/unassign_tasks/?annotation_status=['${selectedFilters}']`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const SettingsButtonComponent = ({
checked={enableTransliteration}
onChange={() => {
setAnchorElSettings(null);
localStorage.setItem("userCustomTranscriptionSettings",JSON.stringify({...JSON.parse(localStorage.getItem("userCustomTranscriptionSettings")),"enableTransliteration":!enableTransliteration}))
setTransliteration(!enableTransliteration);
}}
/>
Expand All @@ -155,6 +156,7 @@ const SettingsButtonComponent = ({
checked={enableRTL_Typing}
onChange={() => {
setAnchorElSettings(null);
localStorage.setItem("userCustomTranscriptionSettings",JSON.stringify({...JSON.parse(localStorage.getItem("userCustomTranscriptionSettings")),"enableRTL_Typing":!enableRTL_Typing}))
setRTL_Typing(!enableRTL_Typing);
}}
/>
Expand Down Expand Up @@ -297,6 +299,7 @@ const SettingsButtonComponent = ({
<MenuItem
key={index}
onClick={() => {
localStorage.setItem("userCustomTranscriptionSettings",JSON.stringify({...JSON.parse(localStorage.getItem("userCustomTranscriptionSettings")),"fontSize":item.size}))
setFontSize(item.size);
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/component/Project/TaskTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const TaskTable = (props) => {
? new DeallocateTasksAPI(id, selectedFilters.annotation_status)
: new DeallocateReviewTasksAPI(id, selectedFilters.review_status);
const res = await fetch(deallocateObj.apiEndPoint(), {
method: "GET",
method: "POST",
body: JSON.stringify(deallocateObj.getBody()),
headers: deallocateObj.getHeaders().headers,
});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/component/Tabs/AdvancedOperation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -759,4 +759,4 @@ const AdvancedOperation = (props) => {
);
};

export default AdvancedOperation;
export default AdvancedOperation;
4 changes: 2 additions & 2 deletions src/ui/pages/component/Tabs/MyProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ const MyProgress = () => {
{
label: "Till Date",
range: () => ({
startDate: new Date(Date.parse(UserDetails?.date_joined, 'yyyy-MM-ddTHH:mm:ss.SSSZ')),
startDate: new Date('2021-01-01'),
endDate: new Date(),
}),
isSelected(range) {
Expand All @@ -370,7 +370,7 @@ const MyProgress = () => {
moveRangeOnFirstSelection={false}
months={2}
ranges={selectRange}
minDate={new Date(Date.parse(UserDetails?.date_joined, 'yyyy-MM-ddTHH:mm:ss.SSSZ'))}
minDate={new Date('2021-01-01')}
maxDate={new Date()}
direction="horizontal"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/component/common/DataitemsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ useEffect(() => {
align: "center",
customHeadLabelRender: customColumnHead,
customBodyRender: (value) => {
if ((key == "metadata_json" || key == "prediction_json"|| key == "ocr_prediction_json"|| key == "transcribed_json"|| key == "draft_data_json" || key == "ocr_transcribed_json") && value !== null ) {
if ((key == "metadata_json" || key == "prediction_json"|| key == "ocr_prediction_json"|| key == "transcribed_json"|| key == "draft_data_json" || key == "ocr_transcribed_json" || key == "bboxes_relation_json") && value !== null ) {
const data = JSON.stringify(value)
const metadata = data.replace(/\\/g, "");
return metadata;
Expand Down
4 changes: 4 additions & 0 deletions src/ui/pages/component/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ const Header = () => {
//const[checkClUI,setCheckClUI]=useState(null)
const [moreHorizonAnchorEl, setMoreHorizonAnchorEl] = useState(null);

if(localStorage.getItem("source") !== undefined){
localStorage.setItem("source", "shoonya-frontend");
}

const handleMoreHorizonClick = (event) => {
setMoreHorizonAnchorEl(event.currentTarget);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ const AudioTranscriptionLandingPage = () => {
const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false);
const [assignedUsers, setAssignedUsers] = useState(null);
const [autoSave, setAutoSave] = useState(true);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);
const [waveSurfer, setWaveSurfer] = useState(true);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);

// useEffect(() => {
// let intervalId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ const ReviewAudioTranscriptionLandingPage = () => {
const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false);
const [assignedUsers, setAssignedUsers] = useState(null);
const [autoSave, setAutoSave] = useState(true);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);
const [waveSurfer, setWaveSurfer] = useState(true);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);

// useEffect(() => {
// let intervalId;
Expand Down Expand Up @@ -304,11 +304,11 @@ const ReviewAudioTranscriptionLandingPage = () => {
variant: "error",
});
}else{setTaskDetailList(resp);
if (resp?.data?.audio_duration < 700){
setWaveSurfer(false);
}else{
setWaveSurfer(true);
}}
if (resp?.data?.audio_duration < 700){
setWaveSurfer(false);
}else{
setWaveSurfer(true);
}}
setLoading(false);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false);
const [assignedUsers, setAssignedUsers] = useState(null);
const [autoSave, setAutoSave] = useState(true);
const [waveSurfer, setWaveSurfer] = useState(false);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);
const [waveSurfer, setWaveSurfer] = useState(true);

// useEffect(() => {
// let intervalId;
Expand Down Expand Up @@ -1142,6 +1142,7 @@ useEffect(() => {
/>
</div>
)}

/>
) : (
<div className={classes.relative} style={{ width: "100%" }}>
Expand Down Expand Up @@ -1253,4 +1254,4 @@ useEffect(() => {
</>
);
};
export default SuperCheckerAudioTranscriptionLandingPage;
export default SuperCheckerAudioTranscriptionLandingPage;
Loading

0 comments on commit 9d537d2

Please sign in to comment.