LibreHealthIO / lh-ehr

LibreHealth EHR - Free Open Source Electronic Health Records
Other
234 stars 257 forks source link

Updater for Libre EHR #1120

Open naveen17797 opened 6 years ago

naveen17797 commented 6 years ago

To develop an updater for libre ehr which uses github api for updating the application The rate limit for github api is 5000 calls per hour, thats the only disadvantage we have, i hope the updater will be optimized to not exceed 5000 calls open for suggestion @teryhill @aethelwulffe @nileshprasad137 @tmccormi

tmccormi commented 6 years ago

If that means "overall number of requests" from the entire installed base, i don't think that will be an issue. No reason to update a clinical site very frequently. Checking for security patches is something to consider the frequency of, however

tmccormi commented 6 years ago

Should make the source repo configureable, of course, to support customized versions.

naveen17797 commented 6 years ago

@tmccormi the updater also proposes a way to test pull requests, ie in developer mode (which may exceed 5000 requests ) there are two modes in updater 1.user mode (updates the application and does normal stuff) 2.developer mode ( used to test the pull requests) more info on it can be found here https://summerofcode.withgoogle.com/serve/6702835723403264/

aethelwulffe commented 6 years ago

Response for GET /rate_limit: Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4992 X-RateLimit-Reset: 1526319998

{
  "resources": {
    "core": {
      "limit": 5000,
      "remaining": 4999,
      "reset": 1526301234
    },
    "search": {
      "limit": 30,
      "remaining": 18,
      "reset": 1526319998
    }
  }
}

To note, "core" replaces the deprecated "rate" object. Check to see if you are using it. I don't think the rate limit will hurt us.

naveen17797 commented 6 years ago

@aethelwulffe just assuming all possible scenarios to make some validations inside the updater.And also able to adapt if github changes its rate limit, so i will try to use less calls as possible

aethelwulffe commented 6 years ago

Some of us may have...um, more than one account. That works too. And if you can just send requests by a zombienet proxy, you can get 60 anonymous calls per IP.... 😼 SO: Incremental updates need to watch the X-RateLimit-Remaining, and the time to reset. BUT: You can make Conditional Requests, and that should be the preferred method for all requests. https://developer.github.com/v3/#conditional-requests This gets you around a lot of potential time/volume issues.

naveen17797 commented 6 years ago

yep,i think a user access token would do fine for all the normal users, But my updater should be flexible if the rate limit was exceeded(wait until the limit gets removed) and should not update until all the changed files are obtained via API,so preventing application damage ( this wont mostly occur since we are not going to 25% of the rate limit, i believe)

naveen17797 commented 6 years ago

can you add label as gsoc?

teryhill commented 6 years ago

I ran a test on this by merging a pr and it updated my repo with the pr. This is neater that grits on Sunday.

teryhill commented 6 years ago

@tmccormi , @aethelwulffe y'all need to download it and test it. Currently you have to create 2 directories downloads and backup in the updater directory but @naveen17797 is going to put a readme file in those directories so git will pick them up.

naveen17797 commented 6 years ago

@teryhill i made the commit for it, they are no longer need to be created

tmccormi commented 6 years ago

Will try and mess with this later.

Tony McCormick Medical Information Integration

On Fri, Jun 8, 2018, 9:23 PM naveen notifications@github.com wrote:

@teryhill https://github.com/teryhill i made the commit for it, they are no longer need to be created

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LibreHealthIO/lh-ehr/issues/1120#issuecomment-395938572, or mute the thread https://github.com/notifications/unsubscribe-auth/AARci-iFkbgRqj9DQTHMVzn-Qn6PkhBUks5t603MgaJpZM4T98zi .

-- Please be aware that e-mail communication can be intercepted in transmission or misdirected. Please consider communicating any sensitive information by telephone.  The information contained in this message may be privileged and confidential. If you are NOT the intended recipient,

please notify the sender immediately with a copy to  hipaa-security@mrsb-ltd.com mailto:hipaa-security@mrsb-ltd.com and destroy this message.

aethelwulffe commented 6 years ago

I have run this, and figured out the create directory stuff. The better option is to have it create the directories with an appropriate chmod (which works for anything) at runtime after checking to see if they exist.

aethelwulffe commented 6 years ago

This is more like "Fried catfish on grits and a side of mango chutney."

tmccormi commented 5 years ago

@naveen17797 @aethelwulffe not having any luck figuring our how this this is supposed to work. We need a README doc in the documentation directory at least on how to set this up so it works. The github API token video is not enough... :-)

For instance what does this mean? I clone the master and it's running as normal in var/www . permissions

muarachmann commented 5 years ago

@naveen17797 , @tmccormi I remember telling naveen to make an alert to the user so that they can know its a file permission and they chmod. We could include this in the setup process so that users don't encounter this error in feature. @aethelwulffe what do u think

On Wed, Oct 3, 2018, 20:58 Tony McCormick notifications@github.com wrote:

@naveen17797 https://github.com/naveen17797 @aethelwulffe https://github.com/aethelwulffe not having any luck figuring our how this this is supposed to work. We need a README doc in the documentation directory at least on how to set this up so it works. The github API token video is not enough... :-)

For instance what does this mean? I clone the master and it's running as normal in var/www . [image: permissions] https://user-images.githubusercontent.com/285835/46435757-f8f25980-c70b-11e8-9bdd-eb1fe9c91216.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LibreHealthIO/lh-ehr/issues/1120#issuecomment-426779117, or mute the thread https://github.com/notifications/unsubscribe-auth/APl-XsOd6_93AaxFsPmmn0Ysp7HQiLAkks5uhRb2gaJpZM4T98zi .

tmccormi commented 5 years ago

The alert exists, but it does not say what files have permission issues ...

muarachmann commented 5 years ago

yeah i remember telling him this in the chat. @naveen17797 you could create a dialog box beneath to explain more on the error. Just like you did for invalid token so that user knows

aethelwulffe commented 5 years ago

so who's permission is it trying to use? I would have assumed www-data in the typical case. There is apparently an issue with that.

naveen17797 commented 5 years ago

Wondering why i didnt get email notification on this thread from github.Just navigated to github home page and saw this thread was active before 8 days. @tmccormi like adding instruction below each option?

tmccormi commented 5 years ago

@naveen17797 Something, I still have not been able to make it work at all. very unclear what I'm supposed to do. for instance: Does the install have to run out of the git clone? (not what I normally do at all).

tmccormi commented 5 years ago

The video only references getting a git API Token. Does it assume that repo is my fork or the master upstream? Could we use a generic anonymous user token (doctors offices are not going to have github accounts)

tmccormi commented 5 years ago

Simple written, step by step instructions on how a developer should install the code and get the updater running would be good. Videos are not as much use as just a document

naveen17797 commented 5 years ago

@tmccormi the updater cant work properly without the github user access token, because the rate limit for the github api is 60 calls per hour without token,It would probably cause the updater to break the libre-ehr installation. "generic anonymous user token" yes this is a possibility, but we should route all the api calls to libreehr server (currently it is directly making calls to api.github.com), in the server we could use the tokens to provide the response.But it can increase server load and if spammers/bot find out this endpoint they could exploit it.So we need to provide accesstoken from libre ehr server (In either way we need to provide access token to the users )

naveen17797 commented 5 years ago

Does it assume that repo is my fork or the master upstream? Every update is made from this repo https://github.com/LibreHealthIO/lh-ehr you can adjust the endpoint in settings.json and tell the updater to point to which repo, for example if you need to point to your forked repo, you can edit the following details.

{ 
"owner":"tmccormi",
"repository_name":"lh-ehr"
}