如何将免疫添加到FHIR交易捆绑中?

时间:2019-01-13 23:45:46

标签: hl7-fhir dstu2-fhir

我已经从https://syntheticmass.mitre.org/download.html下载了一些DSTU2患者捆绑包。我正在尝试将数据上传到FHIR测试服务器。我的代码(使用fhir-net-api)循环遍历多个文件,并将它们编译为单个事务包。我已经在下面的代码段中构建了下面的事务捆绑。

问题在于免疫条目没有fullUrl元素。我以为我错过了循环的机会,但是根据https://www.hl7.org/fhir/immunization.html,免疫条目甚至不支持fullUrl元素。

如果我建立了一个仅包含一些人口统计详细信息的自定义患者,该过程将起作用,因此我猜测我需要对“免疫”条目进行一些更改,但找不到包含免疫数据的示例交易捆绑。

public Bundle ParseTestData(List<string> list) //File data as string in list
    {
        var parser = new FhirJsonParser();
        var parsedBundles = new List<Bundle>();
        var transactionBundle = new Bundle()
        {
            Id = "test-data-bundle",
            Type = Bundle.BundleType.Transaction
        };
        foreach (var str in list)
        {
            try
            {
                Bundle bundle = parser.Parse<Bundle>(str);
                parsedBundles.Add(bundle);
            }
            catch (Exception e){/*cut for brevity*/}
        }
        foreach (var bundle in parsedBundles)
        {
            foreach (var entry in bundle.Entry)
            {
                entry.Request = new Bundle.RequestComponent
                {
                    Method = Bundle.HTTPVerb.POST,
                    Url = "urn:uuid:" + Guid.NewGuid().ToString()
                };
                transactionBundle.Entry.Add(entry);
            }
        }
        return transactionBundle;
    }

我在这里的挣扎不是C#代码。我只是不知道如何正确地打包数据。

以下是源文件中的一些JSON。

{
  "fullUrl": "urn:uuid:05374078-2d51-4c7e-a562-273b030ba019",
  "resource": {
    "id": "05374078-2d51-4c7e-a562-273b030ba019",
    "status": "finished",
    "class": "outpatient",
    "type": [
      {
        "coding": [
          {
            "system": "http://snomed.info/sct",
            "code": "170258001"
          }
        ],
        "text": "Outpatient Encounter"
      }
    ],
    "patient": {
      "reference": "urn:uuid:0d88250d-63c6-4ce5-aedb-91d64fa09838"
    },
    "period": {
      "start": "2011-09-25T02:18:02-04:00",
      "end": "2011-09-25T03:18:02-04:00"
    },
    "serviceProvider": {
      "reference": "urn:uuid:a602f5c0-26a5-4288-b83d-39abc341757d"
    },
    "resourceType": "Encounter"
  }
},
{
  "resource": {
    "status": "completed",
    "date": "2011-09-25T02:18:02-04:00",
    "vaccineCode": {
      "coding": [
        {
          "system": "http://hl7.org/fhir/sid/cvx",
          "code": "08",
          "display": "Hep B, adolescent or pediatric"
        }
      ],
      "text": "Hep B, adolescent or pediatric"
    },
    "patient": {
      "reference": "urn:uuid:0d88250d-63c6-4ce5-aedb-91d64fa09838"
    },
    "wasNotGiven": false,
    "reported": false,
    "encounter": {
      "reference": "urn:uuid:05374078-2d51-4c7e-a562-273b030ba019"
    },
    "resourceType": "Immunization"
  }
},

1 个答案:

答案 0 :(得分:0)

fullUrl位于Bundle资源中,而不是Immunization中。捆绑包包含一组“入口”元素。然后,每个“条目”(用于事务请求)都包含“ fullUrl”,“ resource”和“ request”元素。免疫的内容位于“资源”元素内。您可以在此处查看示例:http://build.fhir.org/bundle-transaction.json.html。 (只需将您的免疫接种内容粘贴在患者内容所在的位置即可。)

相关问题