Chapter 2. FreeMED API and Object Model

Table of Contents
Basic API and Namespace
Module-related functions
sql Object and Database Interaction
User Object
Patient Object
Physician Object
Miscellaneous functions

Basic API and Namespace

Most of the FreeMED API is under the FreeMED:: namespace, which helps segment core FreeMED API calls so that they are both obviously belonging to FreeMED and not possibly interfering with function calls from other toolkits.

Access Control

Several functions are available to control the level of access that is granted to certain portions of the program and different patients' EMRs. This is partially to comply with HIPAA regulations in the United States, as well as providing the ability for FreeMED to function as a server for multiple discrete locations in the same installation.

freemed::check_access_for_facility

boolean freemed::check_access_for_facility(int facility_number);

This function checks in the user table for access to a patient, based on the facility where their medical record is kept. This is particularly useful when trying to determine if a home office has access to a medical record.

freemed::check_access_for_patient

boolean freemed::check_access_for_patient(int patient_number, [int user_id]);

This function checks in the user table for access to a patient, based on the providers / physicians who have access to their electronic medical record. Optionally the user ID can be provided, if the programmer does not want to read the user ID from the session cookie.

freemed::user_flag

boolean freemed::user_flag(int flag);

user_flag determines if flag is set for the current user. Examples of valid flags are USER_ADMIN, USER_DATABASE, USER_DELETE.

REMOVE THIS!! PROTOTYPE

boolean function( param);