json Jolt变换OMHMap到FHIR

kg7wmglp  于 2022-12-15  发布在  其他
关注(0)|答案(1)|浏览(163)

输入:

{
  "heart_rate": {
    "value": 70,
    "unit": "beats/min"
  },
  "effective_time_frame": {
    "time_interval": {
      "start_date_time": "11/01/22 22:14:21"
    }
  },
  "descriptive-statistics": "minimum"
}

字符串
震动规范:

[
  {
    "operation": "shift",
    "spec": {
      "effective_time_frame": {
        "time_interval": {
          "start_date_time": "effectiveDateTime"
        }
      },
      "heart_rate": {
        "value": "valueQuantity.value"
      }
    }
    }
,
  {
    "operation": "modify-default-beta",
    "spec": {
      "effectiveDateTime": "=concat(@(day),'-',@(month),'-2022')",
      "month": "=substring(@(effective_time_frame.time_interval.start_date_time),3,5)",
      "day": "=substring(@(effective_time_frame.time_interval.start_date_time),4,5)"
    }
  }
,
  {
    "operation": "default",
    "spec": {
      "valueQuantity": {
        "code": "/min",
        "system": "http://unitsofmeasure.org",
        "unit": "beats/minute"
      }
    }
  }
]

输出:

{
  "effectiveDateTime" : "11/01/22 22:14:21",
  "valueQuantity" : {
    "value" : 70,
    "unit" : "beats/minute",
    "code" : "/min",
    "system" : "http://unitsofmeasure.org"
  }
}

我们有一个格式为(xxx/xx/xx/)的日期,我们希望它是不带时间的格式(xxxx-xx-xx)。也许有人可以帮助我。我们需要将此作为项目的一部分进行更改,但不幸的是,我们不知道Jolt转换是如何工作的。

icnyk63a

icnyk63a1#

是的,您可以在modify转换规范中使用***concat*函数,但是应该从树的一个级别向上引入@(1,year)作为示例,并使用overwrite样式而不是default**进行转换,以便用新值覆盖effectiveDateTime的现有值,例如

[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "effective_time_frame": {
        "time_interval": {
          "day": "=substring(@(1,start_date_time),0,2)",
          "month": "=substring(@(1,start_date_time),3,5)",
          "year": "=substring(@(1,start_date_time),6,8)",
          "start_date_time": "=concat('20',@(1,year),'-',@(1,month),'-',@(1,day))"
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "effective_time_frame": {
        "time_interval": {
          "start_date_time": "effectiveDateTime"
        }
      },
      "heart_rate": {
        "value": "valueQuantity.value"
      }
    }
  },
  {
    "operation": "default",
    "spec": {
      "valueQuantity": {
        "code": "/min",
        "system": "http://unitsofmeasure.org",
        "unit": "beats/minute"
      }
    }
  }
]

站点http://jolt-demo.appspot.com/上的演示是

相关问题