Scott Penrose

MedicalAPI

Scott is an expert software developer with over 30 years experience, specialising in education, automation and remote data.

Medical API

#!Perl
get '/' => sub {
  my $base = uri_for('/person/'). "";
  my $sth = database->prepare(qq{
    SELECT
      person.id as id, concat('$base', person.id) as href, 
      person.display_name as display_name
    FROM
      person
    ORDER BY
      display_name
  });
  $sth->execute();
  return {
    person => $sth->fetchall_arrayref({}),
  };
};
#!JavaScript
var api = new $.RestClient('/api', { stripTrailingSlash: true});

api.add('patient');
api.patient.add('medication');
api.patient.add('data');

api.patient.read()
.done(function(data) {
  console.log(data);
});

api.patient.medication.create('ABC123', { value: 'Ibuprofen' })
.done(function(data) {;
  console.log(data);
});