/**
 * Patient Schema of VistA. Shows nodes that need to be queried for patient
 * information. 
 *
 * FMQL v0.6
 *
 * TBD: will become OWL in an endpoint
 */
var VISTAPATIENTSCHEMA = { 
  "PATIENT": {"name": "PATIENT", "type": "2", "predicates": ["name", "sex", "date_of_birth", "integration_control_number"], "hdrType": "Patient", "predicatesMap": {"name": "name", "sex": "administrativeGenderLabel", "date_of_birth": "birthTime", "integration_control_number": "ehrId"}},

 "REFERRERS": {

	"120_8": {"name": "PATIENT ALLERGIES", "type": "120_8", "referringPredicate": ".01", "patientFile": "2", "predicates": ["mechanism", "origination_date_time", "gmr_allergy", "reactions:reaction", "originator"], "hdrType": "Alert", "predicatesMap": {"mechanism": "alertType", "origination_datetime": "startTime", "gmr_allergy": "substance", "reaction": "reaction", "originator": "source"}, "filter": "!bound(22)"},
	
	"9000011": {"name": "PROBLEM", "type": "9000011", "hdrType": "Problem", "referringPredicate": ".02", "patientFile": "9000001", "predicates": ["status", "diagnosis", "date_of_onset", "entered_by", "date_last_modified"], "hdrType": "Problem", "predicatesMap": {"status": "statusLabel", "diagnosis": "concept", "date_of_onset": "startDate", "entered_by": "source", "date_last_modified": "lastUpdateTime"}}, // "filter": {"condition": "HIDDEN"}
	
	"120_5": {"name": "GMRV VITAL MEASUREMENT", "type": "120_5", "referringPredicate": ".02", "patientFile": "2", "predicates": ["date_time_vitals_taken", "vital_type", "qualifier:qualifier", "rate", "entered_by"], "filter": "!bound(2)", "predicatesMap": {"date_time_vitals_taken": "time", "vital_type": "concept", "qualifier": "", "rate": "value", "entered_by": "source"}, "hdrType": "VitalSign"},
	
	"9000010_11": {"name": "V IMMUNIZATION", "type": "9000010_11", "referringPredicate": ".02", "patientFile": "9000001", "predicates": ["immunization", "visit", "reaction"], "hdrType": "Immunization", "predicatesMap": {"immunization": "substance", "visit": "visit", "reaction": "reaction"}},

	"52": {"name": "PRESCRIPTION", "type": "52", "referringPredicate": "2", "patientFile": "2", "predicates": ["drug", "ndc", "issue_date", "status", "provider", "qty", "_of_refills", "expanded_patient_instructions", "provider_comments", "pharmacy_instructions"], "predicatesMap": {"drug": "product", "ndc": "ndc", "issue_date": "dateTime", "status": "statusLabel", "provider": "source", "qty": "quantity", "_of_refills": "refill", "expanded_patient_instructions": "instruction", "provider_comments": "instruction", "pharmacy_instructions": "instruction"}, "hdrType": "Medication", "subordinates": ["DIRECTION"]},  

	"55_05": {"name": "NON-VA MEDS", "type": "55", "referringPredicate": ".01", "patientFile": "2", "bnode": "non_va_meds", "bnodetype": "55_05", "hdrType": "Medication", "predicates": ["dispense_drug", "start_date", "discontinued_date", "medication_route", "dosage", "schedule", "documented_by"], "filter": "!bound(5)", "predicatesMap": {"dispense_drug": "product", "start_date": "dateTime", "discontinued_date": "discontinuedDate", "medication_route": "routeLabel", "dosage": "doseLabel", "schedule": "frequencyLabel", "documented_by": "source"}}, // "filter": status is discontinued or date of death,
		
	"52_41": {"name": "PENDING OUTPATIENT ORDERS", "type": "52_41", "referringPredicate": "1", "patientFile": "2", "hdrType": "Medication", "predicates": ["effective_date", "provider", "order_type", "drug", "qty", "_of_refills"], "predicatesMap": {"effective_date": "dateTime", "provider": "source", "order_type": "statusLabel", "drug": "product", "qty": "quantity", "_of_refills": "refill"}}, // "filter": {"order_type": ... range of values}

	"9000010_18": {"name": "V CPT", "referringPredicate": ".02", "type": "9000010_18", "patientFile": "9000001", "predicates": ["visit", "cpt", "diagnosis", "provider_narrative", "order", "ordering_provider"], "hdrType": "Procedure", "predicatesMap": {"visit": "visit", "cpt": "concept", "diagnosis": "concept", "provider_narrative": "local_concept", "order": "", "ordering_provider": "source"}},

	"9000010": {"name": "VISITS", "referringPredicate": ".05", "type": "9000010", "patientFile": "9000001", "predicates": ["visit_admit_datetime", "type"], "hdrType": "Visit", "predicatesMap": {"visit_admit_datetime": "dateTime", "type": "visitTypeLabel"}}

 },
	
 "REFERENCED": {
	"63_04": {"name": "CHEM, HEM, TOX, RIA, SER, etc.", "predicate": "laboratory_reference", "type": "63", "patientFile": "2", "bnode": "chem_hem_tox_ria_ser_etc", "bnodetype": "63_04", "hdrType": "Lab", "predicates": ["date_time_specimen_taken", "specimen_type"], "predicatesMap": {"date_time_specimen_taken": "dateTime", "specimen_type": "specimen"}} 
 },

 "REFERRED": {"200": {"name": "NEW PERSON", "type": "200", "predicates": ["name", "person_class:person_class"], "predicatesMap": {"name": "name", "person_class": "specialty"}, "hdrType": "Actor"}},
 
 "SUBORDINATES": {"DIRECTION": { "type": "52_0113", "hdrType": "Direction", "predicates": ["dosage_ordered", "units", "route", "schedule", "verb"], "predicatesMap": {"dosage_ordered": "doseValue", "units": "doseUnit", "route": "route", "schedule": "frequency", "verb": "deliveryMethod"}, "predicatesCalculate": ["interval"]}} // TBD: not used yet.

};

