Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #7

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/assets/javascripts/core.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ class hQuery.Facility extends hQuery.CodedValue
###
endDate: -> @_endDate

###*
The length of stay in this facility in seconds
@returns {Integer}
###
lengthOfStay: -> @json['end_time'] - @json['start_time']

###*
@returns {Array} an array of {@link hQuery.Address} objects associated with the facility
Expand Down
6 changes: 6 additions & 0 deletions app/assets/javascripts/medicalequipment.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ class hQuery.MedicalEquipment extends hQuery.CodedEntry
@returns {CodedValue}
###
anatomicalStructure: -> new hQuery.CodedValue @json['anatomicalStructure']['code'], @json['anatomicalStructure']['codeSystem']

###*
Currently mapped to the end date for the medical equipment
@returns {Date}
###
removalDateTime: -> @endDate()
7 changes: 6 additions & 1 deletion app/assets/javascripts/procedure.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ class hQuery.Procedure extends hQuery.CodedEntry
@returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the
procedure was performed
###
site: -> new hQuery.CodedValue @json['site']['code'], @json['site']['codeSystem']
site: -> new hQuery.CodedValue @json['site']['code'], @json['site']['codeSystem']

###*
@returns {Date} Date/Time when the incision was made during a procedure, if applicable
###
incisionDateTime: -> hQuery.dateFromUtcSeconds @json['incisionDateTime']
5 changes: 4 additions & 1 deletion test/fixtures/patient/barry_berry.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
},
"facility": {
"name": "General Hospital",
"start_time": 1124956803,
"end_time": 1124957003,
"code": {
"code": "1155-1",
"codeSystem": "HL7 Healthcare Service Location"
Expand Down Expand Up @@ -217,7 +219,8 @@
"last": "Tables"
}
},
"description": "Colonscopy"
"description": "Colonscopy",
"incisionDateTime": 1073238725
}
],
"results": [
Expand Down
3 changes: 3 additions & 0 deletions test/unit/patient_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_encounters
assert_equal 'CPT', @context.eval('patient.encounters()[0].reasonForVisit().type()[0].codeSystemName()')
assert_equal 'HL7 Healthcare Service Location', @context.eval('patient.encounters()[0].facility().codeSystemName()')
assert_equal '1155-1', @context.eval('patient.encounters()[0].facility().code()')
assert_equal 200, @context.eval('patient.encounters()[0].facility().lengthOfStay()')
assert_equal 'General Hospital', @context.eval('patient.encounters()[0].facility().name()')
end

Expand All @@ -66,6 +67,7 @@ def test_procedures
assert_equal '71854001', @context.eval('patient.procedures()[0].site().code()')
assert_equal 'Bobby', @context.eval('patient.procedures()[0].performer().person().given()')
assert_equal 'Tables', @context.eval('patient.procedures()[0].performer().person().last()')
assert_equal 1073238725000, @context.eval('patient.procedures()[0].incisionDateTime().getTime()')
end

def test_vital_signs
Expand Down Expand Up @@ -173,6 +175,7 @@ def test_functional_status
def test_medical_equipment
assert_equal 1, @context.eval('patient.medicalEquipment().length')
assert_equal '13648007', @context.eval('patient.medicalEquipment()[0].anatomicalStructure().code()')
assert_equal 1269762693000, @context.eval('patient.medicalEquipment()[0].removalDateTime().getTime()')
end

end