<commit_before>/**
 * @tag models, home
 * Wraps backend med services.  Enables 
 * [SmartMedDisplay.Models.Med.static.findAll retrieving],
 */
SmartMedDisplay.Models.rdfObject.
extend('SmartMedDisplay.Models.Med',
/* @Static */
{
	get: function(success, error){
		SMART.MEDS_get_all(	
					this.callback([this.saveRDF, success])
				);  
	},
	
	post: function(data, success, error){
		SMART.MEDS_post(data, success);  
	},
	

	put: function(data, external_id, success, error){
		SMART.MED_put(data, external_id, success);  
	},


	delete_all: function(success, error){
		SMART.MEDS_delete(success);  
	},
	delete_one: function(uri, success, error){
		SMART.MED_delete(uri, success);  
	},


	object_type: "sp:medication",
	instantiateByType: function() {
		
		if (this.rdf === undefined || !this.rdf instanceof jQuery.rdf)
			throw "rdfToMeds needs a jquery.rdf to work with!";
		
		var ret = []
		           
		this.rdf.prefix("sp","http://smartplatforms.org/");
		this.rdf.prefix("med","http://smartplatforms.org/medication#");
		this.rdf.prefix("dcterms","http://purl.org/dc/terms/");
		this.rdf.prefix("dc","http://purl.org/dc/elements/1.1/");
		       		
		var t1 = new Date().getTime();

		var r = this.rdf.where("?med rdf:type "+this.object_type)
			 .where(" ?med dcterms:title ?medlabel")
			 .optional(" ?med med:strength ?strength")
			 .optional(" ?med med:strengthUnits ?strengthUnits")
			 .optional(" ?med med:form ?form")
			 .optional(" ?med med:drug ?cui")
			 .optional(" ?med med:dose ?dose")
			 .optional(" ?med med:doseUnits ?doseUnits")
			 .optional(" ?med med:route ?route")
			 .optional(" ?med med:instructions ?notes")
			 .optional(" ?med med:frequency ?freq")
			 .optional(" ?med med:startDate ?sd")
			 .optional(" ?med med:endDate ?ed");
		
		var t2 = new Date().getTime();
		alert("found all meds in " + (t2-t1) + ".");<commit_msg>Draw medlist faster. (Strip debugging)<commit_after>/**
 * @tag models, home
 * Wraps backend med services.  Enables 
 * [SmartMedDisplay.Models.Med.static.findAll retrieving],
 */
SmartMedDisplay.Models.rdfObject.
extend('SmartMedDisplay.Models.Med',
/* @Static */
{
	get: function(success, error){
		SMART.MEDS_get_all(	
					this.callback([this.saveRDF, success])
				);  
	},
	
	post: function(data, success, error){
		SMART.MEDS_post(data, success);  
	},
	

	put: function(data, external_id, success, error){
		SMART.MED_put(data, external_id, success);  
	},


	delete_all: function(success, error){
		SMART.MEDS_delete(success);  
	},
	delete_one: function(uri, success, error){
		SMART.MED_delete(uri, success);  
	},


	object_type: "sp:medication",
	instantiateByType: function() {
		
		if (this.rdf === undefined || !this.rdf instanceof jQuery.rdf)
			throw "rdfToMeds needs a jquery.rdf to work with!";
		
		var ret = []
		           
		this.rdf.prefix("sp","http://smartplatforms.org/");
		this.rdf.prefix("med","http://smartplatforms.org/medication#");
		this.rdf.prefix("dcterms","http://purl.org/dc/terms/");
		this.rdf.prefix("dc","http://purl.org/dc/elements/1.1/");
		       		
		var r = this.rdf.where("?med rdf:type "+this.object_type)
			 .where(" ?med dcterms:title ?medlabel")
			 .optional(" ?med med:strength ?strength")
			 .optional(" ?med med:strengthUnits ?strengthUnits")
			 .optional(" ?med med:form ?form")
			 .optional(" ?med med:drug ?cui")
			 .optional(" ?med med:dose ?dose")
			 .optional(" ?med med:doseUnits ?doseUnits")
			 .optional(" ?med med:route ?route")
			 .optional(" ?med med:instructions ?notes")
			 .optional(" ?med med:frequency ?freq")
			 .optional(" ?med med:startDate ?sd")
			 .optional(" ?med med:endDate ?ed");
		
{'fraction_non_alphanumeric': 0.17777777777777778, 'fraction_numerical': 0.0021947873799725653, 'mean_word_length': 3.7473958333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2760442', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1260, 'n_words': 259}