WIP: Initial version of automatic patient synchronization functionality
I abstained from running this thing in periodical clockwork fashion, since it is way too early for that. There is a rake task instead, which relies on a set of assumptions:
- the user one sets in
SYNC_USER_EMAIL
belongs to both Eurvalve_research and Cyfronet group - the production token is used
- everything is run in
development
ENV (running this inproduction
env should, certainly, NOT be done on your local machine).
This way Patient DB records are created locally but patient file structures are created in production FileStore inside the development
folder. So this is ok for careful testing.
Specs are run against development FileStore and mock the DataSets (ArcQ) server completely.
The one-time user creation inside the rake task is tested locally, yet it cannot be tested completely this way, since we don't have the correct user on production and hence the sync user will not be able to ask ArcQ for data (production PDP approval required).
The ArcQ query used to get the "ready" patients has very weak correlation with what is actually inside the TrailConnect import directory. This needs further work together with T2.1 people.
@mkasztelnik Marek, this waits for your attempt at fixing the COPY operation on Webbs. It, perhaps, should also wait until we get some more useful query from Steven Wood, if such a query exists. But you can look at the code right now if you'd like to test it and give improvement comments.