Method for tracking "As Needed" Medications?

I’m looking for a web-based medication manager that can monitor usage and send out alerts based on inventory before the next refill.
I take two medications on a daily basis. One I take twice a day on a regular schedule, while the other is prescribed on an “as needed” basis. The scheduled medication is easy enough to keep track of and set up reminders for. Of course I don’t really need to keep track of this prescription so much because all I have to do is look at the calendar to make sure I have enough before my next refill. Its the “as needed” script that causes me problems. I need to find a way to easily log when and how much I take while keeping track of how much I have left on my prescription.
I found a great TASKER recipe (at http://www.fourq.net/medication/) that I might use to trigger with an NFC tag on my pillbox to open a simple dialog on my smartwatch and log how much I took and when. So all that leaves is something to track how much I have left on my prescription and can send out a warning if I’m taking too much before my next refill.
The closest I came to finding a turnkey solution for this task was the “Dosecast” app for Android and iOS. It has almost all the features that I need except for a reasonable means of exporting the data in a way I can use to trigger custom actions. Of course, having control over my data is the #1 priority so the lack of export is a dealbreaker…
Since I can handle most of the inputs via Tasker, I’m thinking what I need is some kind of database from which I can set up notifications and alerts should I not have enough medications before my refill date.
Can anybody recommend a web-based service that can handle this requirment?

Update:
After much trial and error, I settled on http://medhelperapp.com/ as the one turnkey solution that comes closest to serving my needs. It has different tracking options for scheduled and as needed medications and data export via spreadsheet and html to email or Google Drive. My challenge now is finding a way to format the exported data into something useful. I created a Master spreadsheet on Google drive which I will update frequently from the export logs sent from the app. However, the app only logs the medication type, time and dosage into the spreadsheet format and what I need most is something that tracks daily usage against inventory before the next refill. Ideally, a notification can be generated from this data recommending daily dosage limits.
I can export the inventory data only in individual html format, so I either need to find a way to add this as another field in the master spreadsheet, or import everything into a separate service like Zenobase or https://quantimo.do/. The latter looks promising as it includes Med Helper in its list of supported inputs, but the Beta version doesn’t seem to have it set up yet. The Med Helper app also claims a cloud feature is “coming soon” but if I’m going to use a third party cloud service, I’d rather it be independent from the app that collects the data.
Does anybody have any suggestions for formatting data that was exported in html? Has anybody else tried “MedHelper”? Would it make more sense to hold out for something that supports .csv export?

How about a simple solution like Google docs for logging when “as needed” meds are taken?

Create a form with list of meds > link the form to the home screen on your phone > click submit every time meds are taken.

You can add some intelligence by adding the number of pills per prescription to the responses spreadsheet to alert you when you’re low via the GDocs Sheets alerts function.

I know this is a manual process, but is quick to use as a starting point. NFC, sensors, etc are neat, but I imagine hard to implement?