Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ranjancse26/truemd.net
TrueMD Restful .NET API
https://github.com/ranjancse26/truemd.net
Last synced: about 1 month ago
JSON representation
TrueMD Restful .NET API
- Host: GitHub
- URL: https://github.com/ranjancse26/truemd.net
- Owner: ranjancse26
- Created: 2016-01-07T12:11:10.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-08T19:04:34.000Z (almost 9 years ago)
- Last Synced: 2023-03-30T22:04:33.126Z (over 1 year ago)
- Language: C#
- Homepage: http://www.truemd.in/
- Size: 2.37 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TrueMD.NET
TrueMD Restful .NET APIInspired by Satyamev Jayate's Asar: Aamir Khan bats for generic medicines -
## Synopsis
A .NET Library for TrueMD (http://www.truemd.in/)
Built to consume TrueMD API. This library depends on JSON.NET (http://www.newtonsoft.com/json) for deserializing the JSON object.
Please read this blog for more info - https://www.quora.com/profile/Aayush-Jain-3/Posts/Let-me-show-you-a-magic-trick?srid=527C&share=1
http://www.truemd.in/api/documentation## Code Example
Here's the code sample. Before you do anything, make sure to create TrueMD API Key. You can register the same at http://www.truemd.in/api/new
Creating an instance of TrueMD API wrapper and make a call to the respective methods.
TrueMedAPI trueMedAPI = new TrueMedAPI(key);
private static void GetMedicineDetails(TrueMedAPI trueMedAPI, string brandName)
{
var medicineDetail = trueMedAPI.GetMedicineDetail(brandName);
DisplayMedicineInfo(medicineDetail.medicine);Console.WriteLine("\nDisplaying Constituents");
Console.WriteLine("***************************************");
foreach (var cons in medicineDetail.constituents)
{
Console.WriteLine("Id:"+cons.id);
Console.WriteLine("Name:" + cons.name);
Console.WriteLine("Quantity:" + cons.qty);
Console.WriteLine("Strength:" + cons.strength);
Console.WriteLine("Generic Id:" + cons.generic_id);
}
Console.WriteLine("***************************************");
}private static void GetMedicineAlternatives(TrueMedAPI trueMedAPI, string brandName)
{
var alternatives = trueMedAPI.GetMedicineAlternatives(brandName);
foreach(var alternative in alternatives)
{
DisplayMedicineInfo(alternative);
}
}
private static void DisplayMedicineInfo(Medicine medicine)
{
Console.WriteLine("***************************************");
Console.WriteLine("ID: " + medicine.id);
Console.WriteLine("Brand: " + medicine.brand);
Console.WriteLine("Category: " + medicine.category);
Console.WriteLine("Category: " + medicine.category);
Console.WriteLine("D Class: " + medicine.d_class);
Console.WriteLine("Generic ID: " + medicine.generic_id);
Console.WriteLine("Manufacturer: " + medicine.manufacturer);
Console.WriteLine("Price: " + medicine.package_price);
Console.WriteLine("Quantity: " + medicine.package_qty);
Console.WriteLine("Type: " + medicine.package_type);
Console.WriteLine("Unit Price: " + medicine.unit_price);
Console.WriteLine("Unit Qty: " + medicine.unit_qty);
Console.WriteLine("Unit Type: " + medicine.unit_type);
Console.WriteLine("***************************************");
}private static void GetMedicineInfo(TrueMedAPI trueMedAPI, string brandName)
{
var medicineInfo = trueMedAPI.GetMedicine(brandName);
foreach(var med in medicineInfo)
{
DisplayMedicineInfo(med);
}
}private static void GetSuggestions(TrueMedAPI trueMedAPI, string suggestionText)
{
var suggestions = trueMedAPI.GetMedicineSuggestions(suggestionText);
Console.WriteLine("***************************************");
foreach (var suggestion in suggestions)
{
Console.WriteLine(suggestion.suggestion);
}
Console.WriteLine("***************************************");
}
## MotivationThe main motivation behind this project is, as of today the .NET Library for TrueMD does not exist. Although it's not so challenging to create one, I would rather consider it as a fun project :)
## Installation
Just build the "TrueMDLib" library and then include as a reference to your application.
## API Reference
Please take a look into the below link to understand more about the TrueMD Restful API
http://www.truemd.in/api/documentation
## Tests
Don't have a unit test project for now. But the console application should do it's job.
## Contributors
The following are the list of contributors
1) Ranjan Dailata
## License
Apache
## Credits
The Generic drug database is being maintained by the TrueMD team :