hquery-patient-api 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.travis.yml +17 -0
- data/Gemfile +14 -0
- data/LICENSE +57 -0
- data/README.md +34 -0
- data/Rakefile +41 -0
- data/VERSION +1 -0
- data/app/assets/javascripts/allergy.js.coffee +79 -0
- data/app/assets/javascripts/caregoal.js.coffee +18 -0
- data/app/assets/javascripts/condition.js.coffee +88 -0
- data/app/assets/javascripts/core.js.coffee +556 -0
- data/app/assets/javascripts/encounter.js.coffee +56 -0
- data/app/assets/javascripts/functionalstatus.js.coffee +48 -0
- data/app/assets/javascripts/immunization.js.coffee +115 -0
- data/app/assets/javascripts/languages.js.coffee +29 -0
- data/app/assets/javascripts/medicalequipment.js.coffee +28 -0
- data/app/assets/javascripts/medication.js.coffee +280 -0
- data/app/assets/javascripts/patient.js.coffee +302 -0
- data/app/assets/javascripts/pregnancy.js.coffee +24 -0
- data/app/assets/javascripts/procedure.js.coffee +28 -0
- data/app/assets/javascripts/provider.js.coffee +55 -0
- data/app/assets/javascripts/result.js.coffee +43 -0
- data/app/assets/javascripts/socialhistory.js.coffee +40 -0
- data/doc/jsdoc-toolkit/README.txt +183 -0
- data/doc/jsdoc-toolkit/app/frame.js +33 -0
- data/doc/jsdoc-toolkit/app/frame/Chain.js +102 -0
- data/doc/jsdoc-toolkit/app/frame/Dumper.js +144 -0
- data/doc/jsdoc-toolkit/app/frame/Hash.js +84 -0
- data/doc/jsdoc-toolkit/app/frame/Link.js +173 -0
- data/doc/jsdoc-toolkit/app/frame/Namespace.js +10 -0
- data/doc/jsdoc-toolkit/app/frame/Opt.js +134 -0
- data/doc/jsdoc-toolkit/app/frame/Reflection.js +26 -0
- data/doc/jsdoc-toolkit/app/frame/String.js +93 -0
- data/doc/jsdoc-toolkit/app/frame/Testrun.js +129 -0
- data/doc/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
- data/doc/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
- data/doc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
- data/doc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
- data/doc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC.js +106 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +204 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +140 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +146 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +644 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +243 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
- data/doc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +507 -0
- data/doc/jsdoc-toolkit/app/main.js +111 -0
- data/doc/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
- data/doc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
- data/doc/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
- data/doc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
- data/doc/jsdoc-toolkit/app/plugins/symbolLink.js +10 -0
- data/doc/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
- data/doc/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
- data/doc/jsdoc-toolkit/app/run.js +348 -0
- data/doc/jsdoc-toolkit/app/t/TestDoc.js +144 -0
- data/doc/jsdoc-toolkit/app/t/runner.js +13 -0
- data/doc/jsdoc-toolkit/app/test.js +342 -0
- data/doc/jsdoc-toolkit/app/test/addon.js +24 -0
- data/doc/jsdoc-toolkit/app/test/anon_inner.js +14 -0
- data/doc/jsdoc-toolkit/app/test/augments.js +31 -0
- data/doc/jsdoc-toolkit/app/test/augments2.js +26 -0
- data/doc/jsdoc-toolkit/app/test/borrows.js +46 -0
- data/doc/jsdoc-toolkit/app/test/borrows2.js +23 -0
- data/doc/jsdoc-toolkit/app/test/config.js +22 -0
- data/doc/jsdoc-toolkit/app/test/constructs.js +18 -0
- data/doc/jsdoc-toolkit/app/test/encoding.js +10 -0
- data/doc/jsdoc-toolkit/app/test/encoding_other.js +12 -0
- data/doc/jsdoc-toolkit/app/test/event.js +54 -0
- data/doc/jsdoc-toolkit/app/test/exports.js +14 -0
- data/doc/jsdoc-toolkit/app/test/functions_anon.js +39 -0
- data/doc/jsdoc-toolkit/app/test/functions_nested.js +33 -0
- data/doc/jsdoc-toolkit/app/test/global.js +13 -0
- data/doc/jsdoc-toolkit/app/test/globals.js +25 -0
- data/doc/jsdoc-toolkit/app/test/ignore.js +10 -0
- data/doc/jsdoc-toolkit/app/test/inner.js +16 -0
- data/doc/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
- data/doc/jsdoc-toolkit/app/test/lend.js +33 -0
- data/doc/jsdoc-toolkit/app/test/memberof.js +19 -0
- data/doc/jsdoc-toolkit/app/test/memberof2.js +38 -0
- data/doc/jsdoc-toolkit/app/test/memberof3.js +33 -0
- data/doc/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
- data/doc/jsdoc-toolkit/app/test/module.js +17 -0
- data/doc/jsdoc-toolkit/app/test/multi_methods.js +25 -0
- data/doc/jsdoc-toolkit/app/test/name.js +19 -0
- data/doc/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
- data/doc/jsdoc-toolkit/app/test/nocode.js +13 -0
- data/doc/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
- data/doc/jsdoc-toolkit/app/test/overview.js +20 -0
- data/doc/jsdoc-toolkit/app/test/param_inline.js +37 -0
- data/doc/jsdoc-toolkit/app/test/params_optional.js +8 -0
- data/doc/jsdoc-toolkit/app/test/prototype.js +17 -0
- data/doc/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
- data/doc/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
- data/doc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
- data/doc/jsdoc-toolkit/app/test/public.js +10 -0
- data/doc/jsdoc-toolkit/app/test/scripts/code.js +5 -0
- data/doc/jsdoc-toolkit/app/test/scripts/notcode.txt +5 -0
- data/doc/jsdoc-toolkit/app/test/shared.js +42 -0
- data/doc/jsdoc-toolkit/app/test/shared2.js +2 -0
- data/doc/jsdoc-toolkit/app/test/shortcuts.js +22 -0
- data/doc/jsdoc-toolkit/app/test/static_this.js +13 -0
- data/doc/jsdoc-toolkit/app/test/synonyms.js +31 -0
- data/doc/jsdoc-toolkit/app/test/tosource.js +23 -0
- data/doc/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
- data/doc/jsdoc-toolkit/conf/sample.conf +31 -0
- data/doc/jsdoc-toolkit/java/build.xml +36 -0
- data/doc/jsdoc-toolkit/java/build_1.4.xml +36 -0
- data/doc/jsdoc-toolkit/java/classes/js.jar +0 -0
- data/doc/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
- data/doc/jsdoc-toolkit/java/src/JsRun.java +21 -0
- data/doc/jsdoc-toolkit/jsdebug.jar +0 -0
- data/doc/jsdoc-toolkit/jsrun.jar +0 -0
- data/doc/jsdoc-toolkit/jsrun.sh +52 -0
- data/doc/jsdoc-toolkit/out/jsdoc/files.html +218 -0
- data/doc/jsdoc-toolkit/out/jsdoc/index.html +218 -0
- data/doc/jsdoc-toolkit/out/jsdoc/symbols/Patient.html +546 -0
- data/doc/jsdoc-toolkit/out/jsdoc/symbols/_global_.html +463 -0
- data/doc/jsdoc-toolkit/out/jsdoc/symbols/src/tmp_patient.js.html +89 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/class.tmpl +649 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/publish.js +201 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
- data/doc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
- data/hquery_patientapi.gemspec +14 -0
- data/lib/hquery-patient-api.rb +4 -0
- data/lib/hquery/engine.rb +4 -0
- data/lib/hquery/generator.rb +18 -0
- data/test/fixtures/patient/barry_berry.json +466 -0
- data/test/test_helper.rb +25 -0
- data/test/unit/patient_api_test.rb +178 -0
- metadata +193 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
Copyright 2010 Federal Health Architecture
|
2
|
+
|
3
|
+
Apache License
|
4
|
+
Version 2.0, January 2004
|
5
|
+
http://www.apache.org/licenses/
|
6
|
+
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8
|
+
|
9
|
+
1. Definitions.
|
10
|
+
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
16
|
+
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
18
|
+
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
20
|
+
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
22
|
+
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
24
|
+
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
26
|
+
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
28
|
+
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
30
|
+
|
31
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
32
|
+
|
33
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
34
|
+
|
35
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
36
|
+
|
37
|
+
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
38
|
+
|
39
|
+
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
40
|
+
|
41
|
+
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
42
|
+
|
43
|
+
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
44
|
+
|
45
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
46
|
+
|
47
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
48
|
+
|
49
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
50
|
+
|
51
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
52
|
+
|
53
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
54
|
+
|
55
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
56
|
+
|
57
|
+
END OF TERMS AND CONDITIONS
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
hQuery Patient API
|
2
|
+
=========
|
3
|
+
|
4
|
+
The patient API is a CoffeeScript API for accessing patient information. It defines the model available to queries executing in an [hQuery Gateway](http://github.com/hquery/query-gateway).
|
5
|
+
|
6
|
+
Install Instructions
|
7
|
+
--------------------
|
8
|
+
|
9
|
+
There is no need to install the patientapi directly, it will be pulled into the [hQuery Gateway](http://github.com/hquery/query-gateway) by Bundler during an install.
|
10
|
+
|
11
|
+
See the [hQuery Composer](http://github.com/hquery/query-composer) for installation instructions for both the hQuery Composer and Gateway
|
12
|
+
|
13
|
+
|
14
|
+
License
|
15
|
+
-------
|
16
|
+
|
17
|
+
Copyright 2011 The MITRE Corporation
|
18
|
+
|
19
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
20
|
+
you may not use this file except in compliance with the License.
|
21
|
+
You may obtain a copy of the License at
|
22
|
+
|
23
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
24
|
+
|
25
|
+
Unless required by applicable law or agreed to in writing, software
|
26
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
27
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
28
|
+
See the License for the specific language governing permissions and
|
29
|
+
limitations under the License.
|
30
|
+
|
31
|
+
Project Practices
|
32
|
+
-----------------
|
33
|
+
|
34
|
+
Please try to follow our [Coding Style Guides](http://github.com/eedrummer/styleguide). Additionally, we will be using git in a pattern similar to [Vincent Driessen's workflow](http://nvie.com/posts/a-successful-git-branching-model/). While feature branches are encouraged, they are not required to work on the project.
|
data/Rakefile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'sprockets'
|
4
|
+
require 'tilt'
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
task :default => [:test_units]
|
8
|
+
$LOAD_PATH << File.expand_path("../test",__FILE__)
|
9
|
+
desc "Run basic tests"
|
10
|
+
Rake::TestTask.new("test_units") { |t|
|
11
|
+
t.pattern = 'test/unit/*_test.rb'
|
12
|
+
t.verbose = true
|
13
|
+
t.warning = false
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
namespace :doc do
|
18
|
+
task :generate_js do
|
19
|
+
ctx = Sprockets::Environment.new(File.expand_path("../", __FILE__))
|
20
|
+
Tilt::CoffeeScriptTemplate.default_bare=true
|
21
|
+
ctx.append_path "app/assets/javascripts"
|
22
|
+
api = ctx.find_asset('patient')
|
23
|
+
|
24
|
+
Dir.mkdir('tmp') unless Dir.exists?( 'tmp')
|
25
|
+
|
26
|
+
File.open('tmp/patient.js', 'w+') do |js_file|
|
27
|
+
js_file.write api
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Generate docs for patient API"
|
32
|
+
task :js => :generate_js do
|
33
|
+
system 'java -jar ./doc/jsdoc-toolkit/jsrun.jar ./doc/jsdoc-toolkit/app/run.js -t=doc/jsdoc-toolkit/templates/jsdoc -a tmp/patient.js -d=doc/patient-api'
|
34
|
+
end
|
35
|
+
|
36
|
+
task :copydir do
|
37
|
+
Dir.mkdir('patientapi') unless Dir.exists? ('patientapi')
|
38
|
+
cp_r "doc/patient-api", "../query-composer/public/patientapi"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,79 @@
|
|
1
|
+
###*
|
2
|
+
@namespace scoping into the hquery namespace
|
3
|
+
###
|
4
|
+
this.hQuery ||= {}
|
5
|
+
|
6
|
+
# =require core.coffee
|
7
|
+
|
8
|
+
###*
|
9
|
+
@class
|
10
|
+
@augments hQuery.CodedEntry
|
11
|
+
@exports Allergy as hQuery.Allergy
|
12
|
+
###
|
13
|
+
class hQuery.Allergy extends hQuery.CodedEntry
|
14
|
+
constructor: (@json) ->
|
15
|
+
super(@json)
|
16
|
+
|
17
|
+
###*
|
18
|
+
Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA
|
19
|
+
http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm
|
20
|
+
|
21
|
+
Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types
|
22
|
+
of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or
|
23
|
+
Chemical Structure - N0000000002. NUI will be used as the concept code.
|
24
|
+
For more information, please see the Web Site
|
25
|
+
http://www.cancer.gov/cancertopics/terminologyresources/page5
|
26
|
+
|
27
|
+
Allergies to a specific medication shall use RxNorm for the values.
|
28
|
+
@returns {CodedValue}
|
29
|
+
###
|
30
|
+
product: -> this.type()
|
31
|
+
|
32
|
+
###*
|
33
|
+
Date of allergy or adverse event
|
34
|
+
@returns{Date}
|
35
|
+
###
|
36
|
+
adverseEventDate: -> dateFromUtcSeconds @json['adverseEventDate']
|
37
|
+
|
38
|
+
###*
|
39
|
+
Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type
|
40
|
+
@returns {CodedValue}
|
41
|
+
###
|
42
|
+
adverseEventType: -> new hQuery.CodedValue @json['type']['code'], @json['type']['codeSystem']
|
43
|
+
|
44
|
+
###*
|
45
|
+
This indicates the reaction that may be caused by the product or agent.
|
46
|
+
It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.
|
47
|
+
420134006 Propensity to adverse reactions (disorder)
|
48
|
+
418038007 Propensity to adverse reactions to substance (disorder)
|
49
|
+
419511003 Propensity to adverse reactions to drug (disorder)
|
50
|
+
418471000 Propensity to adverse reactions to food (disorder)
|
51
|
+
419199007 Allergy to substance (disorder)
|
52
|
+
416098002 Drug allergy (disorder)
|
53
|
+
414285001 Food allergy (disorder)
|
54
|
+
59037007 Drug intolerance (disorder)
|
55
|
+
235719002 Food intolerance (disorder)
|
56
|
+
@returns {CodedValue}
|
57
|
+
###
|
58
|
+
reaction: -> new hQuery.CodedValue @json['reaction']['code'], @json['reaction']['codeSystem']
|
59
|
+
|
60
|
+
###*
|
61
|
+
This is a description of the level of the severity of the allergy or intolerance.
|
62
|
+
Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8
|
63
|
+
255604002 Mild
|
64
|
+
371923003 Mild to Moderate
|
65
|
+
6736007 Moderate
|
66
|
+
371924009 Moderate to Severe
|
67
|
+
24484000 Severe
|
68
|
+
399166001 Fatal
|
69
|
+
@returns {CodedValue}
|
70
|
+
###
|
71
|
+
severity: -> new hQuery.CodedValue @json['severity']['code'], @json['severity']['codeSystem']
|
72
|
+
|
73
|
+
###*
|
74
|
+
Additional comment or textual information
|
75
|
+
@returns {String}
|
76
|
+
###
|
77
|
+
comment: -> @json['comment']
|
78
|
+
|
79
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
###*
|
2
|
+
@namespace scoping into the hquery namespace
|
3
|
+
###
|
4
|
+
this.hQuery ||= {}
|
5
|
+
|
6
|
+
# =require core.coffee
|
7
|
+
|
8
|
+
###*
|
9
|
+
|
10
|
+
The plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.
|
11
|
+
|
12
|
+
@exports CareGoal as hQuery.CareGoal
|
13
|
+
@augments hQuery.CodedEntry
|
14
|
+
###
|
15
|
+
class hQuery.CareGoal extends hQuery.CodedEntry
|
16
|
+
|
17
|
+
constructor: (@json) ->
|
18
|
+
super(@json)
|
@@ -0,0 +1,88 @@
|
|
1
|
+
###*
|
2
|
+
@namespace scoping into the hquery namespace
|
3
|
+
###
|
4
|
+
this.hQuery ||= {}
|
5
|
+
|
6
|
+
# =require core.coffee
|
7
|
+
|
8
|
+
|
9
|
+
###*
|
10
|
+
@class CauseOfDeath
|
11
|
+
@exports CauseOfDeath as hQuery.CauseOfDeath
|
12
|
+
###
|
13
|
+
class hQuery.CauseOfDeath
|
14
|
+
constructor: (@json) ->
|
15
|
+
|
16
|
+
###*
|
17
|
+
@returns {hQuery.Date}
|
18
|
+
###
|
19
|
+
timeOfDeath: -> new hQuery.dateFromUtcSeconds @json['timeOfDeath']
|
20
|
+
|
21
|
+
###*
|
22
|
+
@returns {int}
|
23
|
+
###
|
24
|
+
ageAtDeath: -> @json['ageAtDeath']
|
25
|
+
|
26
|
+
###*
|
27
|
+
@class hQuery.Condition
|
28
|
+
|
29
|
+
This section is used to describe a patients problems/conditions. The types of conditions
|
30
|
+
described have been constrained to the SNOMED CT Problem Type code set. An unbounded
|
31
|
+
number of treating providers for the particular condition can be supplied.
|
32
|
+
@exports Condition as hQuery.Condition
|
33
|
+
@augments hQuery.CodedEntry
|
34
|
+
###
|
35
|
+
class hQuery.Condition extends hQuery.CodedEntry
|
36
|
+
|
37
|
+
constructor: (@json) ->
|
38
|
+
super(@json)
|
39
|
+
|
40
|
+
###*
|
41
|
+
@returns {Array, hQuery.Provider} an array of providers for the condition
|
42
|
+
###
|
43
|
+
providers: ->
|
44
|
+
for provider in @json['treatingProviders']
|
45
|
+
new Provider provider
|
46
|
+
|
47
|
+
###*
|
48
|
+
Diagnosis Priority
|
49
|
+
@returns {int}
|
50
|
+
###
|
51
|
+
diagnosisPriority: -> @json['priority']
|
52
|
+
|
53
|
+
###*
|
54
|
+
Ordinality
|
55
|
+
@returns {CodedValue}
|
56
|
+
###
|
57
|
+
ordinality: -> new hQuery.CodedValue @json['ordinality_code']['code'], @json['ordinality_code']['codeSystem']
|
58
|
+
|
59
|
+
###*
|
60
|
+
age at onset
|
61
|
+
@returns {int}
|
62
|
+
###
|
63
|
+
ageAtOnset: -> @json['ageAtOnset']
|
64
|
+
|
65
|
+
|
66
|
+
###*
|
67
|
+
cause of death
|
68
|
+
@returns {hQuery.CauseOfDeath}
|
69
|
+
###
|
70
|
+
causeOfDeath: -> new hQuery.CauseOfDeath @json['causeOfDeath']
|
71
|
+
|
72
|
+
###*
|
73
|
+
problem status
|
74
|
+
@returns {hQuery.CodedValue}
|
75
|
+
###
|
76
|
+
problemStatus: -> new hQuery.CodedValue @json['problemStatus']['code'], @json['problemStatus']['codeSystem']
|
77
|
+
|
78
|
+
###*
|
79
|
+
comment
|
80
|
+
@returns {String}
|
81
|
+
###
|
82
|
+
comment: -> @json['comment']
|
83
|
+
|
84
|
+
###*
|
85
|
+
This is a description of the level of the severity of the condition.
|
86
|
+
@returns {CodedValue}
|
87
|
+
###
|
88
|
+
severity: -> new hQuery.CodedValue @json['severity']['code'], @json['severity']['codeSystem']
|
@@ -0,0 +1,556 @@
|
|
1
|
+
###*
|
2
|
+
@namespace scoping into the hquery namespace
|
3
|
+
###
|
4
|
+
this.hQuery ||= {}
|
5
|
+
|
6
|
+
###*
|
7
|
+
Converts a a number in UTC Seconds since the epoch to a date.
|
8
|
+
@param {number} utcSeconds seconds since the epoch in UTC
|
9
|
+
@returns {Date}
|
10
|
+
@function
|
11
|
+
@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds
|
12
|
+
###
|
13
|
+
hQuery.dateFromUtcSeconds = (utcSeconds) ->
|
14
|
+
new Date utcSeconds * 1000
|
15
|
+
|
16
|
+
###*
|
17
|
+
@class Scalar - a representation of a unit and value
|
18
|
+
@exports Scalar as hQuery.Scalar
|
19
|
+
###
|
20
|
+
class hQuery.Scalar
|
21
|
+
constructor: (@json) ->
|
22
|
+
unit: -> @json['unit']
|
23
|
+
value: -> @json['value']
|
24
|
+
|
25
|
+
###*
|
26
|
+
@class PhysicalQuantity - a representation of a physical quantity
|
27
|
+
@exports PhysicalQuantity as hQuery.PhysicalQuantity
|
28
|
+
###
|
29
|
+
class hQuery.PhysicalQuantity
|
30
|
+
constructor: (@json) ->
|
31
|
+
units: -> @json['units']
|
32
|
+
scalar: -> parseFloat(@json['scalar'])
|
33
|
+
|
34
|
+
###*
|
35
|
+
@class A code with its corresponding code system
|
36
|
+
@exports CodedValue as hQuery.CodedValue
|
37
|
+
###
|
38
|
+
class hQuery.CodedValue
|
39
|
+
###*
|
40
|
+
@param {String} c value of the code
|
41
|
+
@param {String} csn name of the code system that the code belongs to
|
42
|
+
@constructs
|
43
|
+
###
|
44
|
+
constructor: (@c, @csn) ->
|
45
|
+
|
46
|
+
###*
|
47
|
+
@returns {String} the code
|
48
|
+
###
|
49
|
+
code: -> @c
|
50
|
+
|
51
|
+
###*
|
52
|
+
@returns {String} the code system name
|
53
|
+
###
|
54
|
+
codeSystemName: -> @csn
|
55
|
+
|
56
|
+
@normalize: (val) ->
|
57
|
+
String(val).toLowerCase()
|
58
|
+
|
59
|
+
###*
|
60
|
+
Returns true if the contained code and codeSystemName match a code in the supplied codeSet.
|
61
|
+
@param {Object} codeSet a hash with code system names as keys and an array of codes as values
|
62
|
+
@returns {boolean}
|
63
|
+
###
|
64
|
+
includedIn: (codeSet) ->
|
65
|
+
for codeSystemName, codes of codeSet
|
66
|
+
if @csn==codeSystemName
|
67
|
+
for code in codes
|
68
|
+
c1 = hQuery.CodedValue.normalize(code)
|
69
|
+
c2 = hQuery.CodedValue.normalize(@c)
|
70
|
+
if c1==c2
|
71
|
+
return true
|
72
|
+
return false
|
73
|
+
|
74
|
+
###*
|
75
|
+
Status as defined by value set 2.16.840.1.113883.5.14,
|
76
|
+
the ActStatus vocabulary maintained by HL7
|
77
|
+
|
78
|
+
@class Status
|
79
|
+
@augments hQuery.CodedEntry
|
80
|
+
@exports Status as hQuery.Status
|
81
|
+
###
|
82
|
+
class hQuery.Status extends hQuery.CodedValue
|
83
|
+
NORMAL = "normal"
|
84
|
+
ABORTED = "aborted"
|
85
|
+
ACTIVE = "active"
|
86
|
+
CANCELLED = "cancelled"
|
87
|
+
COMPLETED = "completed"
|
88
|
+
HELD = "held"
|
89
|
+
NEW = "new"
|
90
|
+
SUSPENDED = "suspended"
|
91
|
+
NULLIFIED = "nullified"
|
92
|
+
OBSOLETE = "obsolete"
|
93
|
+
|
94
|
+
isNormal: -> @c is NORMAL
|
95
|
+
isAborted: -> @c is ABORTED
|
96
|
+
isActive: -> @c is ACTIVE
|
97
|
+
isCancelled: -> @c is CANCELLED
|
98
|
+
isCompleted: -> @c is COMPLETED
|
99
|
+
isHeld: -> @c is HELD
|
100
|
+
isNew: -> @c is NEW
|
101
|
+
isSuspended: -> @c is SUSPENDED
|
102
|
+
isNullified: -> @c is NULLIFIED
|
103
|
+
isObsolete: -> @c is OBSOLETE
|
104
|
+
|
105
|
+
|
106
|
+
###*
|
107
|
+
@class an Address for a person or organization
|
108
|
+
@exports Address as hQuery.Address
|
109
|
+
###
|
110
|
+
class hQuery.Address
|
111
|
+
constructor: (@json) ->
|
112
|
+
###*
|
113
|
+
@returns {Array[String]} the street addresses
|
114
|
+
###
|
115
|
+
street: -> @json['street']
|
116
|
+
###*
|
117
|
+
@returns {String} the city
|
118
|
+
###
|
119
|
+
city: -> @json['city']
|
120
|
+
###*
|
121
|
+
@returns {String} the State
|
122
|
+
###
|
123
|
+
state: -> @json['state']
|
124
|
+
###*
|
125
|
+
@returns {String} the postal code
|
126
|
+
###
|
127
|
+
postalCode: -> @json['zip']
|
128
|
+
|
129
|
+
|
130
|
+
###*
|
131
|
+
@class An object that describes a means to contact an entity. This is used to represent
|
132
|
+
phone numbers, email addresses, instant messaging accounts etc.
|
133
|
+
@exports Telecom as hQuery.Telecom
|
134
|
+
###
|
135
|
+
class hQuery.Telecom
|
136
|
+
constructor: (@json) ->
|
137
|
+
|
138
|
+
###*
|
139
|
+
@returns {String} the type of telecom entry, phone, sms, email ....
|
140
|
+
###
|
141
|
+
type: -> @json['type']
|
142
|
+
|
143
|
+
###*
|
144
|
+
@returns {String} the value of the entry - the actual phone number , email address , ....
|
145
|
+
###
|
146
|
+
value: -> @json['value']
|
147
|
+
|
148
|
+
###*
|
149
|
+
@returns {String} the use of the entry. Is it a home, office, .... type of contact
|
150
|
+
###
|
151
|
+
use: -> @json['use']
|
152
|
+
|
153
|
+
###*
|
154
|
+
@returns {Boolean} is this a preferred form of contact
|
155
|
+
###
|
156
|
+
preferred: -> @json['preferred']
|
157
|
+
|
158
|
+
|
159
|
+
###*
|
160
|
+
@class an object that describes a person. includes a persons name, addresses, and contact information
|
161
|
+
@exports Person as hQuery.Person
|
162
|
+
###
|
163
|
+
class hQuery.Person
|
164
|
+
constructor: (@json) ->
|
165
|
+
###*
|
166
|
+
@returns {String} the given name of the person
|
167
|
+
###
|
168
|
+
given: -> @json['first']
|
169
|
+
|
170
|
+
###*
|
171
|
+
@returns {String} the last/family name of the person
|
172
|
+
###
|
173
|
+
last: -> @json['last']
|
174
|
+
|
175
|
+
###*
|
176
|
+
@returns {String} the display name of the person
|
177
|
+
###
|
178
|
+
name: ->
|
179
|
+
if @json['name']
|
180
|
+
@json['name']
|
181
|
+
else
|
182
|
+
@json['first'] + ' ' + @json['last']
|
183
|
+
|
184
|
+
###*
|
185
|
+
@returns {Array} an array of {@link hQuery.Address} objects associated with the patient
|
186
|
+
###
|
187
|
+
addresses: ->
|
188
|
+
list = []
|
189
|
+
if @json['addresses']
|
190
|
+
for address in @json['addresses']
|
191
|
+
list.push(new hQuery.Address(address))
|
192
|
+
list
|
193
|
+
|
194
|
+
###*
|
195
|
+
@returns {Array} an array of {@link hQuery.Telecom} objects associated with the person
|
196
|
+
###
|
197
|
+
telecoms: ->
|
198
|
+
for tel in @json['telecoms']
|
199
|
+
new hQuery.Telecom tel
|
200
|
+
|
201
|
+
|
202
|
+
###*
|
203
|
+
@class an actor is either a person or an organization
|
204
|
+
@exports Actor as hQuery.Actor
|
205
|
+
###
|
206
|
+
class hQuery.Actor
|
207
|
+
constructor: (@json) ->
|
208
|
+
person: ->
|
209
|
+
if @json['person']
|
210
|
+
new hQuery.Person @json['person']
|
211
|
+
organization: ->
|
212
|
+
if @json['organization']
|
213
|
+
new hQuery.Organization @json['organization']
|
214
|
+
|
215
|
+
|
216
|
+
###*
|
217
|
+
@class an Organization
|
218
|
+
@exports Organization as hQuery.Organization
|
219
|
+
###
|
220
|
+
class hQuery.Organization
|
221
|
+
constructor: (@json) ->
|
222
|
+
|
223
|
+
###*
|
224
|
+
@returns {String} the id for the organization
|
225
|
+
###
|
226
|
+
organizationId: -> @json['organizationId']
|
227
|
+
|
228
|
+
###*
|
229
|
+
@returns {String} the name of the organization
|
230
|
+
###
|
231
|
+
organizationName: -> @json['name']
|
232
|
+
|
233
|
+
###*
|
234
|
+
@returns {Array} an array of {@link hQuery.Address} objects associated with the organization
|
235
|
+
###
|
236
|
+
addresses: ->
|
237
|
+
list = []
|
238
|
+
if @json['addresses']
|
239
|
+
for address in @json['addresses']
|
240
|
+
list.push(new hQuery.Address(address))
|
241
|
+
list
|
242
|
+
|
243
|
+
###*
|
244
|
+
@returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization
|
245
|
+
###
|
246
|
+
telecoms: ->
|
247
|
+
for tel in @json['telecoms']
|
248
|
+
new hQuery.Telecom tel
|
249
|
+
|
250
|
+
###*
|
251
|
+
@class a Facility
|
252
|
+
@exports Organization as hQuery.Facility
|
253
|
+
###
|
254
|
+
class hQuery.Facility extends hQuery.CodedValue
|
255
|
+
constructor: (@json) ->
|
256
|
+
if @json['code']?
|
257
|
+
super @json['code']['code'], @json['code']['codeSystem']
|
258
|
+
if @json['start_time']
|
259
|
+
@_startDate = hQuery.dateFromUtcSeconds @json['start_time']
|
260
|
+
if @json['end_time']
|
261
|
+
@_endDate = hQuery.dateFromUtcSeconds @json['end_time']
|
262
|
+
|
263
|
+
###*
|
264
|
+
@returns {String} the name of the facility
|
265
|
+
###
|
266
|
+
name: -> @json['name']
|
267
|
+
|
268
|
+
###*
|
269
|
+
Date and time at which the coded entry started
|
270
|
+
@returns {Date}
|
271
|
+
###
|
272
|
+
startDate: -> @_startDate
|
273
|
+
|
274
|
+
###*
|
275
|
+
Date and time at which the coded entry ended
|
276
|
+
@returns {Date}
|
277
|
+
###
|
278
|
+
endDate: -> @_endDate
|
279
|
+
|
280
|
+
|
281
|
+
###*
|
282
|
+
@returns {Array} an array of {@link hQuery.Address} objects associated with the facility
|
283
|
+
###
|
284
|
+
addresses: ->
|
285
|
+
list = []
|
286
|
+
if @json['addresses']
|
287
|
+
for address in @json['addresses']
|
288
|
+
list.push(new hQuery.Address(address))
|
289
|
+
list
|
290
|
+
|
291
|
+
###*
|
292
|
+
@returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility
|
293
|
+
###
|
294
|
+
telecoms: ->
|
295
|
+
for tel in @json['telecoms']
|
296
|
+
new hQuery.Telecom tel
|
297
|
+
|
298
|
+
|
299
|
+
###*
|
300
|
+
@class represents a DateRange in the form of hi and low date values.
|
301
|
+
@exports DateRange as hQuery.DateRange
|
302
|
+
###
|
303
|
+
class hQuery.DateRange
|
304
|
+
constructor: (@json) ->
|
305
|
+
hi: ->
|
306
|
+
if @json['hi']
|
307
|
+
hQuery.dateFromUtcSeconds @json['hi']
|
308
|
+
low: ->
|
309
|
+
hQuery.dateFromUtcSeconds @json['low']
|
310
|
+
|
311
|
+
###*
|
312
|
+
@class Class used to describe an entity that is providing some form of information. This does not mean that they are
|
313
|
+
providing any treatment just that they are providing information.
|
314
|
+
@exports Informant as hQuery.Informant
|
315
|
+
###
|
316
|
+
class hQuery.Informant
|
317
|
+
constructor: (@json) ->
|
318
|
+
###*
|
319
|
+
an array of hQuery.Person objects as points of contact
|
320
|
+
@returns {Array}
|
321
|
+
###
|
322
|
+
contacts: ->
|
323
|
+
for contact in @json['contacts']
|
324
|
+
new hQuery.Person contact
|
325
|
+
###*
|
326
|
+
@returns {hQuery.Organization} the organization providing the information
|
327
|
+
###
|
328
|
+
organization: -> new hQuery.Organization @json['organization']
|
329
|
+
|
330
|
+
###*
|
331
|
+
@class
|
332
|
+
@exports CodedEntry as hQuery.CodedEntry
|
333
|
+
###
|
334
|
+
class hQuery.CodedEntry
|
335
|
+
constructor: (@json) ->
|
336
|
+
if @json['time']
|
337
|
+
@_date = hQuery.dateFromUtcSeconds @json['time']
|
338
|
+
if @json['start_time']
|
339
|
+
@_startDate = hQuery.dateFromUtcSeconds @json['start_time']
|
340
|
+
if @json['end_time']
|
341
|
+
@_endDate = hQuery.dateFromUtcSeconds @json['end_time']
|
342
|
+
@_type = hQuery.createCodedValues @json['codes']
|
343
|
+
@_statusCode = @json['status_code']
|
344
|
+
# id of the entry from the database
|
345
|
+
@id = @json['_id']
|
346
|
+
# id of the entry from the source document if available
|
347
|
+
@source_id = @json['id']
|
348
|
+
@_freeTextType = @json['description']
|
349
|
+
|
350
|
+
###*
|
351
|
+
Date and time at which the coded entry took place
|
352
|
+
@returns {Date}
|
353
|
+
###
|
354
|
+
date: -> @_date
|
355
|
+
|
356
|
+
###*
|
357
|
+
Date and time at which the coded entry started
|
358
|
+
@returns {Date}
|
359
|
+
###
|
360
|
+
startDate: -> @_startDate
|
361
|
+
|
362
|
+
###*
|
363
|
+
Date and time at which the coded entry ended
|
364
|
+
@returns {Date}
|
365
|
+
###
|
366
|
+
endDate: -> @_endDate
|
367
|
+
|
368
|
+
###*
|
369
|
+
Tries to find a single point in time for this entry. Will first return date if it is present,
|
370
|
+
then fall back to startDate and finally endDate
|
371
|
+
@returns {Date}
|
372
|
+
###
|
373
|
+
timeStamp: -> @_date || @_startDate || @_endDate
|
374
|
+
|
375
|
+
###*
|
376
|
+
Determines whether the entry specifies a time range or not
|
377
|
+
@returns {boolean}
|
378
|
+
###
|
379
|
+
isTimeRange: -> @_startDate? && @_endDate?
|
380
|
+
|
381
|
+
###*
|
382
|
+
Determines whether a coded entry contains sufficient information (code and at least
|
383
|
+
one time stamp) to be usable
|
384
|
+
@returns {boolean}
|
385
|
+
###
|
386
|
+
isUsable: -> @_type.length>0 && (@_date || @_startDate || @_endDate)
|
387
|
+
|
388
|
+
###*
|
389
|
+
An Array of CodedValues which describe what kind of coded entry took place
|
390
|
+
@returns {Array}
|
391
|
+
###
|
392
|
+
type: -> @_type
|
393
|
+
|
394
|
+
###*
|
395
|
+
A free text description of the type of coded entry
|
396
|
+
@returns {String}
|
397
|
+
###
|
398
|
+
freeTextType: -> @_freeTextType
|
399
|
+
|
400
|
+
###*
|
401
|
+
Status for this coded entry
|
402
|
+
@returns {String}
|
403
|
+
###
|
404
|
+
status: ->
|
405
|
+
if @_statusCode?
|
406
|
+
if @_statusCode['HL7 ActStatus']?
|
407
|
+
return @_statusCode['HL7 ActStatus'][0]
|
408
|
+
else if @_statusCode['SNOMED-CT']?
|
409
|
+
switch @_statusCode['SNOMED-CT'][0]
|
410
|
+
when '55561003'
|
411
|
+
'active'
|
412
|
+
when '73425007'
|
413
|
+
'inactive'
|
414
|
+
when '413322009'
|
415
|
+
'resolved'
|
416
|
+
|
417
|
+
###*
|
418
|
+
Status for this coded entry
|
419
|
+
@returns {Hash} keys are code systems, values are arrays of codes
|
420
|
+
###
|
421
|
+
statusCode: -> @_statusCode
|
422
|
+
|
423
|
+
###*
|
424
|
+
Returns true if any of this entry codes match a code in the supplied codeSet.
|
425
|
+
@param {Object} codeSet a hash with code system names as keys and an array of codes as values
|
426
|
+
@returns {boolean}
|
427
|
+
###
|
428
|
+
includesCodeFrom: (codeSet) ->
|
429
|
+
for codedValue in @_type
|
430
|
+
if codedValue.includedIn(codeSet)
|
431
|
+
return true
|
432
|
+
return false
|
433
|
+
|
434
|
+
###*
|
435
|
+
@returns {Boolean} whether the entry was negated
|
436
|
+
###
|
437
|
+
negationInd: -> @json['negationInd'] || false
|
438
|
+
|
439
|
+
###*
|
440
|
+
Returns the values of the result. This will return an array that contains
|
441
|
+
PhysicalQuantity or CodedValue objects depending on the result type.
|
442
|
+
@returns {Array} containing either PhysicalQuantity and/or CodedValues
|
443
|
+
###
|
444
|
+
values: ->
|
445
|
+
values = []
|
446
|
+
if @json['values']
|
447
|
+
for value in @json['values']
|
448
|
+
if value['scalar']?
|
449
|
+
values.push new hQuery.PhysicalQuantity value
|
450
|
+
else
|
451
|
+
values = values.concat hQuery.createCodedValues value.codes
|
452
|
+
values
|
453
|
+
|
454
|
+
|
455
|
+
###*
|
456
|
+
Indicates the reason an entry was negated.
|
457
|
+
@returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.
|
458
|
+
###
|
459
|
+
negationReason: ->
|
460
|
+
if @json['negationReason'] && @json['negationReason']['code'] && @json['negationReason']['codeSystem']
|
461
|
+
new hQuery.CodedValue @json['negationReason']['code'], @json['negationReason']['codeSystem']
|
462
|
+
else
|
463
|
+
null
|
464
|
+
|
465
|
+
###*
|
466
|
+
@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching
|
467
|
+
entries based on codes and date ranges
|
468
|
+
@exports CodedEntryList as hQuery.CodedEntryList
|
469
|
+
###
|
470
|
+
class hQuery.CodedEntryList extends Array
|
471
|
+
constructor: ->
|
472
|
+
@push arguments...
|
473
|
+
|
474
|
+
###*
|
475
|
+
Push the supplied entry onto this list if it is usable
|
476
|
+
@param {CodedEntry} a coded entry that should be added to the list if it is usable
|
477
|
+
###
|
478
|
+
pushIfUsable: (entry) ->
|
479
|
+
if entry.isUsable()
|
480
|
+
this.push(entry)
|
481
|
+
|
482
|
+
###*
|
483
|
+
Return the number of entries that match the
|
484
|
+
supplied code set where those entries occur between the supplied time bounds
|
485
|
+
@param {Object} codeSet a hash with code system names as keys and an array of codes as values
|
486
|
+
@param {Date} start the start of the period during which the entry must occur, a null value will match all times
|
487
|
+
@param {Date} end the end of the period during which the entry must occur, a null value will match all times
|
488
|
+
@param {boolean} includeNegated whether the returned list of entries should include those that have been negated
|
489
|
+
@return {CodedEntryList} the matching entries
|
490
|
+
###
|
491
|
+
match: (codeSet, start, end, includeNegated=false) ->
|
492
|
+
cloned = new hQuery.CodedEntryList()
|
493
|
+
for entry in this
|
494
|
+
afterStart = (!start || entry.timeStamp()>=start)
|
495
|
+
beforeEnd = (!end || entry.timeStamp()<=end)
|
496
|
+
if (afterStart && beforeEnd && entry.includesCodeFrom(codeSet) && (includeNegated || !entry.negationInd()))
|
497
|
+
cloned.push(entry)
|
498
|
+
cloned
|
499
|
+
|
500
|
+
###*
|
501
|
+
Return a new list of entries that is the result of concatenating the passed in entries with this list
|
502
|
+
@return {CodedEntryList} the set of concatenated entries
|
503
|
+
###
|
504
|
+
concat: (otherEntries) ->
|
505
|
+
cloned = new hQuery.CodedEntryList()
|
506
|
+
for entry in this
|
507
|
+
cloned.push entry
|
508
|
+
for entry in otherEntries
|
509
|
+
cloned.push entry
|
510
|
+
cloned
|
511
|
+
|
512
|
+
###*
|
513
|
+
Match entries with the specified statuses
|
514
|
+
@return {CodedEntryList} the matching entries
|
515
|
+
###
|
516
|
+
withStatuses: (statuses, includeUndefined=true) ->
|
517
|
+
statuses = statuses.concat([undefined, null]) if includeUndefined
|
518
|
+
cloned = new hQuery.CodedEntryList()
|
519
|
+
for entry in this
|
520
|
+
cloned.push entry if entry.status() in statuses
|
521
|
+
cloned
|
522
|
+
|
523
|
+
###*
|
524
|
+
Filter entries based on negation
|
525
|
+
@param {Object} codeSet a hash with code system names as keys and an array of codes as values
|
526
|
+
@return {CodedEntryList} negated entries
|
527
|
+
###
|
528
|
+
withNegation: (codeSet) ->
|
529
|
+
cloned = new hQuery.CodedEntryList()
|
530
|
+
for entry in this
|
531
|
+
cloned.push entry if entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))
|
532
|
+
cloned
|
533
|
+
|
534
|
+
###*
|
535
|
+
Filter entries based on negation
|
536
|
+
@return {CodedEntryList} non-negated entries
|
537
|
+
###
|
538
|
+
withoutNegation: ->
|
539
|
+
cloned = new hQuery.CodedEntryList()
|
540
|
+
for entry in this
|
541
|
+
cloned.push entry if !entry.negationInd()
|
542
|
+
cloned
|
543
|
+
|
544
|
+
###*
|
545
|
+
@private
|
546
|
+
@function
|
547
|
+
|
548
|
+
###
|
549
|
+
hQuery.createCodedValues = (jsonCodes) ->
|
550
|
+
codedValues = []
|
551
|
+
for codeSystem, codes of jsonCodes
|
552
|
+
for code in codes
|
553
|
+
codedValues.push new hQuery.CodedValue code, codeSystem
|
554
|
+
codedValues
|
555
|
+
|
556
|
+
|