private void convertJSONField(JSONObject nodeJSON, List<String> dateFieldNames) { JSONObject properties = nodeJSON.optJSONObject(PEDIGREE_PROPERTIES_STRING); if (properties != null) { for (String fieldName : dateFieldNames) { JSONObject dateObject = properties.optJSONObject(fieldName); if (dateObject != null) { PhenoTipsDate date = new PhenoTipsDate(dateObject); properties.put(fieldName, date.toJSON()); } } nodeJSON.put(PEDIGREE_PROPERTIES_STRING, properties); } } }
private void convertJSONField(JSONObject nodeJSON, List<String> dateFieldNames) { JSONObject properties = nodeJSON.optJSONObject(PEDIGREE_PROPERTIES_STRING); if (properties != null) { for (String fieldName : dateFieldNames) { JSONObject dateObject = properties.optJSONObject(fieldName); if (dateObject != null) { PhenoTipsDate date = new PhenoTipsDate(dateObject); properties.put(fieldName, date.toJSON()); } } nodeJSON.put(PEDIGREE_PROPERTIES_STRING, properties); } } }
result.put(property, new PhenoTipsDate(dateAsObject)); } else { result.put(property, new PhenoTipsDate(json.optString(jsonFieldName, null)));
result.put(property, new PhenoTipsDate(dateAsObject)); } else { result.put(property, new PhenoTipsDate(json.optString(jsonFieldName, null)));
private void updatePatientDates(BaseObject patientData, String documentName) { for (Map.Entry<String, String> entry : ASENTERED_FIELDNAMES.entrySet()) { String asEnteredField = entry.getKey(); String dateAsEntered = patientData.getStringValue(asEnteredField); if (!StringUtils.isEmpty(dateAsEntered)) { // if "date as entered" is present, use it and disregard the date field itself. try { JSONObject dateAsEnteredJSON = new JSONObject(dateAsEntered); PhenoTipsDate asEnteredDate = new PhenoTipsDate(dateAsEnteredJSON); // PhenoTipsDate can read data in the old format, and can spit out date in the new format patientData.setStringValue(asEnteredField, asEnteredDate.toString()); } catch (Exception ex) { this.logger.error("Could not process date-as-entered field {} for patient {}: [{}]", asEnteredField, documentName, ex.getMessage()); } } else { // otherwise use the date field (if present) to populate the date as entered String dateField = entry.getValue(); Date date = patientData.getDateValue(dateField); if (date != null) { this.logger.debug("Using the value from the {} field to populate {} field for patient {}", dateField, asEnteredField, documentName); PhenoTipsDate phenotipsDate = new PhenoTipsDate(date); patientData.setStringValue(asEnteredField, phenotipsDate.toString()); } } } }
private void updatePatientDates(BaseObject patientData, String documentName) { for (Map.Entry<String, String> entry : ASENTERED_FIELDNAMES.entrySet()) { String asEnteredField = entry.getKey(); String dateAsEntered = patientData.getStringValue(asEnteredField); if (!StringUtils.isEmpty(dateAsEntered)) { // if "date as entered" is present, use it and disregard the date field itself. try { JSONObject dateAsEnteredJSON = new JSONObject(dateAsEntered); PhenoTipsDate asEnteredDate = new PhenoTipsDate(dateAsEnteredJSON); // PhenoTipsDate can read data in the old format, and can spit out date in the new format patientData.setStringValue(asEnteredField, asEnteredDate.toString()); } catch (Exception ex) { this.logger.error("Could not process date-as-entered field {} for patient {}: [{}]", asEnteredField, documentName, ex.getMessage()); } } else { // otherwise use the date field (if present) to populate the date as entered String dateField = entry.getValue(); Date date = patientData.getDateValue(dateField); if (date != null) { this.logger.debug("Using the value from the {} field to populate {} field for patient {}", dateField, asEnteredField, documentName); PhenoTipsDate phenotipsDate = new PhenoTipsDate(date); patientData.setStringValue(asEnteredField, phenotipsDate.toString()); } } } }
result.put(propertyName, new PhenoTipsDate(dateAsEnteredJSON)); } catch (Exception ex) { this.logger.error("Could not process date-as-entered for {}: [{}]", result.put(propertyName, new PhenoTipsDate(date));
result.put(propertyName, new PhenoTipsDate(dateAsEnteredJSON)); } catch (Exception ex) { this.logger.error("Could not process date-as-entered for {}: [{}]", result.put(propertyName, new PhenoTipsDate(date));