Skip to content

Commit

Permalink
Terminology HTTP API
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Feb 16, 2024
1 parent fa3a034 commit 8445eef
Show file tree
Hide file tree
Showing 9 changed files with 611 additions and 575 deletions.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ <h3><a href="https://n2o.dev">MODULES</a></h3>
post "/$export"
post "/$diff"
post "/$reindex"
get "/CodeSystem/$lookup"
get "/CodeSystem/:id/$lookup"
get "/CodeSystem/$validate-code"
get "/CodeSystem/:id/$validate-code"
get "/ValueSet/$expand"
get "/ValueSet/:id/$expand"
get "/ConceptMap/$closure"
get "/ConceptMap/:id/$closure"
get "/ConceptMap/$translate"
get "/ConceptMap/:id/$translate"
post "/CodeSystem/$validate-code"
post "/:resourceType/$validate"
get "/:resourceType/:id"
put "/:resourceType/:id"
Expand Down
63 changes: 44 additions & 19 deletions lib/hl7_endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,50 @@ defmodule HL7.Endpoint do
plug :match
plug :dispatch
plug Plug.Parsers, parsers: [:json], json_decoder: Jason
get "/" do HL7.Service.root(conn) end
post "/" do HL7.Service.postRoot(conn) end
get "/$meta" do HL7.Service.meta(conn) end
post "/$meta" do HL7.Service.postMeta(conn) end
get "/metadata" do HL7.Service.metadata(conn) end
get "/_history" do HL7.Service.history(conn) end
get "/_diff" do HL7.Service.diff(conn) end
get "/$export" do HL7.Service.export(conn) end
post "/$export" do HL7.Service.postExport(conn) end
post "/$diff" do HL7.Service.postDiff(conn) end
post "/$reindex" do HL7.Service.reindex(conn) end
post "/:type/$validate" do HL7.Service.post4(conn,[],type,[],"$validate") end
get "/:type/:id" do HL7.Service.get4(conn,[],type,id,"$base") end
put "/:type/:id" do HL7.Service.put4(conn,[],type,id,"$base") end
delete "/:type/:id" do HL7.Service.delete4(conn,[],type,id,"$base") end
post "/_search" do HL7.Service.post2(conn,[],"_search") end
post "/:res/_search" do HL7.Service.post3(conn,[],res,"_search") end
post "/:comp/:id/_search" do HL7.Service.post4(conn,[],comp,id,"_search") end
post "/:comp/:id/:res/_search" do HL7.Service.post5(conn,[],comp,id,res,"_search") end

# Meta Service

get "/" do HL7.Service.root(conn) end
post "/" do HL7.Service.postRoot(conn) end
get "/$meta" do HL7.Service.meta(conn) end
post "/$meta" do HL7.Service.postMeta(conn) end
get "/metadata" do HL7.Service.metadata(conn) end
get "/$export" do HL7.Service.export(conn) end
post "/$export" do HL7.Service.postExport(conn) end
post "/$diff" do HL7.Service.postDiff(conn) end
post "/$reindex" do HL7.Service.reindex(conn) end

# Terminology

get "/CodeSystem/$lookup" do HL7.Service.get4(conn,[],"CodeSystem",[],"$lookup") end
get "/CodeSystem/:id/$lookup" do HL7.Service.get4(conn,[],"CodeSystem",id,"$lookup") end
get "/CodeSystem/$validate-code" do HL7.Service.get4(conn,[],"CodeSystem",[],"$validate-code") end
get "/CodeSystem/:id/$validate-code" do HL7.Service.get4(conn,[],"CodeSystem",id,"$validate-code") end
get "/ValueSet/$expand" do HL7.Service.get4(conn,[],"ValueSet",[],"$expand") end
get "/ValueSet/:id/$expand" do HL7.Service.get4(conn,[],"ValueSet",id,"$expand") end
get "/ConceptMap/$closure" do HL7.Service.get4(conn,[],"ConceptMap",[],"$closure") end
get "/ConceptMap/:id/$closure" do HL7.Service.get4(conn,[],"ConceptMap",id,"$closure") end
get "/ConceptMap/$translate" do HL7.Service.get4(conn,[],"ConceptMap",[],"$translate") end
get "/ConceptMap/:id/$translate" do HL7.Service.get4(conn,[],"ConceptMap",id,"$translate") end

