npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

doctolib-client

v0.0.3

Published

Doctolib API for NodeJS

Downloads

1

Readme

doctolib-client

NPM

Build Status Dependency Status [![Coverage Status][coveralls-image]][coveralls-url]

Simple module for using Doctolib's API in node.js

Install

$ npm install --save doctolib-client

Usage

var express = require('express');
var bodyParser = require('body-parser');

var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));

var DoctolibClient = require('../dist/DoctolibClient').DoctolibClient;


// Create an API client
var options = {
    clientAccessKey: process.env.clientAccessKey,
    secretAccessKey: process.env.secretAccessKey,
    url: "https://api-interf.doctolib.net"//SandBox
};

var client = new DoctolibClient(options);

app.get('/agenda', function (req, res) {
    client.getAgenda(function (err, data) {
        if (err) {
            res.send(err);
            return;
        }
        res.json(JSON.parse(data));
    });
});

app.get('/visitMotive', function (req, res) {
    var agendaId = req.query.agendaId;

    client.getVisitMotive(agendaId, function (err, data) {
        if (err) {
            res.send(err);
            return;
        }
        res.json(JSON.parse(data));
    });
});

app.get('/availabilityService', function (req, res) {
    var agendaId = req.query.agendaId;
    var visitMotiveId = req.query.visitMotiveId;
    var date = req.query.date;

    client.getAvailabilityService(agendaId, visitMotiveId, date, 7, function (err, data) {
        if (err) {
            res.send(err);
            return;
        }
        res.json(JSON.parse(data));
    });
});

app.post('/appointment', function (req, res) {
    client.createAppointment(req.body, function (err, data) {
        if (err) {
            res.send(err);
            return;
        }
        res.json(JSON.parse(data));
    });
});

app.get('/appointment', function (req, res) {
    var patientId = req.query.patientId;

    client.getAppointment(patientId, function (err, data) {
        if (err) {
            res.send(err);
            return;
        }
        res.json(JSON.parse(data));
    });
});

app.delete('/appointment', function (req, res) {
    var appointmentId = req.query.appointmentId;

    client.deleteAppointment(appointmentId, function (err, data) {
        if (err) {
            res.send(err);
            return;
        }
        res.json(JSON.parse(data));
    });
});

app.listen(3000);

Client API

Initialization

var options = {
    clientAccessKey: "your consumer Key",
    secretAccessKey: "your consumer secret",
    url: "https://api-interf.doctolib.net"
};

var client = new DoctolibClient(options);

Create an API client with options. Url is optional. Default url is the production API.

DoctolibClient.setDataFormat(format)

Set the format of the data you wish to receive (json or hl7 for specific endpoints). Default format is JSON. The format is a string.

Methods

DoctolibClient.authenticate(callback)

Use this method to ensure the authentication is correct. The callback is of the form function(err, data).

DoctolibClient.getAgenda(function (err, data)

The callback is of the form function(err, data). The data is an array of agendas.

DoctolibClient.getVisitMotive(agendaIds, function (err, data)

The agendaIds can be a string or an array of string. The callback is of the form function(err, data). The data is an array of visit motives.

DoctolibClient.getAvailabilityService(agendaIds, visitMotiveId, date, limit, function (err, data)

The agendaIds can be a string or an array of string. The visitMotiveId is a string. The date a string like YYYY-MM-DD. The limit a number and the value must be between 3 and 7. The callback is of the form function(err, data).

DoctolibClient.createAppointment(appointment,function (err, data)

The agendaIds is a string. The appointment is a DoctolibPatientModel Object. The callback is of the form function(err, data).

DoctolibPatientModel Object for an unknown patient

{
  "visit_motive_id": "r:9",
  "agenda_id": 7,
  "start_date": "2016-10-10T12:45:00+0200",
  "patient": {
    "last_name": "John",
    "first_name": "Doe",
    "birthdate": "1985-19-03",
    "maiden_name": "Smith",
    "email": "[email protected]",
    "phone_number": "0601012341",
    "secondary_phone_number": "0601012341",
    "external_patient_id": "1312^^^Application^PI",
    "gender": "M"
  }
}

DoctolibPatientModel Object For a known patient

{
  "visit_motive_id": "r:9",
  "agenda_id": 7,
  "start_date": "2016-10-10T12:45:00+0200",
  "patient_id": 3
}

DoctolibClient.getAppointment(patientId,function (err, data)

The patientId,the Doctolib ID of the patient, is a string. The callback is of the form function(err, data). The data is an array of appointments.

DoctolibClient.deleteAppointment(appointmentId,function (err, data)

The appointmentId is a string. The callback is of the form function(err, data).

Async Methods

DoctolibClient.getAgendaAsync()

DoctolibClient.getVisitMotiveAsync()

DoctolibClient.getAvailabilityServiceAsync()

DoctolibClient.getAppointmentAsync()

DoctolibClient.createAppointmentAsync()

DoctolibClient.deleteAppointment()

This methods return a promise

Contributing

Contributions are welcome. See issues here.

Release Notes

See release notes here.

License

Licensed under Apache 2.0.