Skip to content

Removal of GraphQL Data Return Schema #57

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

Merged
merged 41 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
55ebad8
projectByProjectId
LennartSchmidtKern Jan 6, 2025
859fe12
allProjects
LennartSchmidtKern Jan 6, 2025
ff49ea0
allProjects
LennartSchmidtKern Jan 6, 2025
d2f486a
labelDistribution, generalProjectStats
LennartSchmidtKern Jan 6, 2025
918a2db
projectTokenization
LennartSchmidtKern Jan 6, 2025
4e82546
projectTokenization
LennartSchmidtKern Jan 6, 2025
37ac11b
modelProviderInfo
LennartSchmidtKern Jan 6, 2025
9e2c748
projectExportCredentials, uploadCredentialsAndId
LennartSchmidtKern Jan 6, 2025
7ed8696
createSampleProject, updateProjectStatus, updateProjectTokenizer
LennartSchmidtKern Jan 6, 2025
d21502d
createProject, deleteProject
LennartSchmidtKern Jan 6, 2025
6540291
uploadTaskById, updateProjectNameDescription
LennartSchmidtKern Jan 6, 2025
283529c
attributes,embeddings, data slide
LennartSchmidtKern Jan 7, 2025
0d8e10b
lt query rework
JWittmeyer Jan 7, 2025
f38b4de
comment, data browser, heuristic
LennartSchmidtKern Jan 7, 2025
0a1b10b
Merge branch 'graphql-data-removal' of github.com:code-kern-ai/refine…
LennartSchmidtKern Jan 7, 2025
bd58769
settings
LennartSchmidtKern Jan 7, 2025
d12ce29
labeling, lookup
LennartSchmidtKern Jan 7, 2025
76ffa04
fixes, clean up
LennartSchmidtKern Jan 7, 2025
889ca59
fix stats load
LennartSchmidtKern Jan 7, 2025
b010a3d
notifications, record, settings
LennartSchmidtKern Jan 7, 2025
502abd4
fixing small stuff
LennartSchmidtKern Jan 7, 2025
23d6e14
Org queries first part
JWittmeyer Jan 7, 2025
19ccd62
More org endpoints
JWittmeyer Jan 8, 2025
f46de7f
More org endpoints
JWittmeyer Jan 8, 2025
2c3740b
stats fix
LennartSchmidtKern Jan 8, 2025
2569101
Adjust response consumption for syncEditedRecords
anmarhindi Jan 9, 2025
ff4f4ae
Merge remote-tracking branch 'origin/graphql-data-removal' into graph…
anmarhindi Jan 9, 2025
f62d8e4
perf: eliminate payload transform in overview-stats
andhreljaKern Jan 9, 2025
82f169c
Merge remote-tracking branch 'origin/graphql-data-removal' into graph…
anmarhindi Jan 9, 2025
cb64bd4
fix: prepareRecordExport handle
anmarhindi Jan 9, 2025
9c9633d
remove unused
LennartSchmidtKern Jan 9, 2025
9fcf96b
Merge branch 'graphql-data-removal' of github.com:code-kern-ai/refine…
LennartSchmidtKern Jan 9, 2025
ee710ef
fix ok
LennartSchmidtKern Jan 9, 2025
b03d3bc
Remove API button
anmarhindi Jan 9, 2025
e595aa3
Merge remote-tracking branch 'origin/graphql-data-removal' into graph…
anmarhindi Jan 9, 2025
2608838
Change condition
anmarhindi Jan 13, 2025
11989c4
Fix: file size estimate
anmarhindi Jan 13, 2025
c99d5f9
PR
LennartSchmidtKern Jan 13, 2025
a4cc1b6
embed
LennartSchmidtKern Jan 13, 2025
c4903e7
fix labeling bug
LennartSchmidtKern Jan 13, 2025
ad2e54f
javascript
LennartSchmidtKern Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/models-download/ModelsDownload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function ModelsDownload() {

function refetchModels() {
getModelProviderInfo((res) => {
dispatch(setModelsDownloaded(res.data['modelProviderInfo']));
dispatch(setModelsDownloaded(res));
});
}

Expand Down
15 changes: 3 additions & 12 deletions src/components/projects/ProjectsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,15 @@ export default function ProjectsList() {

function refetchProjectsAndPostProcess() {
getAllProjects((res) => {
const projects = res.data["allProjects"].edges.map((edge: any) => edge.node);
dispatch(setAllProjects(projects));
dispatch(setAllProjects(res));
setDataLoaded(true);
});
}

function refetchStatsAndPostProcess() {
getOverviewStats((res) => {
const stats = res.data["overviewStats"];
const statsDict = {};
if (stats == null) return;
stats.forEach((stat: ProjectStatistics) => {
const statCopy = { ...stat };
stat.manuallyLabeled = percentRoundString(statCopy.numDataScaleManual / statCopy.numDataScaleUploaded, 2);
stat.weaklySupervised = percentRoundString(statCopy.numDataScaleProgrammatical / statCopy.numDataScaleUploaded, 2);
statsDict[stat.projectId] = stat;
});
setProjectStatisticsById(statsDict);
if (res == null) return;
setProjectStatisticsById(res);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/projects/SampleProjectsDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function SampleProjectsDropdown() {
dispatch(setSearchGroupsStore({}));
createSampleProject({ name: projectNameFinal, projectType: projectTypeFinal }, (res) => {
dispatch(closeModal(ModalEnum.SAMPLE_PROJECT_TITLE));
const projectId = res['data']['createSampleProject']['project'].id;
const projectId = res['project'].id;
dispatch(setProjectIdSampleProject(projectId));
});
}, [projects, projectNameInput, projectTypeInput, router]);
Expand Down
3 changes: 1 addition & 2 deletions src/components/projects/new/NewProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default function NewProject() {
useEffect(() => {
dispatch(setUploadFileType(COMPONENT_FILE_TYPE));
getAllProjects((res) => {
const projects = res.data["allProjects"].edges.map((edge: any) => edge.node);
dispatch(setAllProjects(projects));
dispatch(setAllProjects(res));
});
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { CommentType } from "@/src/types/shared/comments";
import { AttributeCodeLookup } from "@/src/util/classes/attribute-calculation";
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper";
import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper";
import { getAllComments } from "@/src/services/base/comment";
import { getAttributes } from "@/src/services/base/attribute";
import { getLookupListsByProjectId } from "@/src/services/base/lookup-lists";
Expand Down Expand Up @@ -65,15 +65,15 @@ export default function AttributeCalculation() {
if (!projectId) return;
if (!currentAttribute || attributes.length == 0) {
getAttributes(projectId, ['ALL'], (res) => {
dispatch(setAllAttributes(res.data['attributesByProjectId']));
dispatch(setAllAttributes(res));
const currentAttribute = postProcessCurrentAttribute(attributes.find((attribute) => attribute.id === router.query.attributeId));
setCurrentAttribute(currentAttribute);
setEditorValue(currentAttribute?.sourceCodeToDisplay);
});
}
if (lookupLists.length == 0) {
getLookupListsByProjectId(projectId, (res) => {
dispatch(setAllLookupLists(res.data['knowledgeBasesByProjectId']));
dispatch(setAllLookupLists(res));
});
}
refetchLabelingTasksAndProcess();
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function AttributeCalculation() {
CommentDataManager.registerCommentRequests(CurrentPage.ATTRIBUTE_CALCULATION, requests);
const requestJsonString = CommentDataManager.buildRequestJSON();
getAllComments(requestJsonString, (res) => {
CommentDataManager.parseCommentData(res.data['getAllComments']);
CommentDataManager.parseCommentData(res);
CommentDataManager.parseToCurrentData(allUsers);
dispatch(setComments(CommentDataManager.currentDataOrder));
});
Expand Down Expand Up @@ -221,14 +221,13 @@ export default function AttributeCalculation() {

function checkProjectTokenization() {
getProjectTokenization(projectId, (res) => {
setTokenizationProgress(res.data['projectTokenization']?.progress);
setTokenizationProgress(res?.progress);
});
}

function refetchLabelingTasksAndProcess() {
getLabelingTasksByProjectId(projectId, (res) => {
const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']);
dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks)));
dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res)));
});
}

Expand All @@ -243,11 +242,11 @@ export default function AttributeCalculation() {
setCurrentAttribute(currentAttributeCopy);
} else {
getAttributes(projectId, ['ALL'], (res) => {
dispatch(setAllAttributes(res.data['attributesByProjectId']));
dispatch(setAllAttributes(res));
});
getAttributeByAttributeId(projectId, currentAttribute?.id, (res) => {
const attribute = res.data['attributeByAttributeId'];
if (attribute == null) setCurrentAttribute(null);
if (msgParts[2] == 'deleted') return
getAttributeByAttributeId(projectId, currentAttribute?.id, (attribute) => {
if (!attribute) setCurrentAttribute(null);
else setCurrentAttribute(postProcessCurrentAttribute(attribute));
});
if (msgParts[2] == "finished") {
Expand All @@ -256,7 +255,7 @@ export default function AttributeCalculation() {
}
} else if (['knowledge_base_updated', 'knowledge_base_deleted', 'knowledge_base_created'].includes(msgParts[1])) {
getLookupListsByProjectId(projectId, (res) => {
dispatch(setAllLookupLists(res.data['knowledgeBasesByProjectId']));
dispatch(setAllLookupLists(res));
});
} else if (msgParts[1] == 'tokenization' && msgParts[2] == 'docbin') {
if (msgParts[3] == 'progress') {
Expand Down Expand Up @@ -388,8 +387,7 @@ export default function AttributeCalculation() {
<ExecutionContainer currentAttribute={currentAttribute} tokenizationProgress={tokenizationProgress} enableRunButton={enableRunButton} checkUnsavedChanges={checkUnsavedChanges}
setEnabledButton={(value: boolean) => setEnableButton(value)}
refetchCurrentAttribute={() => {
getAttributeByAttributeId(projectId, currentAttribute?.id, (res) => {
const attribute = res.data['attributeByAttributeId'];
getAttributeByAttributeId(projectId, currentAttribute?.id, (attribute) => {
if (attribute == null) setCurrentAttribute(null);
else setCurrentAttribute(postProcessCurrentAttribute(attribute));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function ExecutionContainer(props: ExecutionContainerProps) {
if (requestedSomething) return;
setRequestedSomething(true);
getSampleRecords(projectId, props.currentAttribute.id, (res) => {
const sampleRecordsFinal = { ...res.data['calculateUserAttributeSampleRecords'] };
const sampleRecordsFinal = { ...res };
setRequestedSomething(false);
props.setEnabledButton(false);
setRunOn10HasError(sampleRecordsFinal.calculatedAttributes.length > 0 ? false : true);
Expand All @@ -53,7 +53,7 @@ export default function ExecutionContainer(props: ExecutionContainerProps) {

function recordByRecordId(recordId: string) {
getRecordByRecordId(projectId, recordId, (res) => {
dispatch(setModalStates(ModalEnum.VIEW_RECORD_DETAILS, { record: postProcessRecordByRecordId(res.data['recordByRecordId']) }));
dispatch(setModalStates(ModalEnum.VIEW_RECORD_DETAILS, { record: postProcessRecordByRecordId(res) }));
});
}

Expand Down
23 changes: 11 additions & 12 deletions src/components/projects/projectId/data-browser/DataBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useCallback, useEffect, useState } from "react";
import { expandRecordList, selectActiveSearchParams, selectActiveSlice, selectConfiguration, selectFullSearchStore, selectRecords, setActiveDataSlice, setDataSlices, setRecordComments, setUniqueValuesDict, updateAdditionalDataState } from "@/src/reduxStore/states/pages/data-browser";
import { postProcessRecordsExtended, postProcessUniqueValues } from "@/src/util/components/projects/projectId/data-browser/data-browser-helper";
import { selectAttributes, selectLabelingTasksAll, setAllAttributes, setAllEmbeddings, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings";
import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper";
import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper";
import { selectAllUsers, selectOrganizationId, selectUser, setComments } from "@/src/reduxStore/states/general";
import DataBrowserRecords from "./DataBrowserRecords";
import { postProcessingEmbeddings } from "@/src/util/components/projects/projectId/settings/embeddings-helper";
Expand Down Expand Up @@ -64,12 +64,12 @@ export default function DataBrowser() {
getRecordsByStaticSlice(projectId, activeSlice.id, {
offset: searchRequest.offset, limit: searchRequest.limit
}, (res) => {
dispatch(expandRecordList(postProcessRecordsExtended(res.data['recordsByStaticSlice'], labelingTasks)));
dispatch(expandRecordList(postProcessRecordsExtended(res, labelingTasks)));
});
} else {
const filterData = parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, fullSearchStore[SearchGroup.DRILL_DOWN])
searchRecordsExtended(projectId, filterData, searchRequest.offset, searchRequest.limit, (res) => {
const parsedRecordData = postProcessRecordsExtended(res.data['searchRecordsExtended'], labelingTasks);
const parsedRecordData = postProcessRecordsExtended(res, labelingTasks);
dispatch(expandRecordList(parsedRecordData));
refetchRecordCommentsAndProcess(parsedRecordData.recordList);
});
Expand All @@ -93,38 +93,37 @@ export default function DataBrowser() {
CommentDataManager.registerCommentRequests(CurrentPage.DATA_BROWSER, requests);
const requestJsonString = CommentDataManager.buildRequestJSON();
getAllComments(requestJsonString, (res) => {
CommentDataManager.parseCommentData(res.data['getAllComments']);
CommentDataManager.parseCommentData(res);
CommentDataManager.parseToCurrentData(users);
dispatch(setComments(CommentDataManager.currentDataOrder));
});
}

function refetchDataSlicesAndProcess(dataSliceId?: string) {
getDataSlices(projectId, null, (res) => {
dispatch(setDataSlices(res.data.dataSlices));
dispatch(setDataSlices(res));
if (dataSliceId) {
const findSlice = res.data.dataSlices.find((slice) => slice.id == dataSliceId);
const findSlice = res.find((slice) => slice.id == dataSliceId);
if (findSlice) dispatch(setActiveDataSlice(findSlice));
}
});
}

function refetchAttributesAndProcess() {
getAttributes(projectId, ['ALL'], (res) => {
dispatch(setAllAttributes(res.data['attributesByProjectId']));
dispatch(setAllAttributes(res));
});
}

function refetchLabelingTasksAndProcess() {
getLabelingTasksByProjectId(projectId, (res) => {
const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']);
dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks)));
dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res)));
});
}

function refetchEmbeddingsAndPostProcess() {
getEmbeddings(projectId, (res) => {
const embeddings = postProcessingEmbeddings(res.data['projectByProjectId']['embeddings']['edges'].map((e) => e['node']), []);
const embeddings = postProcessingEmbeddings(res['embeddings'], []);
dispatch(setAllEmbeddings(embeddings));
});
}
Expand All @@ -133,7 +132,7 @@ export default function DataBrowser() {
const currentRecordIds = parsedRecordData?.map((record) => record.id);
if (!currentRecordIds || currentRecordIds.length == 0) return;
getRecordComments(projectId, currentRecordIds, (res) => {
dispatch(setRecordComments(res.data['getRecordComments']));
dispatch(setRecordComments(res));
});
}

Expand All @@ -143,7 +142,7 @@ export default function DataBrowser() {

function refetchUniqueValuesAndProcess() {
getUniqueValuesByAttributes(projectId, (res) => {
dispatch(setUniqueValuesDict(postProcessUniqueValues(res.data['uniqueValuesByAttributes'], attributes)));
dispatch(setUniqueValuesDict(postProcessUniqueValues(res, attributes)));
});
}

Expand Down
10 changes: 5 additions & 5 deletions src/components/projects/projectId/data-browser/SearchGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function SearchGroups() {
dispatch(updateAdditionalDataState('loading', true));
const refetchTimer = setTimeout(() => {
searchRecordsExtended(projectId, parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, fullSearchStore[SearchGroup.DRILL_DOWN]), 0, 20, (res) => {
dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res.data['searchRecordsExtended'], labelingTasks)));
dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res, labelingTasks)));
dispatch(updateAdditionalDataState('loading', false));
});
}, 500);
Expand All @@ -133,14 +133,14 @@ export default function SearchGroups() {
options.limit = 20;
}
getRecordsByStaticSlice(projectId, activeSlice.id, options, (res) => {
dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res.data['recordsByStaticSlice'], labelingTasks)));
dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res, labelingTasks)));
staticDataSlicesCurrentCount(projectId, activeSlice.id, (res) => {
if (!res.data) {
if (!res) {
dispatch(updateAdditionalDataState('staticDataSliceCurrentCount', null));
return;

}
dispatch(updateAdditionalDataState('staticDataSliceCurrentCount', res['data']['staticDataSlicesCurrentCount']));
dispatch(updateAdditionalDataState('staticDataSliceCurrentCount', res));
});
});
}
Expand Down Expand Up @@ -569,7 +569,7 @@ export default function SearchGroups() {
if (res == null) {
setCurrentWeakSupervisionRun({ state: Status.NOT_YET_RUN });
} else {
setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res['data']['currentWeakSupervisionRun']));
setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function SaveDataSliceModal(props: { fullSearch: {} }) {
filterRaw: getRawFilterForSave(props.fullSearch),
filterData: parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, props.fullSearch[SearchGroup.DRILL_DOWN].value)
}, (res) => {
const id = res["data"]["createDataSlice"]["id"];
const id = res?.id;
const slice = {
id: id, name: modalSaveDataSlice.sliceName, static: isStatic, filterRaw: getRawFilterForSave(props.fullSearch),
filterData: parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, props.fullSearch[SearchGroup.DRILL_DOWN].value), color: getColorStruct(isStatic),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function SimilaritySearchModal() {
function getSimilarRecords(hasFilter: boolean = false) {
const attFilter = hasFilter ? prepareAttFilter(filterAttributesForm, attributes) : null;
getRecordsBySimilarity(projectId, selectedEmbedding.id, modalSS.recordId, attFilter, null, (res) => {
dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res.data['searchRecordsBySimilarity'], labelingTasks)));
dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res, labelingTasks)));
dispatch(setRecordsInDisplay(true));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ export default function SyncRecordsModal(props: SyncRecordsModalProps) {
const changes = jsonCopy(erdDataCopy.cachedRecordChanges);
for (const key in changes) delete changes[key].display;
syncEditedRecords(projectId, changes, (res) => {
const tmp = res?.data?.editRecords;
if (tmp?.ok) {
if (res) {
erdDataCopy.data.records = jsonCopy(erdDataCopy.displayRecords);
erdDataCopy.cachedRecordChanges = {};
dispatch(setModalStates(ModalEnum.SYNC_RECORDS, { syncModalAmount: Object.keys(erdDataCopy.cachedRecordChanges).length }));
} else {
if (tmp) erdDataCopy.errors = tmp.errors;
if (res) erdDataCopy.errors = JSON.parse(res);
else erdDataCopy.errors = ["Request didn't go through"];
}
setSyncing(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) {
if (res == null) {
setCurrentWeakSupervisionRun({ state: Status.NOT_YET_RUN });
} else {
setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res['data']['currentWeakSupervisionRun']));
setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res));
}
});
}
Expand Down
Loading