Description


This API allows that a super-user configures multiple Fuga's. We call the Fuga's configured by this API 'managed Fuga's'.


The principle is that the super-user can suggest to a practice to use a new object (an object can be an act, product, protocol, template, query or care plan). When a super-user pushes a new object, it can be pushed in state 'active' or 'inactive'. There are good reasons to push an object as 'inactive' and leave it up to the practice to accept this new object. The reasons are:

  • the practice receives the time to review the suggestions (they won't be surprised on a Monday morning with a new configuration)
  • the practice will be able to activate the new objects when it suits them best (after informing the team)
  • new objects might need additional configuration by the practice (e.g. which product to use in a protocol)
  • the practice has the time to order stock for new products
  • the practice might be responsible for the price setting themselves
  • it is a friendly way to gradually move to an ideal configuration


However, the super-user can track when changes are activated/implemented.


Objects created by a super-user have a superId, so they are always identifiable for later edits. A super-user can assign a 'compliance level' to an object to indicate how much the object complies to the group policy. The compliance level can have the values TGreen, TYellow, TBlue, TOrange and TRed. It is up to the group to define the semantics of these values.


When updating an object there will be an option to automatically sync the changes to all practices that have this object in place.


An object created by the super-user will always be in state published/locked, to avoid that the practice changes essential parameters (name, species).


A super-user is not able to delete an object. He/she can only set the 'compliance level' very low to trigger the practice to delete/deactivate an object.


Endpoints


Query


Practice independent info

https://(test.)sonetas.eu/fuga/rest/super/config


GET practices


RETURNS

http status 200 ok, returning a json array of practiceIds to which this user has access.


or other http status on error


GET enums


RETURNS

http status 200 ok, returning a json array of arrays of enums that can be used when configuring objects. Typically this needs to be called once a day, they rarely change.


or other http status on error


Practice specific


https://(test.)sonetas.eu/fuga/rest/super/config/{practiceId}


with {practiceId} the queried db.


The next methods all allow to retrieve managed (these have a superId) and non-managed objects in the specified practice. One can retrieve either:

  • all objects
  • all objects for which the name matches a given searchString
  • a specific object based on its fugaId or superId


GET info

GET breeds

GET products/[q/{searchString}]

GET products/f/{fugaId}

GET products/s/{superId}

GET acts/[q/{searchString}]

GET acts/f/{fugaId}

GET acts/s/{superId}

GET protocols/[q/{searchString}]

GET protocols/f/{fugaId}

GET protocols/s/{superId}

GET templates/[q/{searchString}]

GET templates/f/{fugaId}

GET templates/s/{superId}

GET queries/[q/{searchString}]

GET queries/f/{fugaId}

GET queries/s/{superId}

GET carePlans/[q/{searchString}]

GET carePlans/f/{fugaId}

GET carePlans/s/{superId}

with

  • accept header set to 'application/json'


RETURNS

http status 200 ok, returning json


or other http status on error


Sync


https://(test.)sonetas.eu/fuga/rest/super/config/{practiceId}


with {practiceId} the practice to be synced.


Allows to sync acts, protocols, templates, queries and care plans created in the master Fuga towards the managed Fuga's by posting json objects. If the object with the specified superId does not exist, it is created (and possibly needs to be activated by the practice). If the object already exists, it will be updated.


When syncing a product via the API and the product with that superId does not exist, the API will try to find a match based on (name, nbrOfUnits). Since product names are typically different per supplier and there is no better identifier (e.g. ean) available it only makes sense to add products via the API when one knows the same supplier is used. The alternative is that when a super-user creates a new protocol he/she can add a description of which products should be used. The super-user can still control the price and compliance levels of these products.


POST acts/{superId}


{"name":"the name of the act", "nameTDutch":"name in Dutch", "nameTFrench":"name in French", "nameTEnglish":"name in English", "label":"a label", "description":"description of act for vet", "species":"TDog", "unitPrice":12.23, "complianceLevel":"TYellow", "active":true}


with mandatory fields: name, unitPrice, complianceLevel.


RETURNS

http status 200 ok with fugaId of the newly created object


or other http status on error (possibly with description of the validation errors).


POST products/{superId}


{"name":"the name of the product", "nameTDutch":"name in Dutch", "nameTFrench":"name in French", "nameTEnglish":"name in English", "label":"a label", "type":"TDrug", "cnkNumber":"1234567", "unit":"ml", "nbrOfUnits":100, "vat":21.00, "priceDetermination":"TPublicPrice", "priceDeviationSales":-10, "priceDeviationApplied":10, "surchargeApplied":5.00, "defaultIsSales":false, "bulkReductionNbrOfOutgoingUnits1":10, "bulkReductionPercentage1":10, "bulkReductionNbrOfOutgoingUnits2":20, "bulkReductionPercentage2":15, "narcotic":false, "antibiotic":true, "complianceLevel":"TYellow", "active":false}


with mandatory fields: name, type, unit, nbrOfUnits, vat, priceDetermination complianceLevel.


The field nbrOfUnits can only be set on first sync, it can not be edited afterwards.


Depending on the priceDetermination some parameters are mandatory. The gross price or public price are not set via the API, these prices arrive via the supplier.


Price determinationParameters
TFixedPricefixedUnitPrice
TGainPurchasePricegain
TGainGrossPricegain
TPublicPrice


RETURNS

http status 200 ok with fugaId of the newly created object


or other http status on error (possibly with description of the validation errors).


POST protocols/{superId}


{"name":"the name of the protocol", "nameTDutch":"name in Dutch", "nameTFrench":"name in French", "nameTEnglish":"name in English", "label":"a label", "type":"TVaccinationDog", "description":"description of protocol for vet", "priceSetting":"TFixedPrice", "totalFixedPriceExclVatWages":null, "totalFixedPriceExclVatSalesLow":20.00, "totalFixedPriceExclVatSalesHigh":10.50, "complianceLevel":"TYellow", "diseases":["TInfectiousHepatitis","TParainfluenza"], "period":"6 TMonths", "letterTemplateDutchSuperId":87, "actDoses"[{"superId":1, "actSuperId":26, "nbrOfActs":3},{"superId":7, "actSuperId": 27, "nbrOfActs":1}],"productDoses"[{"superId":1, "productSuperId":26, "nbrOfUnits":3, "sold":false}], "subProtocolDoses"[{"superId":2, "protocolSuperId":8, "nbrOfProtocols":1}]}


with mandatory fields: superId, name, type, complianceLevel, priceSetting (TComposedPrice, TFixedPrice, TWagesFixedSalesComposed) and depending on the type of the protocol: diseases, period, nbrOfTreatments.


The field type can only be set on first sync, it can not be edited afterwards.


Depending on the priceSetting some parameters are mandatory:


Price settingParameters
TComposedPrice
TFixedPricetotalFixedPriceExclVatWages, totalFixedPriceExclVatSalesLow, totalFixedPriceExclVatSalesHigh
TWagesFixedSalesComposedtotalFixedPriceExclVatWages


The parameters which are only relevant from some protocol types are listed in below table.


Protocol typeParameters
TGeneralspecies
TOperationspecies
TContraceptionspecies, period (M), letterTemplateDutchSuperId, letterTemplateFrenchSuperId, letterTemplateEnglishSuperId, emailTemplateDutchSuperId, emailTemplateFrenchSuperId, emailTemplateEnglishSuperId
TOtherTreatmentspecies, period (M), letterTemplateDutchSuperId, letterTemplateFrenchSuperId, letterTemplateEnglishSuperId, emailTemplateDutchSuperId, emailTemplateFrenchSuperId, emailTemplateEnglishSuperId
TProductTreatmentspecies, period (M), nbrOfTreatments(M), lletterTemplateDutchSuperId, letterTemplateFrenchSuperId, letterTemplateEnglishSuperId, emailTemplateDutchSuperId, emailTemplateFrenchSuperId, emailTemplateEnglishSuperId
TVaccination*diseases (M), period(M), letterTemplateDutchSuperId, letterTemplateFrenchSuperId, letterTemplateEnglishSuperId, emailTemplateDutchSuperId, emailTemplateFrenchSuperId, emailTemplateEnglishSuperId


he possibe values of the diseases are listed in the species information.


RETURNS

http status 200 ok with fugaId of the newly created object


or other http status on error (possibly with description of the validation errors).


POST templates/{superId}


{"name":"the name of the template", "type":"TTLetter", "contentCategory":"TContract", "docTargets":["TAnimal", "TConsultation"], "language":"TEnglish", "layoutMode":"TRichText", "title":"Contract", "content":"<p>Hello</p>", "complianceLevel":"TYellow", "active":true}


with mandatory fields: name, type, contentCategory, docTargets, complianceLevel.


Depending on the type and layoutMode following parameters are relevant:


TypeLayoutModeParameters
TTLetterTSimple

title, topLeft, topRight, content

TTLetterTRichTextcontent
TEmailTSimple

title, content

TEmailTRichText

title, content

TSmsTSimplecontent


RETURNS

http status 200 ok with fugaId of the newly created object


or other http status on error (possibly with description of the validation errors).


POST queries/{superId}


TODO


POST carePlans/{superId}


{"name":"the name of the care plan", "nameTDutch":"name in Dutch", "nameTFrench":"name in French", "nameTEnglish":"name in English", "description":"description of care plan for vet", "species":"TDog", "duration":"T1Year", "defaultPaymentPeriod":"T1Month", "cancellationPeriod":"T2Months" , "cancelledAtDecease":"true", "activationFeeExclVat":5.00, "deActivationFeeExclVat": 10.00, "priceExclVatWages":120.00, "priceExclVatSalesLow":20.00, "priceExclVatSalesHigh":10.50, "complianceLevel":"TYellow", "carePlanItems"[{"superId":2, "actSuperId":1,"maxNbrOfCoveredUnits":3,"reductionPercentage":50},{"superId":3, "protocolSuperId":6,"maxNbrOfCoveredUnits":null,"reductionPercentage":100}]}


with mandatory fields: name, duration, defaultPaymentPeriod, cancellationPeriod, cancelledAtDecease, activationFeeExclVat, deActivationFeeExclVat, priceExclVatWages, priceExclVatSalesLow, priceExclVatSalesHigh, complianceLevel.


when maxNbrOfCoveredUnits=null, i.e. unlimited.


RETURNS

http status 200 ok with fugaId of the newly created object


or other http status on error (possibly with description of the validation errors).


Edit


https://(test.)sonetas.eu/fuga/rest/super/config/{practiceId}


with {practiceId} the queried db.


Allows to edit some attributes of products, acts, protocols, templates, queries and care plans by putting a json object.


Individual attributes of an object can be changed using the same names as in the POST requests. If an array is updated, all items of the array must be provided. An edit of an object will typically be used to adjust prices or compliance levels. There are also some limitations, e.g. one can not change the name of an unmanaged object once it is published by the practice.


PUT products/f/{fugaId}

PUT products/s/{superId}

editable attributes: complianceLevel, priceDetermination, gain, fixedUnitPrice


PUT acts/f/{fugaId}

PUT acts/s/{superId}

editable attributes: complianceLevel, unitPrice


PUT protocols/f/{fugaId}

PUT protocols/s/{superId}

editable attributes: complianceLevel, totalFixedPriceExclVat, totalFixedPriceExclVatSalesLow, totalFixedPriceExclVatSalesHigh


PUT templates/f/{fugaId}

PUT templates/s/{superId}

editable attributes: complianceLevel


PUT queries/f/{fugaId}

PUT queries/s/{superId}

editable attributes: complianceLevel


PUT carePlans/f/{fugaId}

PUT carePlans/s/{superId}

editable attributes: complianceLevel, activationFeeExclVat, deActivationFeeExclVat, priceExclVatWages, priceExclVatSalesLow, priceExclVatSalesHigh


RETURNS

http status 200 ok


or other http status on error (possibly with description of the validation errors).