Using git to contribute some code fixes

rpl121 wrote on Tuesday, November 15, 2011:

I’m an amateur with git and collaborative coding, but I do have several small code fixes that will be quite useful for users of 4.1.0.  Most of the changes involve just a line or two of code fixes, for which I can create diff files in comparison to the latest version of OpenEMR on the git repository.

I have git-core set up on my server, and I have printed out the “Using Git with OpenEMR” instruction sheet.   I am a bit baffled how to make my little changes and then send them somewhere so they can be considered for upcoming code patches.

Some of the little fixes are these:

1.  fix in clinical_rules.php so that CUSTOM:: and narrative titles  (such as coumadin, diabetes, HTN, warfarin) do not have to match exactly in order to capture a rule.  (switch from = to LIKE etc.)

2.  change in report printing so that reports are printable by default (avoiding the need for an extra repetitive step)

3.  change in report printing so that currently active diagnoses, immunizations, medications, allergies and treatments (“dental issues”) are ticked by default

4.  etc …

If somebody can hold my hand a little with git, I promise I’ll make myself useful.

Ron Leemhuis

yehster wrote on Tuesday, November 15, 2011:

Dr. Leemhuis,
I think the Git for dummies documentation is more useful…. It’s where I started.
http://www.oemr.org/wiki/Git_for_dummies

I’m paraphrasing what that doc says, but basically what you need to do is the following
Start by setting up a github account.
clone the master repository
I would do this in a directory that is *different* from your server files
git clone git@github.com:openemr/openemr.git

Then
cd openemr
create a branch for your fixes
git branch myBugFixes
git checkout myBugFixes

then make the modifications
(you  could copy the change files from your server directory back to this location)
stage the changes with
git add .
then commit
git commit

at this point your changes have been tracked.
To share them for review, you will do
git push git@github.com:<your github login>/openemr.git myBugFixes

Anyway, if you want, I would be happy to “hold your hand” on the phone if you have too much trouble.
-Kevin Yeh

rpl121 wrote on Wednesday, November 16, 2011:

Thanks, Kevin.  I followed your concise instructions and made some changes to /openemr/library/clinical_rules.php and then committed them to my github account  (rpl121).  It seemed to upload a lot of information, and I can see my upload on my github account.  Can somebody check to see whether this fix (I called it new-features because I didn’t know any better) is appropriate for the code?

If this method works, I can send some more fixes.

Ron Leemhuis

yehster wrote on Wednesday, November 16, 2011:

Dr. Leemhuis,
https://github.com/rpl121/OpenEMR
I see your newly created repository here, but I don’t see the code updates
When you did
git commit
did it show you that you had made a change to clinical_rules.php?

What happened when you did?
git push git@github.com:rpl121/openemr.git new-features

It won’t hurt anything to repeat these particular commands

The name of the branch itself doesn’t get incorporated into the “main repository” when it gets merged into the official repository, so calling it “new-features” is fine, everyone has their own naming style

git status
is another useful command to try.

rpl121 wrote on Wednesday, November 16, 2011:

Kevin, I think I uploaded the changes properly now, under a branch called myBugFixes in the rpl121 account of github.  At one step I failed to add a note at the appropriate place.  As it didn’t protest, I was not aware that was a problem.  Now I see my edit on github.

Ron Leemhuis

yehster wrote on Wednesday, November 16, 2011:

https://github.com/rpl121/OpenEMR/commit/4996f0ffb1c9a9033f6275b5ef69e26c0dcbcf36
https://github.com/rpl121/OpenEMR/tree/myBugFixes
I see them now.
Seems like a simple enough change.

rpl121 wrote on Wednesday, November 16, 2011:

I uploaded to rpl121 at github some more small fixes.  They are in myBugFixes tree.

Ron Leemhuis

bradymiller wrote on Thursday, November 17, 2011:

Hi,
Noticed that the other commits that you had there are now missing,
-brady

rpl121 wrote on Saturday, November 19, 2011:

Today I uploaded several minor bug fixes and enhancements this morning to my account rpl121 at github.  I tried first on 11/15/11 to do this, but they didn’t turn out exactly as I had hoped, so I did everything again from scratch.

bradymiller wrote on Saturday, November 26, 2011:

Hi,
Placed some comments on your github commits.
thanks,
-brady

rpl121 wrote on Saturday, November 26, 2011:

Thanks, Brady.  I agree with all your suggestions.  When I make changes in between seeing patients, I often stop when things start to work, even if they are not elegant or strictly correct.

However, try this on your installation of OpenEMR.  Go to a patient’s account and enter values for Exams/Tests on the Patient History/Lifestyle screen.  Pick one of the Exams/Tests fields and type in a long string of garbage characters for example, so the string is close to 255 characters in length.  You may be able to save it, but only if all the other characters in the other fields do not add up with this to exceed 255 characters or so.  That’s the problem. 

Ron Leemhuis