Esempio n. 1
0
  /*
   * Determines the standard category for the "measure" child
   */
  protected static Measure.CAT extractCategories(JsonNode subMeasure) throws Exception {
    JsonNode cats = subMeasure.path("standard_category");

    // If there is no standard_category node retun unknown category
    if (cats.isMissingNode()) {
      LOG.warning("Missing a Standard Category");
      return Measure.CAT.Unknown;
    }

    return Measure.getCAT(cats.getTextValue());
  }
Esempio n. 2
0
  /*
   * Extracts the "measure" child object from the JSON
   */
  private static Measure extractMeasure(String measureName, JsonNode mNode) throws Exception {
    Measure m = new Measure();
    m.setName(measureName);
    JsonNode subM = mNode.path(measureName);
    m.setDescription(subM.path("description").getTextValue());

    // Set the type of measure
    String itemsType = (subM.path("type").getTextValue());
    m.setItemType(extractItems(itemsType, subM.path("items")));

    m.setCategory(extractCategories(subM));

    // Set Codes
    Iterator<JsonNode> codes = subM.path("codes").getElements();
    while (codes.hasNext()) {
      m.addCode(extractCode(codes.next()));
    }

    return m;
  }