Thanks for using the forum. I am happy to address your questions, and my answer will be based on the information you provided here. Please make sure you recognize that this forum is for educational purposes only, and it does not substitute for a formal office visit with a doctor.
Without the ability to examine and obtain a history, I can not tell you what the exact cause of the symptoms is. However I will try to provide you with some useful information.
I am not able to answer your question appropriately. I think you would be better served submitting the question in the urology forum. The pain you are mentioning may be due to an rib dysfunction that could be diagnosed and treated by an osteopathic physician. However, if you have not had an evaluation of your urine (i.e., urinalysis), you should have one performed to evaluate for infection and perhaps a kidney ultrasound. I would be concerned for a pyelonephritis given your symptoms. Please follow up with an urologist.
Thank you for this opportunity to answer your questions, I hope you find the information I have provided useful, good luck.