forked from sdhealthconnect/leap-fhir-ces
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
label resources using the labeling endpoint of cds
- Loading branch information
Showing
4 changed files
with
45 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const request = require("superagent"); | ||
const CDS_HOST = process.env.CDS_HOST; | ||
const SLS_ENDPOINT = `${CDS_HOST}/sls`; | ||
|
||
async function label(resource) { | ||
try { | ||
const response = await request | ||
.post(SLS_ENDPOINT) | ||
.set("Accept", "application/json") | ||
.send(resource); | ||
|
||
return response.body; | ||
} catch (e) { | ||
console.log(e) | ||
logger.warn(`SLS invocation failed: ${e}`); | ||
throw { | ||
error: "internal_error", | ||
status: 500 | ||
}; | ||
} | ||
} | ||
|
||
module.exports = { | ||
label | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters