FreeMED XML-RPC
From FreemedDeveloperWiki, the FreeMED developers' Wiki.
FreeMED's XML-RPC calls require basic authentication, or a URL formed like:
xmlrpc_provider.php?user=(user name)&hash=(md5 hash of password)
DynamicModule calls
Most module functions for "emr" and "maintenance/db" modules can be accessed through the FreeMED.DynamicModule.* namespace. This namespace has the following functions (with examples):
- add (module, parameter hash)
FreeMED.DynamicModule.add ( 'DrugSamples', {
'drugsampleid' => 1041,
'patient' => 173,
'prescriber' => 3,
'deliveryform' => 'tablet',
'amount' => 3,
'instructions' => 'Take with warm water.'
} )
- update (module, parameter hash including id)
FreeMED.DynamicModule.update ( 'DrugSamples', {
'id' => 2,
'amount' => 4
} )
- picklist (module, parameter hash)
FreeMED.DynamicModule.picklist ( 'ProviderModule', {
'first_name' => 'foo',
'last_name' => 'bar'
} )
- remove (module, id)
FreeMED.DynamicModule.remove ( 'ProviderModule', 3 )
- distinct (module, field)
FreeMED.DynamicModule.distinct ( 'DrugSamplesInventory', 'drugnameformal' )
The parameter hash (in picklist) is defined in its respective module class in FreeMED by $this->rpc_field_map. Parameters can exist as keys in this hash, which also contains the mapping for the returned values from picklist.
For add and update, support for standardized names is pretty flaky. As of 2005-02-20, the regular hash of parameter fields as passed to $sql->insert_query has to be used, unless there is a forced $_REQUEST[x] in the $this->variables, in which case you should use the hash name of the variable as passed by $_REQUEST.