# Resource Instance Interactions

post "/:type/$validate" do HL7.Service.post4(conn,[],type,[],"$validate") end
get "/:type/:id" do HL7.Service.get4(conn,[],type,id,"$base") end
get "/:type/:id/_history" do HL7.Service.get4(conn,[],type,id,"_history") end
get "/:type/:id/_history/:vsn" do HL7.Service.get4(conn,vsn,type,id,"_history") end
put "/:type/:id" do HL7.Service.put4(conn,[],type,id,"$base") end
delete "/:type/:id" do HL7.Service.delete4(conn,[],type,id,"$base") end

# Whole Server Interactions

get "/_history" do HL7.Service.history(conn) end
get "/_diff" do HL7.Service.diff(conn) end
post "/_search" do HL7.Service.post2(conn,[],"_search") end
post "/:res/_search" do HL7.Service.post3(conn,[],res,"_search") end
post "/:comp/:id/_search" do HL7.Service.post4(conn,[],comp,id,"_search") end
post "/:comp/:id/:res/_search" do HL7.Service.post5(conn,[],comp,id,res,"_search") end

match _ do send_resp(conn, 404,
"Please refer to https://hl7.erp.uno manual" <>
" for information about endpoints addresses.") end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
{
"resourceType" : "CodeSystem",
"id" : "allergy-intolerance-category",
"meta" : {
"lastUpdated" : "2024-02-13T22:01:30.310+00:00",
"profile" : ["http://hl7.org/fhir/StructureDefinition/shareablecodesystem"]
},
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>This case-sensitive code system <code>http://hl7.org/fhir/allergy-intolerance-category</code> defines the following codes:</p><table class=\"codes\"><tr><td style=\"white-space:nowrap\"><b>Code</b></td><td><b>Display</b></td><td><b>Definition</b></td></tr><tr><td style=\"white-space:nowrap\">food<a name=\"allergy-intolerance-category-food\"> </a></td><td>Food</td><td>Any substance consumed to provide nutritional support for the body.</td></tr><tr><td style=\"white-space:nowrap\">medication<a name=\"allergy-intolerance-category-medication\"> </a></td><td>Medication</td><td>Substances administered to achieve a physiological effect.</td></tr><tr><td style=\"white-space:nowrap\">environment<a name=\"allergy-intolerance-category-environment\"> </a></td><td>Environment</td><td>Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic.</td></tr><tr><td style=\"white-space:nowrap\">biologic<a name=\"allergy-intolerance-category-biologic\"> </a></td><td>Biologic</td><td>A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies. There are other biologic products, such as tissues, which are not typically associated with allergies.</td></tr></table></div>"
},
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
"valueCode" : "pc"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
"valueCode" : "trial-use"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
"valueInteger" : 3
}],
"url" : "http://hl7.org/fhir/allergy-intolerance-category",
"identifier" : [{
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.4.134"
},
{
"use" : "old",
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.1.124"
},
{
"use" : "old",
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.2.53"
}],
"version" : "6.0.0-cibuild",
"name" : "AllergyIntoleranceCategory",
"title" : "Allergy Intolerance Category",
"status" : "active",
"experimental" : false,
"date" : "2021-01-05T10:01:24+11:00",
"publisher" : "HL7 (FHIR Project)",
"contact" : [{
"telecom" : [{
"system" : "url",
"value" : "http://hl7.org/fhir"
},
{
"system" : "email",
"value" : "[email protected]"
}]
}],
"description" : "Category of an identified substance associated with allergies or intolerances.",
"jurisdiction" : [{
"coding" : [{
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"code" : "001",
"display" : "World"
}]
}],
"caseSensitive" : true,
"valueSet" : "http://hl7.org/fhir/ValueSet/allergy-intolerance-category",
"content" : "complete",
"concept" : [{
"code" : "food",
"display" : "Food",
"definition" : "Any substance consumed to provide nutritional support for the body."
},
{
"code" : "medication",
"display" : "Medication",
"definition" : "Substances administered to achieve a physiological effect."
},
{
"code" : "environment",
"display" : "Environment",
"definition" : "Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic."
},
{
"code" : "biologic",
"display" : "Biologic",
"definition" : "A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies. There are other biologic products, such as tissues, which are not typically associated with allergies."
}]
{
"resourceType" : "CodeSystem",
"id" : "allergy-intolerance-category",
"meta" : {
"lastUpdated" : "2024-02-13T22:01:30.310+00:00",
"profile" : ["http://hl7.org/fhir/StructureDefinition/shareablecodesystem"]
},
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>This case-sensitive code system <code>http://hl7.org/fhir/allergy-intolerance-category</code> defines the following codes:</p><table class=\"codes\"><tr><td style=\"white-space:nowrap\"><b>Code</b></td><td><b>Display</b></td><td><b>Definition</b></td></tr><tr><td style=\"white-space:nowrap\">food<a name=\"allergy-intolerance-category-food\"> </a></td><td>Food</td><td>Any substance consumed to provide nutritional support for the body.</td></tr><tr><td style=\"white-space:nowrap\">medication<a name=\"allergy-intolerance-category-medication\"> </a></td><td>Medication</td><td>Substances administered to achieve a physiological effect.</td></tr><tr><td style=\"white-space:nowrap\">environment<a name=\"allergy-intolerance-category-environment\"> </a></td><td>Environment</td><td>Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic.</td></tr><tr><td style=\"white-space:nowrap\">biologic<a name=\"allergy-intolerance-category-biologic\"> </a></td><td>Biologic</td><td>A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies. There are other biologic products, such as tissues, which are not typically associated with allergies.</td></tr></table></div>"
},
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
"valueCode" : "pc"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
"valueCode" : "trial-use"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
"valueInteger" : 3
}],
"url" : "http://hl7.org/fhir/allergy-intolerance-category",
"identifier" : [{
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.4.134"
},
{
"use" : "old",
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.1.124"
},
{
"use" : "old",
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.2.53"
}],
"version" : "6.0.0-cibuild",
"name" : "AllergyIntoleranceCategory",
"title" : "Allergy Intolerance Category",
"status" : "active",
"experimental" : false,
"date" : "2021-01-05T10:01:24+11:00",
"publisher" : "HL7 (FHIR Project)",
"contact" : [{
"telecom" : [{
"system" : "url",
"value" : "http://hl7.org/fhir"
},
{
"system" : "email",
"value" : "[email protected]"
}]
}],
"description" : "Category of an identified substance associated with allergies or intolerances.",
"jurisdiction" : [{
"coding" : [{
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"code" : "001",
"display" : "World"
}]
}],
"caseSensitive" : true,
"valueSet" : "http://hl7.org/fhir/ValueSet/allergy-intolerance-category",
"content" : "complete",
"concept" : [{
"code" : "food",
"display" : "Food",
"definition" : "Any substance consumed to provide nutritional support for the body."
},
{
"code" : "medication",
"display" : "Medication",
"definition" : "Substances administered to achieve a physiological effect."
},
{
"code" : "environment",
"display" : "Environment",
"definition" : "Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic."
},
{
"code" : "biologic",
"display" : "Biologic",
"definition" : "A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies. There are other biologic products, such as tissues, which are not typically associated with allergies."
}]
}
Loading

0 comments on commit 8445eef

Please sign in to comment.