Git Product home page Git Product logo

nhsconnect / gpconnect-demonstrator Goto Github PK

View Code? Open in Web Editor NEW
16.0 15.0 9.0 30.87 MB

GP Connect demonstrator is a reference implementation of a GP Connect providing system and a consumer system demonstration

Home Page: https://orange.testlab.nhs.uk/

License: Apache License 2.0

Java 49.38% HTML 31.35% JavaScript 14.12% CSS 2.12% Dockerfile 0.14% SCSS 2.88%
nhs nhs-digital gpconnect gpconnect-demonstrator fhir

gpconnect-demonstrator's Introduction

GP Connect Demonstrator

This README contains information related to developing, building and running the GP Connect Demonstrator.

Requirements

To develop and run the application locally you must have the following installed:

Component Description
Git A revision control system.
NodeJS An open source, cross-platform runtime environment for developing JavaScript applications.
Java JDK 8 The Java Development Kit, which includes the Java Runtime Environment (JRE).
Maven 3 A popular Java build tool.
MySQL An open source RDBMS.

Getting started

First, download the code from GitHub. This can be done using the desktop git tool, an IDE which supports git or by downloading the code as a zip file which you can then extract.

Next, install the dev tools and dependencies....

Installation of Development Tools and Dependencies

Install Git for Windows:

Install official git release: https://git-scm.com/download/win

Or install GitHub Desktop which also includes a GUI interface for git management: https://desktop.github.com/

Install NodeJS:

https://nodejs.org

Install Java Development Kit 8:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Install Maven 3:

https://maven.apache.org/download.cgi

Environment Variables

Ensure that the system environment variables for Java and Maven are set correctly, as described below...

M2_HOME should point to the install directory of your local Maven install folder, e.g.

M2_HOME C:\Maven\apache-maven-3.3.9

JAVA_HOME should point to the install directory of your local Java JDK install folder, e.g.

JAVA_HOME C:\Program Files\Java\jdk1.8.0_121

PATH should contain the bin directory of both M2_HOME and JAVA_HOME, e.g.

...;%JAVA_HOME%\bin;%M2_HOME%\bin;...

Installation of the MySQL database

Use the MySQL Installer (http://dev.mysql.com/downloads/installer) to install:

  • MySQL Server
  • MySQL Workbench
  • MySQL Notifier

When using the Windows installer above, the PATH variables are automatically set.

Create the database schema and user locally by executing the following script:

{projectRoot}/config/sql/create_database.sql

Note: All other scripts in this directory will be run (order defined in sql_script_run_order.info) each time the application starts. This means you'll get a fresh instance with default content each time. If you want the database state to persist between boots, change the 'database.reset' property to false (described later) however be aware that if the database schema is modified you may run into problems, so only do this if you know what you're doing!

Environment configuration

Some settings are specific to the environment the application is running on e.g. database username/password/location.

The environment specific files can be found in:

{projectRoot}/config

You are welcome to use these configuration files in situ, however we ask that any changes made are not committed back to GitHub, unless you're adding a new property. Instead you may wish to copy this entire directory to another location on your machine and point your application to the copied files (how to do this is covered later).

Environment properties are defined in 'gpconnect-demonstrator-api.properties'. If you need to modify any of these properties for your environment, it is recommended you create a new file called 'gpconnect-demonstrator-api.environment.properties' and set the overriding properties in here, as the contents of this file will take precedence over 'gpconnect-demonstrator-api.properties'.

Installing front end packages

NOTE: There is a problem with the latest version of 'npm' so you may need to revert you npm version to '4.5.0'!

npm install -g [email protected]

Install Grunt, the JavaScript task runner (you may need to be root user):

npm install -g grunt-cli bower

Navigate to the webapp folder of the GPConnect project and install dependencies:

cd {projectRoot}/webapp
bower install
bower update
npm update

Building the front end

Run the build task within the webapp directory of the project.

cd {projectRoot}/webapp
grunt build

The build task minifies and uglifies the front end code in the webapp directory of the project, and packages it up in the gpconnect-demonstrator-api module under the following directory:

{projectRoot}/gpconnect-demonstrator-api/src/main/webapp

Running the application

Note: If you have not performed the 'Building the front end' task, there will be no UI in the project!

Use maven to build the project:

cd {projectRoot}
mvn clean package

If working in an IDE you could run the following mvn task

spring-boot:run -Dserver.port=19191 -Dconfig.path=<path_to_config>\

To start with non-SSL on http://localhost:19191 and SSL on https://localhost:19192:

java -jar gpconnect-demonstrator-api\target\gpconnect-demonstrator-api.war --server.port=19192 --server.port.http=19191 --config.path=config\ --server.ssl.key-store=config\server.jks --server.ssl.key-store-password=password --server.ssl.trust-store=config\server.jks --server.ssl.trust-store-password=password --server.ssl.client-auth=want

If you're experiencing build errors, execute the following commands:

java -version
mvn --version

If they do not return a suitable response, ensure that the system environment variables described above are pointing to the correct install directory, and that the \bin directories within them are on your PATH system environment variable.

Developing the front end

When developing the UI, it's best to run it separately to the back end. To do this, use the following commands:

cd {projectRoot}/webapp
grunt serve

This will run the UI on http://localhost:9000

Any changes to the front end code will be watched and re-served immediately for quick development.

Slots

The "config/slots.txt" file determins the default appointment slots available when using the appointment booking functionality.

The row format of “slots.txt” is:

  • Number of days from current date.
  • Start Hour (0-23)
  • Start Minute (0-59)
  • Start Seconds (0-59)
  • End Hour (0-23)
  • End Minute (0-59)
  • End Seconds (0-59)
  • Slot Type Code
  • Slot Type Description
  • Practitioner internal ID
  • Slot status (FREE/BUSY)
  • Bookable by Gp Connect
  • Bookable organization id
  • Bookable organization type
  • Delivery Channel (0..1 T|V|P) [ T : Telephone, V : Video, P : In-person ] )

