-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/clinical options columns #52
Changes from 3 commits
ced067f
059e608
01550ca
573fdcc
e875d3a
fd7c2f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import React from 'react' | |
import { Button, Grid, Icon, Label, Popup } from 'semantic-ui-react' | ||
import { DjangoCGDSStudy, DjangoCommonResponse, DjangoExperiment, DjangoExperimentClinicalSource, DjangoExperimentSource, DjangoNumberSamplesInCommonClinicalValidationResult, DjangoResponseCode, DjangoSurvivalColumnsTupleSimple, DjangoUserFile, ExperimentState } from '../../../utils/django_interfaces' | ||
import { CustomAlert, CustomAlertTypes, FileType, KySearchParams, Nullable, Source, SourceType } from '../../../utils/interfaces' | ||
import { alertGeneralError, cleanRef, experimentSourceIsValid, getDefaultSource, getDjangoHeader, getFilenameFromSource, getFileSizeInMB, getInputFileCSVColumns, makeSourceAndAppend } from '../../../utils/util_functions' | ||
import { alertGeneralError, cleanRef, experimentSourceIsValid, getDefaultSource, getDjangoHeader, getFilenameFromSource, getFileSizeInMB, getInputFileCSVColumns, getInputFileCSVFirstColumnAllRows, makeSourceAndAppend } from '../../../utils/util_functions' | ||
import { SurvivalTuplesForm } from '../../survival/SurvivalTuplesForm' | ||
import { SourceForm } from '../SourceForm' | ||
import { BiomarkerState, InferenceExperimentForTable } from '../../biomarkers/types' | ||
|
@@ -71,6 +71,8 @@ interface ClinicalSourceState { | |
cgdsStudyName: Nullable<string>, | ||
/** alert interface */ | ||
alert: CustomAlert, | ||
/** posibles values for survival tuple */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Por consistencia, arrancá los comentarios en mayúscula hdp! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vos sabes que nunca me di cuenta ajajaj. Dale ahora lo tomo para toda la documentacion que vaya a hacer. Gracias! |
||
survivalTuplesPossiblesValues: string[], | ||
} | ||
|
||
/** | ||
|
@@ -89,7 +91,8 @@ export class ClinicalSourcePopup extends React.Component<PopupClinicalSourceProp | |
gettingSourceData: false, | ||
unlinkingSource: false, | ||
cgdsStudyName: null, | ||
alert: this.getDefaultAlertProps() | ||
alert: this.getDefaultAlertProps(), | ||
survivalTuplesPossiblesValues: [] | ||
} | ||
} | ||
|
||
|
@@ -168,32 +171,37 @@ export class ClinicalSourcePopup extends React.Component<PopupClinicalSourceProp | |
|
||
if (fileSizeInMB < MAX_FILE_SIZE_IN_MB_WARN) { | ||
const file = clinicalSource.newUploadedFileRef.current.files[0] | ||
getInputFileCSVColumns(file, undefined, FileType.CLINICAL).then((headersColumnsNames) => { | ||
// Sets the Request's Headers | ||
const myHeaders = getDjangoHeader() | ||
// Sends an array of headers to compare in server | ||
const jsonData = { | ||
headersColumnsNames, | ||
mRNASourceId, | ||
mRNASourceType: SourceType.UPLOADED_DATASETS, | ||
gemSourceId, | ||
gemSourceType: SourceType.UPLOADED_DATASETS | ||
} | ||
getInputFileCSVFirstColumnAllRows(file, undefined).then((firstColumnAllRows) => { | ||
getInputFileCSVColumns(file, undefined).then((headersColumnsNames) => { | ||
// Sets the Request's Headers | ||
const myHeaders = getDjangoHeader() | ||
// Sends an array of headers to compare in server | ||
const jsonData = { | ||
clinicalData: firstColumnAllRows, | ||
mRNASourceId, | ||
mRNASourceType: SourceType.UPLOADED_DATASETS, | ||
gemSourceId, | ||
gemSourceType: SourceType.UPLOADED_DATASETS | ||
} | ||
|
||
ky.post(urlGetCommonSamplesClinicalSource, { json: jsonData, headers: myHeaders }).then((response) => { | ||
response.json().then((jsonResponse: DjangoNumberSamplesInCommonClinicalValidationResult) => { | ||
if (jsonResponse.status.code === DjangoResponseCode.SUCCESS) { | ||
if (jsonResponse.data.number_samples_in_common > 0) { | ||
this.setState({ clinicalSource }) | ||
} else { | ||
this.clinicalSourceVoid() | ||
ky.post(urlGetCommonSamplesClinicalSource, { json: jsonData, headers: myHeaders }).then((response) => { | ||
response.json().then((jsonResponse: DjangoNumberSamplesInCommonClinicalValidationResult) => { | ||
if (jsonResponse.status.code === DjangoResponseCode.SUCCESS) { | ||
if (jsonResponse.data.number_samples_in_common > 0) { | ||
this.setState({ | ||
clinicalSource, | ||
survivalTuplesPossiblesValues: headersColumnsNames | ||
}) | ||
} else { | ||
this.clinicalSourceVoid() | ||
} | ||
} | ||
} | ||
}).catch((err) => { | ||
console.log('Error parsing JSON ->', err) | ||
}) | ||
}).catch((err) => { | ||
console.log('Error parsing JSON ->', err) | ||
console.log('Error getting user experiments', err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya que estamos, corregir el mensaje de error. Acá no está trayendo los experimentos del usuario There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dejar el comentario que editaste como estaba antes 'Error parsing JSON ->'. Ese estaba bien! Lo que está mal es el de abajo que dice "Error getting user experiments" cuando en realidad choca contra un endpoint que compara los Samples en común. Debería decir algo como "Error getting samples in common" |
||
}) | ||
}).catch((err) => { | ||
console.log('Error getting user experiments', err) | ||
}) | ||
}) | ||
} | ||
|
@@ -510,6 +518,7 @@ export class ClinicalSourcePopup extends React.Component<PopupClinicalSourceProp | |
} else { | ||
clinicalIsDisabled = experiment.state !== BiomarkerState.COMPLETED | ||
} | ||
|
||
const survColumnsAreComplete = !this.validateSurvivalsColumnsComplete() | ||
const iconExtraClassNames = this.props.iconExtraClassNames ?? '' | ||
const clinicalButtonClassName = clinicalIsDisabled | ||
|
@@ -584,6 +593,7 @@ export class ClinicalSourcePopup extends React.Component<PopupClinicalSourceProp | |
handleSurvivalFormDatasetChanges={this.handleSurvivalFormDatasetChanges} | ||
addSurvivalFormTuple={this.addSurvivalFormTuple} | ||
removeSurvivalFormTuple={this.removeSurvivalFormTuple} | ||
survivalTuplesPossiblesValues={this.state.survivalTuplesPossiblesValues} | ||
/> | ||
</Grid.Column> | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sacar el comentario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JAJAJA, recuerdo poner ese any, para probar sin problemas. Ahi lo vuelvo como estaba antes, un (e:any)=> void. Porque recibe almenos un metodo que va a recibir el evento, no un cualquier cosa