Closed lindaxiang closed 1 year ago
Proposed solution (Thanks to @hknahal suggestions):
Create validation script for "percent_tumour_cells":
in this script $field is the submitted value for the "percent_tumour_cells" field and $name is the actual field name ("percent_tumour_cells")
Code:
// Check for when "percent_tumour_cells_measurement_method" has a clinical exception value of "not applicable"
if ($row.percent_tumour_cells_measurement_method && $row.percent_tumour_cells_measurement_method != null && !(checkforEmpty($row.percent_tumour_cells_measurement_method)) && $row.percent_tumour_cells_measurement_method.trim().toLowerCase() === 'not applicable') {
if ($field && $field != null && !(checkforEmpty($field))) {
result = {
valid: false,
message: `The '${$name}' field cannot be submitted when 'percent_tumour_cells_measurement_method' = 'Not applicable'`
};
}
}
Since "percent_tumour_cells" is of "Number" type, we can't implement a clinical exception using the Clinical Exception API. Instead we'll need to create a validation script that permits "percent_tumour_cells" to be empty if = "percent_tumour_cells_measurement_method" is submitted as "Not applicable"
Similar solution as what we did for the "chemotherapy_drug_dose" field (https://github.com/icgc-argo/argo-dictionary/issues/409)