e.g.:

0,9,0,0,9,30,0,408443003,General medical practice,2,FREE,false,1,,T
0,9,30,0,10,0,0,408443003,General medical practice,2,FREE,true,1,,V
0,10,0,0,10,30,0,408443003,General medical practice,2,FREE,true,1,urgent-care,P

Currently slots from 09:00 to 17:00 are available to any organisation or type. Slots from 17:00 to 17:50 on day + 1 are either restricted to organisation A20047 (logical id 7) or to Urgent Care/GP Practice or both organisation and type. See the slots.txt for specific details.

Data clear down

For Appointments and Tasks there is a clear down process which is scheduled using the "datasource.cleardown.cron" property. When the task runs it will delete all GP Connect Demonstrator Tasks previously added. It will also delete all Appointments and remove the currently available slots. It will then refresh the available slots using the "slots.txt" sample data file.

This clear down process will also run each time the application starts.

Local endpoint lookup configuration

There is the concept of federated practices within the GP Connect Demonstrator, controlled by the “config/providerRouting.json” file. This file contains configuration for the local system ASID, the path the demonstrator will use to call the spine proxy service as well as information for the federated practices if you wish to override the response from the LDAP server or run the demonstrator without connection to an LDAP server.

In the WAR file there is a “defaultPracticeOdsCode.html” which contains the default practice ODS code for the instance of the GP Connect Demonstrator. This ODS code will be used to lookup the practice details within the “providerRouting.json” file.

Conformance to the GP Connect specification

