Skip to content

Commit

Permalink
Merge pull request #2230 from IBM/tbieste-issue-1961
Browse files Browse the repository at this point in the history
Issue #1961 - Optionally reject references without resource type
  • Loading branch information
tbieste authored Apr 14, 2021
2 parents af9d6d5 + 3ee1075 commit da73eab
Show file tree
Hide file tree
Showing 1,095 changed files with 177,545 additions and 177,280 deletions.
4 changes: 2 additions & 2 deletions docs/src/pages/guides/FHIRServerUsersGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout: post
title: IBM FHIR Server User's Guide
description: IBM FHIR Server User's Guide
Copyright: years 2017, 2021
lastupdated: "2021-03-10"
lastupdated: "2021-04-13"
permalink: /FHIRServerUsersGuide/
---

Expand Down Expand Up @@ -2594,7 +2594,7 @@ For more information about topics related to configuring a FHIR server, see the

- <b id="f5">5</b>

An external reference is a reference to a resource which is meaningful outside a particular request bundle. The value typically includes the resource type and the resource identifier, and could be an absolute or relative URL. Examples: `https://fhirserver1:9443/fhir-server/api/v4/Patient/12345`, `Patient/12345`, etc. [](#a5)
An external reference is a reference to a resource which is meaningful outside a particular request bundle. The value typically includes the resource type and the resource identifier, and could be an absolute or relative URL. Examples: `https://fhirserver1:9443/fhir-server/api/v4/Patient/12345`, `Patient/12345`, etc. Requiring relative URLs to include a valid resource type can be configured via the `fhirServer/core/checkReferenceTypes` config property. For more information, see [Section 5.1 Configuration properties reference](#51-configuration-properties-reference). [](#a5)

- <b id="f6">6</b>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020
* (C) Copyright IBM Corp. 2020, 2021
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -418,7 +418,7 @@ private Source source(AuditLogEntry entry) {
.type(SOURCE_AUDIT)
.site(string(entry.getLocation()))
.observer(Reference.builder()
.reference(string(entry.getComponentId()))
.reference(string("Device/"+ entry.getComponentId()))
.build())
.build();
// @formatter:on
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020
* (C) Copyright IBM Corp. 2020, 2021
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -89,7 +89,7 @@ public void testAuditEventMapper() throws Exception {
StringWriter writer = new StringWriter();
FHIRGenerator.generator(Format.JSON, false).generate(auditEvent, writer);
String actual = writer.toString();
String expected = "{\"resourceType\":\"AuditEvent\",\"type\":{\"system\":\"http://terminology.hl7.org/CodeSystem/audit-event-type\",\"code\":\"rest\",\"display\":\"Restful Operation\"},\"subtype\":[{\"system\":\"http://hl7.org/fhir/restful-interaction\",\"code\":\"create\",\"display\":\"create\"}],\"action\":\"C\",\"period\":{\"start\":\"2020-12-10T14:35:57.752Z\",\"end\":\"2020-12-10T14:36:02.779Z\"},\"recorded\":\"TIME\",\"outcome\":\"0\",\"outcomeDesc\":\"success\",\"purposeOfEvent\":[{\"coding\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/v3-ActReason\",\"code\":\"PurposeOfUse\",\"display\":\"PurposeOfUse\"}]}],\"agent\":[{\"role\":[{\"coding\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/extra-security-role-type\",\"code\":\"datacollector\",\"display\":\"datacollector\"}]}],\"name\":\"fhir-server\",\"requestor\":true,\"network\":{\"address\":\"192.168.12.28\",\"type\":\"1\"}}],\"source\":{\"site\":\"Location\",\"observer\":{\"reference\":\"fhir-server\"},\"type\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/security-source-type\",\"code\":\"4\",\"display\":\"Application Server\"}]},\"entity\":[{\"securityLabel\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/v3-Confidentiality\",\"code\":\"N\",\"display\":\"normal\"}],\"description\":\"FHIR Create request\",\"detail\":[{\"type\":\"FHIR Context\",\"valueBase64Binary\":\"CnsKICAgICJyZXF1ZXN0X3VuaXF1ZV9pZCI6ICI0MTdiMjEwNS1iYzZiLTQ0ZjctOWYyMy00Yzc4NGExN2QyNGIiLAogICAgImFjdGlvbiI6ICJSIiwKICAgICJvcGVyYXRpb25fbmFtZSI6ICJVbml0VGVzdCIsCiAgICAic3RhcnRfdGltZSI6ICIyMDIwLTEyLTEwIDE0OjM1OjU3Ljc1MiIsCiAgICAiZW5kX3RpbWUiOiAiMjAyMC0xMi0xMCAxNDozNjowMi43NzkiLAogICAgImFwaV9wYXJhbWV0ZXJzIjogewogICAgICAgICJyZXF1ZXN0IjogImhvc3RuYW1lIiwKICAgICAgICAicmVxdWVzdF9zdGF0dXMiOiAyMDEKICAgIH0sCiAgICAiZGF0YSI6IHsKICAgICAgICAicmVzb3VyY2VfdHlwZSI6ICJPYnNlcnZhdGlvbiIsCiAgICAgICAgImlkIjogIjBlODM3NDQwLTY0ZWItNGYxNi04NzhlLTEyODc5YTRjZmUyZCIsCiAgICAgICAgInZlcnNpb25faWQiOiAiMSIKICAgIH0sCiAgICAiYmF0Y2giOiB7CiAgICAgICAgInJlc291cmNlc19yZWFkIjogMTAsCiAgICAgICAgInJlc291cmNlc19jcmVhdGVkIjogNSwKICAgICAgICAicmVzb3VyY2VzX3VwZGF0ZWQiOiAyCiAgICB9LAogICAgImV2ZW50X3R5cGUiOiAiZmhpci1jcmVhdGUiLAogICAgImRlc2NyaXB0aW9uIjogIkZISVIgQ3JlYXRlIHJlcXVlc3QiLAogICAgImNsaWVudF9jZXJ0X2NuIjogIiIsCiAgICAiY2xpZW50X2NlcnRfaXNzdWVyX291IjogIldhdHNvbiBIZWFsdGgiLAogICAgImxvY2F0aW9uIjogIkxvY2F0aW9uIgp9\"}]}]}".replace("TIME", now.getValue().format(Instant.PARSER_FORMATTER));
String expected = "{\"resourceType\":\"AuditEvent\",\"type\":{\"system\":\"http://terminology.hl7.org/CodeSystem/audit-event-type\",\"code\":\"rest\",\"display\":\"Restful Operation\"},\"subtype\":[{\"system\":\"http://hl7.org/fhir/restful-interaction\",\"code\":\"create\",\"display\":\"create\"}],\"action\":\"C\",\"period\":{\"start\":\"2020-12-10T14:35:57.752Z\",\"end\":\"2020-12-10T14:36:02.779Z\"},\"recorded\":\"TIME\",\"outcome\":\"0\",\"outcomeDesc\":\"success\",\"purposeOfEvent\":[{\"coding\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/v3-ActReason\",\"code\":\"PurposeOfUse\",\"display\":\"PurposeOfUse\"}]}],\"agent\":[{\"role\":[{\"coding\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/extra-security-role-type\",\"code\":\"datacollector\",\"display\":\"datacollector\"}]}],\"name\":\"fhir-server\",\"requestor\":true,\"network\":{\"address\":\"192.168.12.28\",\"type\":\"1\"}}],\"source\":{\"site\":\"Location\",\"observer\":{\"reference\":\"Device/fhir-server\"},\"type\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/security-source-type\",\"code\":\"4\",\"display\":\"Application Server\"}]},\"entity\":[{\"securityLabel\":[{\"system\":\"http://terminology.hl7.org/CodeSystem/v3-Confidentiality\",\"code\":\"N\",\"display\":\"normal\"}],\"description\":\"FHIR Create request\",\"detail\":[{\"type\":\"FHIR Context\",\"valueBase64Binary\":\"CnsKICAgICJyZXF1ZXN0X3VuaXF1ZV9pZCI6ICI0MTdiMjEwNS1iYzZiLTQ0ZjctOWYyMy00Yzc4NGExN2QyNGIiLAogICAgImFjdGlvbiI6ICJSIiwKICAgICJvcGVyYXRpb25fbmFtZSI6ICJVbml0VGVzdCIsCiAgICAic3RhcnRfdGltZSI6ICIyMDIwLTEyLTEwIDE0OjM1OjU3Ljc1MiIsCiAgICAiZW5kX3RpbWUiOiAiMjAyMC0xMi0xMCAxNDozNjowMi43NzkiLAogICAgImFwaV9wYXJhbWV0ZXJzIjogewogICAgICAgICJyZXF1ZXN0IjogImhvc3RuYW1lIiwKICAgICAgICAicmVxdWVzdF9zdGF0dXMiOiAyMDEKICAgIH0sCiAgICAiZGF0YSI6IHsKICAgICAgICAicmVzb3VyY2VfdHlwZSI6ICJPYnNlcnZhdGlvbiIsCiAgICAgICAgImlkIjogIjBlODM3NDQwLTY0ZWItNGYxNi04NzhlLTEyODc5YTRjZmUyZCIsCiAgICAgICAgInZlcnNpb25faWQiOiAiMSIKICAgIH0sCiAgICAiYmF0Y2giOiB7CiAgICAgICAgInJlc291cmNlc19yZWFkIjogMTAsCiAgICAgICAgInJlc291cmNlc19jcmVhdGVkIjogNSwKICAgICAgICAicmVzb3VyY2VzX3VwZGF0ZWQiOiAyCiAgICB9LAogICAgImV2ZW50X3R5cGUiOiAiZmhpci1jcmVhdGUiLAogICAgImRlc2NyaXB0aW9uIjogIkZISVIgQ3JlYXRlIHJlcXVlc3QiLAogICAgImNsaWVudF9jZXJ0X2NuIjogIiIsCiAgICAiY2xpZW50X2NlcnRfaXNzdWVyX291IjogIldhdHNvbiBIZWFsdGgiLAogICAgImxvY2F0aW9uIjogIkxvY2F0aW9uIgp9\"}]}]}".replace("TIME", now.getValue().format(Instant.PARSER_FORMATTER));

JSONAssert.assertEquals(expected, actual,
new CustomComparator(JSONCompareMode.LENIENT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2019
* (C) Copyright IBM Corp. 2019, 2021
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -251,9 +251,9 @@ else if (builder instanceof Reference.Builder && method.getName().equals("type")
else if (builder instanceof Reference.Builder && method.getName().equals("reference")) {
// References with specific target profiles
if (referenceTargetProfile != null) {
argument = string(referenceTargetProfile + "/" + podam.manufacturePojo(String.class));
argument = string(referenceTargetProfile + "/" + podam.manufacturePojo(String.class).replace("_", "-"));
} else {
argument = string("Basic/" + podam.manufacturePojo(String.class));
argument = string("Basic/" + podam.manufacturePojo(String.class).replace("_", "-"));
}
}

Expand Down
188 changes: 94 additions & 94 deletions fhir-examples/src/main/resources/json/ibm/complete-mock/Account-1.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"resourceType": "Account",
"meta": {
"versionId": "LVrSF05S3b",
"lastUpdated": "2020-11-04T11:22:45.16021-05:00",
"source": "9zMl4X2mKa",
"versionId": "uNBFunj5xg",
"lastUpdated": "2021-04-12T14:34:33.653-05:00",
"source": "6IHLDg7LE5",
"profile": [
"XYZfU7qNYm"
"FeSFIjHesD"
],
"security": [
{
"system": "X6PYpB2zsb",
"version": "OfHahgbnQQ",
"code": "HWTBtdIF5u",
"display": "UkhHHKyI6b",
"system": "iJbqFpCIFC",
"version": "AJ0iVfvqI_",
"code": "US4ehRtUAH",
"display": "gob_w4S3AW",
"userSelected": true
}
],
"tag": [
{
"system": "VCYUPapQst",
"version": "pv5nEOLyLS",
"code": "yMr2471cua",
"display": "5GIzP9nCxr",
"system": "_T18OzMQNr",
"version": "kvyDKHJtaG",
"code": "C9g__7cDIv",
"display": "YyDGGuLj2h",
"userSelected": true
},
{
"code": "ibm/complete-mock"
}
]
},
"implicitRules": "IaWR4iNUWj",
"implicitRules": "MilF70TF90",
"language": "en-US",
"text": {
"status": "extensions",
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"></div>"
},
"identifier": [
Expand All @@ -41,186 +41,186 @@
"type": {
"coding": [
{
"system": "g5FZzPMdXq",
"version": "AnVf9RaLto",
"code": "lBkDxz6zR3",
"display": "_LDU7idpHG",
"system": "hDFSWh3PK6",
"version": "zKF_yMszfw",
"code": "2aYrSlZNk8",
"display": "Y4b1vxL8H4",
"userSelected": true
}
],
"text": "x35wXZuBij"
"text": "XAsP8pvXSk"
},
"system": "Rg80wIhY5x",
"value": "DkUGm2tUET",
"system": "eP0zgSBSyz",
"value": "3l5Yctg77j",
"period": {
"start": "2020-11-04T11:22:45.164407-05:00",
"end": "2020-11-04T11:22:45.164699-05:00"
"start": "2021-04-12T14:34:33.649-05:00",
"end": "2021-04-12T14:34:33.649-05:00"
}
}
],
"status": "inactive",
"type": {
"coding": [
{
"system": "HU2QS8_ZJG",
"version": "4zWKH2XC2j",
"code": "JM_13aaqeM",
"display": "NU_yGmoKX6",
"system": "2iytMykFxs",
"version": "hfO_hyBffR",
"code": "ScK1ChmR8E",
"display": "Co9hKjCxd6",
"userSelected": true
}
],
"text": "RMu8MHXcJN"
"text": "TYwHDS047_"
},
"name": "QkTGCUGwFK",
"name": "8gWvI9M8ox",
"subject": [
{
"reference": "Patient/NDKfa6zAzp",
"reference": "Patient/66wYJMGPmM",
"type": "Patient",
"identifier": {
"use": "secondary",
"type": {
"coding": [
{
"system": "tr3UI09nXw",
"version": "ngg8fOpoS0",
"code": "jOeRauSnB_",
"display": "lVbCYwngNx",
"system": "AlXyMoGI6f",
"version": "LL0W6Nz1XA",
"code": "7RZcj8sjSN",
"display": "VeeOKDb5wc",
"userSelected": true
}
],
"text": "msFyXCrqoO"
"text": "i3N3s7AN49"
},
"system": "OJv7D2oGQu",
"value": "hNwdkrJ3HU",
"system": "dc0XEdwY5U",
"value": "vPLUfeYtqq",
"period": {
"start": "2020-11-04T11:22:45.169021-05:00",
"end": "2020-11-04T11:22:45.169306-05:00"
"start": "2021-04-12T14:34:33.651-05:00",
"end": "2021-04-12T14:34:33.652-05:00"
}
},
"display": "LdSStd8jf0"
"display": "6UzBAR_e4n"
}
],
"servicePeriod": {
"start": "2020-11-04T11:22:45.169691-05:00",
"end": "2020-11-04T11:22:45.17001-05:00"
"start": "2021-04-12T14:34:33.647-05:00",
"end": "2021-04-12T14:34:33.647-05:00"
},
"coverage": [
{
"coverage": {
"reference": "Coverage/bD5rwgnx7M",
"reference": "Coverage/CyyyBHiPtH",
"type": "Coverage",
"identifier": {
"use": "secondary",
"use": "usual",
"type": {
"coding": [
{
"system": "CWoCQ4gj29",
"version": "lci5lJvRAY",
"code": "IxsUsQtkIa",
"display": "2gjGUj47av",
"system": "KWQRJ9x6RK",
"version": "TExKBu2rx1",
"code": "QswlFRa25t",
"display": "MisFshJpKT",
"userSelected": true
}
],
"text": "QTOPnsdy5e"
"text": "tYSvMw02RI"
},
"system": "IKFK38BTD4",
"value": "dd4EM6ogj1",
"system": "9dENW9Dzhv",
"value": "Md7d53i4YI",
"period": {
"start": "2020-11-04T11:22:45.172137-05:00",
"end": "2020-11-04T11:22:45.172462-05:00"
"start": "2021-04-12T14:34:33.651-05:00",
"end": "2021-04-12T14:34:33.651-05:00"
}
},
"display": "FI8h47CYyi"
"display": "ssVuKlRYIn"
},
"priority": 1078838199
"priority": 1947886668
}
],
"owner": {
"reference": "Organization/mj_EY5gdaD",
"reference": "Organization/R-V4qWKGuc",
"type": "Organization",
"identifier": {
"use": "official",
"use": "usual",
"type": {
"coding": [
{
"system": "kcMy6Ttuzz",
"version": "P2QDd7fnLe",
"code": "rEyMYyCiIw",
"display": "xcQaa_cJK3",
"system": "HjmuU77K5e",
"version": "jqL3nCJpqa",
"code": "Is_B0qrn1c",
"display": "_REQ0B5fN6",
"userSelected": true
}
],
"text": "oGg6wyzfGs"
"text": "3kQYqyynD1"
},
"system": "Gb3rQTCedp",
"value": "djq47F5tW6",
"system": "BijTxJ46zb",
"value": "1RELUbfUKi",
"period": {
"start": "2020-11-04T11:22:45.174323-05:00",
"end": "2020-11-04T11:22:45.174603-05:00"
"start": "2021-04-12T14:34:33.65-05:00",
"end": "2021-04-12T14:34:33.65-05:00"
}
},
"display": "DqNvJoNGkC"
"display": "OoNzqJQIKb"
},
"description": "I8smsJ74Ma",
"description": "87BNAbtYCB",
"guarantor": [
{
"party": {
"reference": "Patient/a8cMn23Czp",
"reference": "Patient/RXMLqZuCnO",
"type": "Patient",
"identifier": {
"use": "old",
"use": "secondary",
"type": {
"coding": [
{
"system": "daLksTFLBf",
"version": "tHCg86u8fd",
"code": "r4gNjgOzP8",
"display": "t2TLNFDTQU",
"system": "266JUUMUBs",
"version": "OVzaRUTrEI",
"code": "KLKVJq2NZh",
"display": "Ugshc8oaT4",
"userSelected": true
}
],
"text": "K6quUl19P3"
"text": "rICE2WAuqn"
},
"system": "rnsALF1V8v",
"value": "Ua9RWC1VmI",
"system": "miqjCymO2w",
"value": "9MoZRiFDTW",
"period": {
"start": "2020-11-04T11:22:45.17678-05:00",
"end": "2020-11-04T11:22:45.177-05:00"
"start": "2021-04-12T14:34:33.648-05:00",
"end": "2021-04-12T14:34:33.648-05:00"
}
},
"display": "6pavJkufuS"
"display": "ftjtEhi1Gc"
},
"onHold": true,
"period": {
"start": "2020-11-04T11:22:45.177409-05:00",
"end": "2020-11-04T11:22:45.177567-05:00"
"start": "2021-04-12T14:34:33.648-05:00",
"end": "2021-04-12T14:34:33.649-05:00"
}
}
],
"partOf": {
"reference": "Account/OZoH8O9f56",
"reference": "Account/NnF4re1d46",
"type": "Account",
"identifier": {
"use": "secondary",
"use": "temp",
"type": {
"coding": [
{
"system": "hLt08H2EOY",
"version": "cmMzUlYhAC",
"code": "zvStPdZhhF",
"display": "fLfrtg8SYq",
"system": "ibft8DRlmU",
"version": "4n1NROoNw0",
"code": "wVdXs_ZZ5P",
"display": "R9aUd3LkXL",
"userSelected": true
}
],
"text": "rLaMVgttBX"
"text": "B23FmBI6Np"
},
"system": "uUnJ7xC5LI",
"value": "mhZpvyM6XS",
"system": "xha4FvBQBN",
"value": "o_9Oqg_R3T",
"period": {
"start": "2020-11-04T11:22:45.178801-05:00",
"end": "2020-11-04T11:22:45.179005-05:00"
"start": "2021-04-12T14:34:33.646-05:00",
"end": "2021-04-12T14:34:33.646-05:00"
}
},
"display": "Z1Pp24i5H_"
"display": "e1x5TZ9YB9"
}
}
Loading

0 comments on commit da73eab

Please sign in to comment.