The FHIRcast Sandbox is a tool that allows users to simulate the workflow of the FHIRcast standard. It acts as a sort of "mock"-EHR or PACS that can be used as a demonstration and testing tool for showing how FHIRcast would work with subscribers.
You can develop on and run this project locally by using the following steps below. The projects consists of two parts:
First, install the .NET Core SDK.
In order to run the two webservers locally, run:
$ dotnet run --project Hub
to start the Hub, and
$ dotnet run --project WebSubClient
to start the WebSub client. On a Unix operating system you can also run both servers in the background using e.g.:
$ (dotnet run --project Hub &) && (dotnet run --project WebSubClient &)
and on Windows you can achieve the same thing like this in PowerShell:
> "$pwd\Hub" | Start-Job { dotnet run --project $Input } -Name Hub; "$pwd\WebSubClient" | Start-Job { dotnet run --project $Input } -Name WebSubClient
You can then start issuing HTTP requests to the server. Here's an example using curl that will create a subscription and cause the Hub to attempt to validate your callback url (as defined in my_url_encoded_callback
).
event='switch-patient-chart'
my_url_encoded_callback='http%3A%2F%2Flocalhost%3A1337'
topic='some_topic'
# Request a subscription on the hub.
curl -d "hub.callback={my_url_encoded_callback}&hub.mode=subscribe&hub.topic={topic}&hub.secret=secret&hub.events={events}&hub.lease_seconds=3600&hub.uid=untilIssueIsFixed" -X POST http://localhost:5000/api/hub
To stop the background servers, run:
For Unix:
$ pkill dotnet
For Windows:
> Stop-Job Hub, WebSubClient; Remove-Job Hub, WebSubClient
See the in progress Tutorial for a more detailed steps towards a hello world app. Feedback welcome (and needed)!
In order to launch the hub and the client using docker, use docker-compose from the root of the repository like so:
$ docker-compose up
This will build the docker containers and run the application on ports 5000 (for Hub) and 5001 (for the Client).
We welcome any contributions to help further enhance this tool for the FHIRcast community! To contribute to this project, please see instructions above for running the application locally and testing the app to make sure the tool works as expected with your incorporated changes. Then follow the steps below.
fhircast/sandbox
repository with your changes for review.