In some areas the demonstrator does not conform to the GP Connect specification in that it does not pass all of the tests in the specification conformance test suite (https://github.com/nhsconnect/gpconnect-provider-testing/wiki).

Each failing test is documented below by feature area

Feature: Search for free slots
Scenario Reason for non-conformance
I perform a getSchedule with invalid end date and or start date parameters The Hapi FHIR Java library interprets blank/empty String params as null as opposed to passing the data direct to the demonstrator. Since the values are null the code falls into a different block of logic, one designed to return a 400 instead of a 422 as would be the case if the blank values were passed through uninterpreted .
ENJOY!

gpconnect-demonstrator's People

Contributors

adamw902 avatar chrisbloe avatar damian-answ avatar danielledanderson avatar gforbes avatar haydenanswer avatar james-answer avatar joehoughton avatar jonnyry avatar lucywilcock avatar mcajhill avatar murat-kuyluk avatar saurabhkjain avatar simonfarrownhs avatar tgmay avatar webdevwilk avatar wilkinsm avatar wweatherill-answer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpconnect-demonstrator's Issues

Access Record - Structured: PatientResourceProvider

Access Record - Structured is being implemented in V1.0.0.

The PatientResourceProvider will need to be changed to handle the /Patient/$gpc.getstructuredrecord-1 request. This should handle requests for the allergy and medications section of the patient record. Building up the data for the bundle will be handled in a different issue.

This should include all necessary validation, including (but not limited to) patient and NHS number validation, illegal parameter checks, start/end date validation.

Updates for 1.1.0 of the spec

  1. Add the example of new searchFilter parameter to the demonstrator as outlined here:

Enhanced slot filtering -
https://developer.nhs.uk/apis/gpconnect-1-1-0/appointments_use_case_search_for_free_slots.html

We should have examples for two example Org ODS codes and the two types of org type from the value set. It might be worth adding the ODS codes to the README.md so it is recorded somewhere.

  1. On the returned schedule we need to populate the new practitioner role and delivery channel extensions:

https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-Schedule-1

We probably want to setup two or three schedule to be returned with different combinations of practitioner role and delivery channel.

Front end not showing detail of appointment at federated practice

If you book two appointments the first at the main practice and then the second at practice 2 the first federated practice, if you select the appointment in the list to view the details it always shows the first appointment details even when you click on the second appointment in the list.

Remove the extra meme types,

Remove the extra meme types, spec is going to be updated for version 1.0.0 and 1.1.0

Servers should also support DSTU2 MIME-types for backwards compatibility:

Servers SHALL support JSON: application/json+fhir
Servers SHOULD support XML: application/xml+fhir

Servers should also graceful handling generic XML and JSON MIME types:

Servers SHALL support JSON: application/json
Servers SHALL support JSON: text/json
Servers SHOULD support XML: application/xml

Put strict validation to only allow:
XML: application/fhir+xml
JSON: application/fhir+json
To make sure consumers send correct ones.

Structured Record - Medications: Bundle

The Medications section of Access Structured Record will be implemented in GpConnect 1.2.0.

The data needs to be returned as a searchSet bundle and should include patient, practitioner and organiser data.

The bundle needs to be built up when the call is sent. The call itself will be handled in issue 31. This task is to create the bundle with the data from the patient record.

Remove JWT claim "requested_record"

We need to remove the "requested_record" JWT claim from the frontend of the demonstrator and the validation in the backend of the demonstrator. This change applies to the following versions of the specificaiton:

1.0.0
1.1.0

The claim can be seen in the old 0.5.0 version of the spec:

https://developer.nhs.uk/apis/gpconnect-0-5-0/integration_cross_organisation_audit_and_provenance.html

but is no longer in the specification from 1.0.0 onwards:

https://developer.nhs.uk/apis/gpconnect-1-0-0/integration_cross_organisation_audit_and_provenance.html

Linked to test suite update nhsconnect/gpconnect-provider-testing#32

Structured Record - Allergies: Front End

A new page will need to be created for the Structured Record: Allergies section of the demonstrator. This will need the html and service and controller writing.

The page should send the getstructuredrecord (/Patient/$gpc.getstructuredrecord-1) request for the allergies section and display the data that is returned.

The backend will be developed separately.

For organization read it is not returning all site codes

When a read of an organization is done it does not return all site codes if there is more than one site code, we need to check that this is represented in the demonstrator back end and if so that it is represented in the returned resource.

It would be worth checking the organization search as well.

Issues with the TPP HTML examples in the Demonstrator

The Patient Summary section for TPP patient has the following problems:

  • Patient Summary Section has Key Indicators, Warnings, Investigations and Recalls which are out of scope for Stage 1
  • Patient Summary Section Active Probs has table layout for Current Repeat Medications and vice versa
  • Patient Summary Section Current Med Issues missing columns
  • Investigations still on left hand menu

Structured Record - Allergies: Database

Allergies will be implemented in the backend for the new Access Record - Structured.

Allergy entities already exist as leftovers from the HTML Record capability in V0.5.0. These should be reviewed and either deleted and recreated or altered to fit the new requirements.

Also review the data that is added into these entities for display in the front end and alter as required.

Demonstrator improvements

When viewing a booked appointment the following should be shown where available:

  • Cancellation reason, was origionally included on the appointment details view but seems to have gotten removed.
  • We should include the practitioner role and delivery channel to the appointment details view page.

Demonstrator improvements for swagger

So there is data to be retrieved by the Swagger definition can we do the following:

  • After the cleardown of appointments and slots overnight can we book two new appointments for patient "9476719931". If we can force the appointments created to have fixed logical ID that would be useful for the swagger read appointment example.

0.5.0 - Incorrect error when request is invalid

If you send an Access Record HTML request to the 0.5.0 demonstrator where the system for the section is incorrect the response says "Patient not found" which is incorrect and missleading for consumers testing against it.

The code needs updating to send back a correct error code when the system for the section is wrong. It would be worth checking that the other parameters when sent incorrectly return an accurate error code and description.

Look at adding swagger back into demonstrator

There is some drive to have a swagger defintion for the GP Connect API and it might be easiest to modify the demonstrator to generate a swagger definition and/or expose a swagger-ui, so that this can be linked from the specificaiton. The old swagger definition was removed as it did not work for the HAPI FHIR annotations so this will need changing.

Search for free slots - practitioner reference

The practitioner reference is still coming through as an extension on the schedule resource when it should now be an actor. This needs changing in the backend and frontend of the demonstrator.

OperationOutcome resource within a resource bundle is missing most of the mandatory fields

The OperationOutcome resource within a resource bundle is missing most of the mandatory fields

Response.xml FAIL "OperationOutcome Profile NOT as expected"
Failed -- Xpath $OperationOutcome/meta/profile/@value returned "" when "http://.nhs.net/StructureDefinition/gpconnect-operationoutcome-1" was expected

Response.xml FAIL "OperationOutcome Issue Code NOT as expected"
Failed -- Xpath $OperationOutcome/issue/code/@value returned no match

Response.xml FAIL "OperationOutcome Issue Details NOT as expected"
Failed -- Xpath $OperationOutcome/issue/details returned no match

Response.xml FAIL "OperationOutcome Issue Details Coding NOT as expected"
Failed -- Xpath $OperationOutcome/issue/details/coding returned no match

Response.xml FAIL "OperationOutcome Issue Details Coding System NOT as expected"
Failed -- Xpath $OperationOutcome/issue/details/coding/system/@value returned "" when "http://.nhs.net/ValueSet/gpconnect-error-or-warning-code-1" was expected

Response.xml FAIL "OperationOutcome Issue Details Coding Code NOT as expected"
Failed -- Xpath //issue/details/coding/code/@value returned no match

Response.xml FAIL "OperationOutcome Issue Details Coding Display NOT as expected"
Failed -- Xpath //issue/details/coding/display/@value returned no match

Response xml contains Patient/Practititioner/Organization/Composition and the OperationOutcome

        <entry>
                    <resource>
                                <OperationOutcome>
                                            <issue>
                                                        <severity value="error"/>
                                                        <diagnostics value="No data available for the requested section: AdministrativeItems"/>
                                            </issue>
                                </OperationOutcome>
                    </resource>
        </entry>

Stub responder functionality - Low Priority

It has been reqeuested to add stub responder fuctionality to the demonstrator, where a specific valid request will result in a specific response.

It would be good if this could be simply configured for any endpoint and filter on any element within the request, returning a set response from a file or something.

Structured Record - Medications: Database

Medications will be implemented in the backend for the new Access Record - Structured.

Medication entities already exist as leftovers from the HTML Record capability in V0.5.0. These should be reviewed and either deleted and recreated or altered to fit the new requirements.

Also review the data that is added into these entities for display in the front end and alter as required.

Appointment Reason

The spec is being uplifted to specifically state that the appointment reason should not be included in the appointment for Read/Retrieve/Book.

nhsconnect/gpconnect#395

The demonstrator needs updating to:

  • not return an appointment reason for Read and Retrieve.
  • to errors if the appointment Reason is included in the appointment when booked.

Update location test data

The location should contain a name and address, this should be reflected on the UI for the demonstrator to make it clear what information will be returned from the provider.

ReadMe contains invalid run commands

The readme file specifies three ways of running the demonstrator via command line. Whilst setting up the project, developers were confused as two of the commands are now invalid given the demonstrator requires two ports to be specified. The commands should be removed from the read me.

The valid command is : java -jar gpconnect-demonstrator-api\target\gpconnect-demonstrator-api.war --server.port=19192 --server.port.http=19191 --config.path=config\ --server.ssl.key-store=config\server.jks --server.ssl.key-store-password=password --server.ssl.trust-store=config\server.jks --server.ssl.trust-store-password=password --server.ssl.client-auth=want

https enabled without mutual auth

Currently if the demonstrator is running on https it requires mutual authentication with a cert from the consumer. We have been asked if it can run on https without mutual auth so that the demonstrator can be linked through from the swagger definition Jonny is creating which runs on https.

The best solution would probably be to check the client auth parameter to see if it is false, if so the client certificate checks can be skipped, allowing the demonstrator to run over https without client authentication.

Change to "Retrieve a patients appointments" search parameters and error handling

There is a change to the search parameters for the "Retrieve a patients appointments" request. We need to update the demonstrator with the new requirements and remove the no longer supported version of the search prefixes, adding error handling. This should be changed for both the 1.0.0 and 1.1.0 versions of the demonstrator.

The changes in the spec are described below and there is a Netlify link to a draft of the changed spec:

https://gpconnect-retrieve-app-change.netlify.com/appointments_use_case_retrieve_a_patients_appointments.html

The original requirements were that providers:

  • SHALL support the search prefixes eq, gt, lt, ge and le
  • SHALL consider no search prefix to be the same as including the eq search prefix
  • SHALL support the following combinations of start date search parameters
    • No search parameter
    • One search parameter with either the “eq” or “” search prefix
    • One search parameter with either the “gt” or “ge” search prefix
    • One search parameter with either the “lt” or “le” search prefix
    • Two search parameters, one “gt” or “ge” prefixed parameter and one “lt” or “le” prefixed parameter
  • SHALL only return appointments in the future so possibly return an empty bundle if the consumer requested appointments in the past.

There was no guidance for a consumer or any specific guidance for a provider relating to what should be considered an error.


The new requirements would be:

The consumer

  • SHALL always send two start search parameters. One will be prefixed with the search prefix le demoting the upper boundary, the other will be prefixed with ge denoting the lower boundary for the search date range.
  • The Date parameters SHALL only contain the date element and SHALL NOT contain a time element. For example, "start=ge2018-03-05" is correct but "start=ge2018-03-05T12:34" is not valid
  • Enhanced guidance that consumer should indicate to the user that they are not able to see appointments in the past.

The provider:

  • SHALL return an error if any of the requested date range is in the past, the error SHALL contain a clear message telling the consumer the issue is that they requested a date range in the past.
  • As the resolution of the request parameter is the date and not the time the validation should only be on the date, so if the request includes today’s date it should include the appointments for today, pending agreement from IG.

Structured Record - Medications: Front End

A new page will need to be created for the Structured Record: Medications section of the demonstrator. This will need the html and service and controller writing.

The page should send the getstructuredrecord (/Patient/$gpc.getstructuredrecord-1) request for the medications section and display the data that is returned.

The backend will be developed separately.

Issue with search for free slots and "_include" not working properly

An issue was raised as per below:

I am making a call to your demonstrator where I want it to return free slots. I would like it to return extra info as well to avoid another trip.

The REST url I am using is:

Slot?start=ge2018-02-01T00:00:00+00:00&end=le2018-02-15T00:00:00+00:00&fb-type=free&_include=Slot:schedule&_include:recurse=Schedule.actor:Practitioner&_include:recurse=Schedule.actor:Location

…this returns a Bad Request even though it complies with the format/parameters given in your docs.

A more simple request:

Slot?start=ge2018-02-01T00:00:00+00:00&end=le2018-02-15T00:00:00+00:00&fb-type=free&_include=Slot:schedule

…works fine.

Allergies Bundle: End date

Resolved allergies are required to have an end date and, where applicable, an end reason. This should be added as part of the allergyIntolerance resource.

No Validation for JWT Content

The content of the JWT is not validated against the requirements. The fhir resource id's are validated but the timestamps, fhir resources and additional claims are not checked to see if they are valid and conform to the specification.

Access Record - Structured: Allergy Bundle

The allergy section of Access Structured Record will be implemented in GpConnect 1.0.0.

The data needs to be returned as a searchSet bundle and should include patient, practitioner and organiser data.

The bundle needs to be built up when the call is created. The call itself will be handled in issue 31. This task is to create the bundle with the data from the patient record.

Update metadata endpoint to match spec changes

The spec was updated with requirements to follow the example as a template and to include the spec version in the Conformance/CapabilityStatemnt. We need to update the metadata endpoint to return the additional information and try to match the spec. It is currenty generated so we will either need to overwrite stuff or change it to a hard coded response.

https://developer.nhs.uk/apis/gpconnect-0-5-0/foundations_use_case_get_the_fhir_conformance_profile.html

&

https://developer.nhs.uk/apis/gpconnect-1-0-0/foundations_use_case_get_the_fhir_capability_statement.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.