Skip to content

Commit

Permalink
Merge pull request #320 from IBM/issue-2
Browse files Browse the repository at this point in the history
issue #2 - condense projects and update FHIRServerUsersGuide.md
  • Loading branch information
prb112 authored Oct 28, 2019
2 parents 033f893 + e39f0f6 commit abb66b9
Show file tree
Hide file tree
Showing 28 changed files with 226 additions and 559 deletions.
13 changes: 12 additions & 1 deletion docs/Conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ The IBM FHIR Server aims to be a conformant implementation of the HL7 FHIR speci
## Capability statement
The HL7 FHIR specification defines [an interaction](https://www.hl7.org/fhir/R4/http.html#capabilities) for retrieving a machine-readable description of the server's capabilities via the `[base]/metadata` endpoint. The IBM FHIR Server implements this interaction and generates a `CapabilityStatement` resource based on the current server configuration. While the `CapabilityStatement` resource is ideal for certain uses, this markdown document provides a human-readable summary of important details, with a special focus on limitations of the current implementation and deviations from the specification.

The IBM FHIR Server supports only version 4.0.0 of the specification and presently has no support for the MIME-type parameter `fhirVersion`.

## FHIR HTTP API
The HL7 FHIR specification is more than just a data format. It defines an [HTTP API](https://www.hl7.org/fhir/R4/http.html) for creating, reading, updating, deleting, and searching over FHIR resources. The IBM FHIR Server implements the full API for every resource defined in the specification, with the following exceptions:
The HL7 FHIR specification is more than just a data format. It defines an [HTTP API](https://www.hl7.org/fhir/R4/http.html) for creating, reading, updating, deleting, and searching over FHIR resources. The IBM FHIR Server implements almost the full API for every resource defined in the specification, with the following exceptions:
* history is only supported at the resource instance level (no resource type history and no whole-system history)
* there are parts of the FHIR search specification which are not fully implemented as documented in the following section

The IBM FHIR Server implements a linear versioning scheme for resources and fully implements the `vread` and `history` interactions, as well as version-aware updates.

### General parameters
The `_format` parameter is supported and provides a useful mechanism for requesting a specific format (`XML` or `JSON`) in requests made from a browser. In the absence of either an `Accept` header or a `_format` query parameter, the server defaults to `application/fhir+json`.

The `_pretty` parameter is not currently supported, but should be added as part of https://github.com/IBM/FHIR/issues/269.

The `_summary` and `_elements` parameters are supported on the search interaction as documented.

## Search
The IBM FHIR Server supports search parameters of type `Number`, `Date/DateTime`, `String`, `Token`, `Reference`, `Quantity`, and `URI`.

Expand Down
415 changes: 125 additions & 290 deletions docs/FHIRServerUsersGuide.md

Large diffs are not rendered by default.

Empty file removed fhir-client-sample/.gitignore
Empty file.
41 changes: 0 additions & 41 deletions fhir-client-sample/pom.xml

This file was deleted.

21 changes: 0 additions & 21 deletions fhir-client-sample/src/main/resources/fhir-client.properties

This file was deleted.

Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package com.ibm.fhir.client.sample;
package com.ibm.fhir.client.test.mains;

import static com.ibm.fhir.model.type.String.string;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand All @@ -21,6 +20,7 @@
import com.ibm.fhir.client.FHIRClientFactory;
import com.ibm.fhir.client.FHIRResponse;
import com.ibm.fhir.model.format.Format;
import com.ibm.fhir.model.generator.FHIRGenerator;
import com.ibm.fhir.model.resource.Observation;
import com.ibm.fhir.model.resource.OperationOutcome;
import com.ibm.fhir.model.resource.Patient;
Expand All @@ -36,7 +36,6 @@
import com.ibm.fhir.model.type.code.ContactPointSystem;
import com.ibm.fhir.model.type.code.ContactPointUse;
import com.ibm.fhir.model.type.code.ObservationStatus;
import com.ibm.fhir.model.util.FHIRUtil;

/**
* This class is sample code that demonstrates the use of the FHIR Server's Client API. This sample is not necessarily
Expand All @@ -51,9 +50,6 @@ public static void main(String[] args) throws Exception {
sample.run();
}

public FHIRClientSample() {
}

public void run() throws Exception {
String location;

Expand Down Expand Up @@ -169,9 +165,7 @@ protected String getLocationLogicalId(String location) {
private void displayOperationOutcome(FHIRResponse response) {
try {
OperationOutcome oo = response.getResource(OperationOutcome.class);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FHIRUtil.write(oo, Format.JSON, baos);
System.out.println("OperationOutcome: \n" + baos.toString());
FHIRGenerator.generator(Format.JSON).generate(oo, System.out);
} catch (Throwable t) {
System.out.println("Could not display OperationOutcome from REST API response.");
}
Expand Down
33 changes: 0 additions & 33 deletions fhir-client/src/test/java/com/ibm/fhir/client/test/mains/Main.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package com.ibm.fhir.connectathon.patient;
package com.ibm.fhir.client.test.mains;

import static com.ibm.fhir.client.FHIRRequestHeader.header;
import static com.ibm.fhir.model.type.String.string;
Expand All @@ -17,8 +17,6 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import org.testng.annotations.Test;

import com.ibm.fhir.client.FHIRClient;
import com.ibm.fhir.client.FHIRClientFactory;
import com.ibm.fhir.client.FHIRParameters;
Expand Down Expand Up @@ -62,12 +60,10 @@ private static void log(String msg) {
System.out.println(msg);
}

@Test
public void printHeader() {
log("Starting execution of PatientTrackTest (c) IBM Corporation, 2016.");
log("Starting execution of PatientTrackTest (C) IBM Corporation 2016,2019.");
}

@Test(dependsOnMethods = { "printHeader" })
public void connectToServer() throws Exception {
// Load up our properties file.
Properties clientProperties = readProperties(CLIENT_PROPERTIES_FILENAME);
Expand All @@ -79,7 +75,6 @@ public void connectToServer() throws Exception {
log("Connecting to FHIR endpoint: " + baseUrl);
}

@Test(dependsOnMethods = { "connectToServer" })
public void inspectConformanceStatement() throws Exception {
FHIRResponse response = client.metadata();
if (response.getStatus() != Status.OK.getStatusCode()) {
Expand Down Expand Up @@ -118,7 +113,6 @@ public void inspectConformanceStatement() throws Exception {
log("Server supports search? " + (supportsSearch ? "yes" : "no"));
}

@Test(dependsOnMethods = { "inspectConformanceStatement" })
public void registerPatient() throws Exception {

String location;
Expand Down Expand Up @@ -154,7 +148,6 @@ public void registerPatient() throws Exception {
patient = displayResponsePatient("Retrieved newly-registered patient:", client, response);
}

@Test(dependsOnMethods = { "registerPatient" })
public void updatePatient() throws Exception {
log("\n2) Update a patient");
if (!supportsUpdate) {
Expand Down Expand Up @@ -195,7 +188,6 @@ public void updatePatient() throws Exception {
}
}

@Test(dependsOnMethods = { "updatePatient" })
public void retrieveHistory() throws Exception {
log("\n3) Retrieve patient history");
if (!supportsHistory) {
Expand All @@ -217,7 +209,6 @@ public void retrieveHistory() throws Exception {

}

@Test(dependsOnMethods = { "retrieveHistory" })
public void searchByName() throws Exception {
// 4) Search for a patient by name.
log("\n4) Search for a patient by name");
Expand Down Expand Up @@ -333,4 +324,15 @@ private Patient modifyPatientContents(Patient patient) {

return patient;
}

public static void main(String[] args) throws Exception {
PatientTrackTest test = new PatientTrackTest();
test.printHeader();
test.connectToServer();
test.inspectConformanceStatement();
test.registerPatient();
test.updatePatient();
test.retrieveHistory();
test.searchByName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,63 +12,67 @@
import java.util.List;
import java.util.logging.Logger;

/**
* This class serves up a singleton instance of ConfigurationService containing the FHIR Server's configuration.
*/
public class FHIRConfiguration {

private static final Logger log = Logger.getLogger(FHIRConfiguration.class.getName());

/**
* This class serves up a singleton instance of ConfigurationService containing the FHIR Server's configuration.
*/
public static final String CONFIG_LOCATION = "config";
public static final String CONFIG_FILE_BASENAME = "fhir-server-config.json";
public static final String DEFAULT_TENANT_ID = "default";
public static final String DEFAULT_DATASTORE_ID = "default";

// Configuration properties used by various FHIR Server components.
// Core server properties
public static final String PROPERTY_TENANT_ID_HEADER_NAME = "fhirServer/core/tenantIdHeaderName";
public static final String PROPERTY_DATASTORE_ID_HEADER_NAME = "fhirServer/core/datastoreIdHeaderName";
public static final String PROPERTY_DEFAULT_TENANT_ID = "fhirServer/core/defaultTenantId";
public static final String PROPERTY_DEFAULT_PRETTY_PRINT = "fhirServer/core/defaultPrettyPrint";

public static final String PROPERTY_SEARCH_PARAMETER_FILTER = "fhirServer/searchParameterFilter";

// Auth and security properties
public static final String PROPERTY_TRUSTSTORE_LOCATION = "fhirServer/core/truststoreLocation";
public static final String PROPERTY_TRUSTSTORE_PASSWORD = "fhirServer/core/truststorePassword";
public static final String PROPERTY_OAUTH_REGURL = "fhirServer/oauth/regUrl";
public static final String PROPERTY_OAUTH_AUTHURL = "fhirServer/oauth/authUrl";
public static final String PROPERTY_OAUTH_TOKENURL = "fhirServer/oauth/tokenUrl";

public static final String PROPERTY_AUTHFILTER_ENABLED = "fhirServer/authFilter/enabled";
public static final String PROPERTY_AUTHORIZED_CLIENT_CERT_CLIENT_CN = "fhirServer/authFilter/authorizedClientCertClientCN";
public static final String PROPERTY_AUTHORIZED_CLIENT_CERT_ISSUER_OU = "fhirServer/authFilter/authorizedClientCertIssuerOU";

// Audit config properties
public static final String PROPERTY_AUDIT_SERVICE_CLASS_NAME = "fhirServer/audit/serviceClassName";
public static final String PROPERTY_AUDIT_SERVICE_PROPERTIES = "fhirServer/audit/serviceProperties";
public static final String PROPERTY_AUDIT_PATIENT_ID_EXTURL = "fhirServer/audit/patientIdExtensionUrl";
public static final String PROPERTY_AUDIT_RESOURCE_NAME_EXTURL = "fhirServer/audit/resourceNameExtensionUrl";
public static final String PROPERTY_ENCRYPTION = "fhirServer/encryption";
public static final String PROPERTY_UPDATE_CREATE_ENABLED = "fhirServer/persistence/common/updateCreateEnabled";

// Notification config properties
public static final String PROPERTY_NOTIFICATION_RESOURCE_TYPES = "fhirServer/notifications/common/includeResourceTypes";
public static final String PROPERTY_WEBSOCKET_ENABLED = "fhirServer/notifications/websocket/enabled";
public static final String PROPERTY_KAFKA_ENABLED = "fhirServer/notifications/kafka/enabled";
public static final String PROPERTY_KAFKA_TOPICNAME = "fhirServer/notifications/kafka/topicName";
public static final String PROPERTY_KAFKA_CONNECTIONPROPS = "fhirServer/notifications/kafka/connectionProperties";

// Persistence layer properties
public static final String PROPERTY_PERSISTENCE_FACTORY = "fhirServer/persistence/factoryClassname";
public static final String PROPERTY_DATASOURCES = "fhirServer/persistence/datasources";
public static final String PROPERTY_JDBC_BOOTSTRAP_DB = "fhirServer/persistence/jdbc/bootstrapDb";
public static final String PROPERTY_JDBC_DATASOURCE_JNDINAME = "fhirServer/persistence/jdbc/dataSourceJndiName";
public static final String PROPERTY_JDBC_ENABLE_CODE_SYSTEMS_CACHE = "fhirServer/persistence/jdbc/enableCodeSystemsCache";
public static final String PROPERTY_JDBC_ENABLE_PARAMETER_NAMES_CACHE = "fhirServer/persistence/jdbc/enableParameterNamesCache";
public static final String PROPERTY_JDBC_ENABLE_RESOURCE_TYPES_CACHE = "fhirServer/persistence/jdbc/enableResourceTypesCache";
public static final String PROPERTY_TENANT_ID_HEADER_NAME = "fhirServer/core/tenantIdHeaderName";
public static final String PROPERTY_DATASTORE_ID_HEADER_NAME = "fhirServer/core/datastoreIdHeaderName";
public static final String PROPERTY_DEFAULT_TENANT_ID = "fhirServer/core/defaultTenantId";
public static final String PROPERTY_DEFAULT_PRETTY_PRINT = "fhirServer/core/defaultPrettyPrint";
public static final String PROPERTY_JSON_PARSER_LENIENT = "fhirServer/core/jsonParserLenient";
public static final String PROPERTY_JSON_PARSER_VALIDATING = "fhirServer/core/jsonParserValidating";
public static final String PROPERTY_DATASOURCES = "fhirServer/persistence/datasources";
public static final String PROPERTY_SEARCH_PARAMETER_FILTER = "fhirServer/searchParameterFilter";
public static final String PROPERTY_AUTHFILTER_ENABLED = "fhirServer/authFilter/enabled";
public static final String PROPERTY_AUTHORIZED_CLIENT_CERT_CLIENT_CN = "fhirServer/authFilter/authorizedClientCertClientCN";
public static final String PROPERTY_AUTHORIZED_CLIENT_CERT_ISSUER_OU = "fhirServer/authFilter/authorizedClientCertIssuerOU";

public static final String PROPERTY_RESOURCE_TYPES_REQUIRING_SUBJECT_ID = "fhirServer/whclsfRouter/resourceNamesRequiringPatientId";
public static final String PROPERTY_STUDY_SCOPED_RESOURCES = "fhirServer/whclsfRouter/resourceNamesRequiringConsentEnforcement";

// Custom header names
public static final String DEFAULT_TENANT_ID_HEADER_NAME = "X-FHIR-TENANT-ID";
public static final String DEFAULT_DATASTORE_ID_HEADER_NAME = "X-FHIR-DSID";
public static final String DEFAULT_PRETTY_RESPONSE_HEADER_NAME = "X-FHIR-FORMATTED";

public static final String FHIR_SERVER_DEFAULT_CONFIG = "config/default/fhir-server-config.json";


// Optional "home directory" for config files. Defaults to current directory.
private static String configHome = "";

Expand All @@ -86,8 +90,10 @@ public static FHIRConfiguration getInstance() {
/**
* This method is used to configure an explicit top-level directory where FHIR Server configuration
* information is expected to reside.
* <p>
* For example, by calling this method with value "/mydir", then we'd expect
* to find config files whose names are of the form: <code> "/mydir/config/&lt;tenant-id&rt;/fhir-server-config.json".</code>
* to find config files whose names are of the form: {@code "/mydir/config/<tenant-id>/fhir-server-config.json"}
* <p>
* The default location for config files is the current working directory (i.e. "" - the empty string).
* @param s the new config home directory name
*/
Expand All @@ -104,7 +110,8 @@ public static void setConfigHome(String s) {

/**
* Returns the "home" directory for FHIR Server configuration information (this directory will contain
* the "config" directory, etc.).
* the "config" directory, etc.).
* <p>
* The default value of this property is "" which is interpretted to mean the current working directory
* (which for a running FHIR Server will be $WLP_HOME/wlp/usr/servers/fhir-server).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,6 @@ public void testTenant5() throws Exception {
l = FHIRConfigHelper.getStringListProperty("collection/groupB/stringList1");
assertNotNull(l);
assertEquals(expectedList1, l);

PropertyGroup pg = FHIRConfigHelper.getPropertyGroup("whclsfRouter/config");
assertNotNull(pg);
assertNotNull(pg.getBooleanProperty("supportsTransaction"));
assertNotNull(pg.getArrayProperty("routingRules"));

b = FHIRConfigHelper.getBooleanProperty("whclsfRouter/consentEnforcementEnabled", null);
assertNotNull(b);
assertEquals(Boolean.TRUE, b);

b = FHIRConfigHelper.getBooleanProperty("whclsfRouter/consentManagementEnabled", null);
assertNotNull(b);
assertEquals(Boolean.FALSE, b);
}

@Test
Expand Down
Loading

0 comments on commit abb66b9

Please sign in to comment.