This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
#import "PatientTableViewController.h" | |
@implementation AppDelegate | |
@synthesize window = _window; | |
@synthesize managedObjectContext = __managedObjectContext; | |
@synthesize managedObjectModel = __managedObjectModel; | |
@synthesize persistentStoreCoordinator = __persistentStoreCoordinator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; | |
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; | |
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "DrugFetcher.h" | |
#import "/usr/include/sqlite3.h" | |
#import "Drug.h" | |
@implementation DrugFetcher | |
#define DATABASE_NAME @"drug_list.sqlite3" | |
+ (void) populateDrugsInManagedObjectContext:(NSManagedObjectContext *)context | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv, sys | |
lengths = {} | |
with open(sys.argv[1], 'rt') as f: | |
reader = csv.DictReader(f, delimiter='|') | |
for index, row in enumerate(reader): | |
if index == 0: | |
for heading in row.keys(): | |
lengths[heading] = 0 | |
for column in row.keys(): | |
if (len(row[column]) > lengths[column]): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_drugs3(file_path): | |
"this loads drugs from pipe delimited file with headers" | |
reader = csv.DictReader(file_path) | |
for row in reader: | |
drug = Drug(rxcui=row['Rxcui'], short_name=row['Short Name'], is_brand | |
= row['Is Brand']) | |
drug.save() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_drugs3(file_path): | |
reader = csv.DictReader(file_path) | |
for row in reader: | |
drug = Drug(rxcui=row['Rxcui'], short_name=row['Short Name'], is_brand | |
= row['Is Brand']) | |
drug.save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_drugs(request): | |
if request.is_ajax(): | |
q = request.GET.get('term', '') | |
drugs = Drug.objects.filter(short_name__icontains = q )[:20] | |
results = [] | |
for drug in drugs: | |
drug_json = {} | |
drug_json['id'] = drug.rxcui | |
drug_json['label'] = drug.short_name | |
drug_json['value'] = drug.short_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
//jquery autocomplete | |
$("#drugs").autocomplete({ | |
source: "/api/get_drugs/", | |
minLength: 2, | |
//select: function( event, ui ) { | |
//console.log( ui.id ? | |
//"Selected: " + ui.id + " aka " + ui.id : | |
//"Nothing selected, input was " + this.id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="ui-widget"> | |
<label for="drugs">Drugs: </label> | |
<input id="drugs"> | |
</div> |