Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ac-fhir-models

Package Overview
Dependencies
Maintainers
0
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ac-fhir-models - npm Package Compare versions

Comparing version 7.7.3 to 7.7.4

2

package.json
{
"name": "ac-fhir-models",
"version": "7.7.3",
"version": "7.7.4",
"author": "Henrik Joreteg <henrik@anesthesiacharting.com>",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -106,2 +106,6 @@ // @ts-check

},
otherNotes: `
- Starting vitals: 123/80
- History also available in EMR system
`,
attesters: [{ memberId: 'member123', date: new Date().toISOString() }],

@@ -227,2 +231,29 @@ }

},
{
title: 'Other Notes',
code: {
coding: [
{
system:
'https://ns.anesthesiacharting.com/composition-sections',
code: 'other-notes',
display: 'Other Notes',
},
],
},
emptyReason: {
coding: [
{
system:
'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'unavailable',
display: 'Text Only Summary',
},
],
},
text: {
status: 'generated',
div: startProps.otherNotes,
},
},
],

@@ -359,4 +390,4 @@ },

{
system: 'http://snomed.info/sct',
code: '716186003',
system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'nilknown',
display: 'No known allergy',

@@ -372,2 +403,3 @@ },

})
t.test('medications: can set to explicitly has none', t => {

@@ -395,4 +427,4 @@ const composition = healthHistoryDefinition.create({

{
system: 'http://snomed.info/sct',
code: '242571000000102',
system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'nilknown',
display: 'Patient not on medication',

@@ -463,1 +495,72 @@ },

})
test('Can update and remove other notes', t => {
const composition = healthHistoryDefinition.create({
otherNotes: 'Some notes',
})
t.deepEqual(composition.section[0], {
title: 'Other Notes',
code: {
coding: [
{
system: 'https://ns.anesthesiacharting.com/composition-sections',
code: 'other-notes',
display: 'Other Notes',
},
],
},
text: { status: 'generated', div: 'Some notes' },
emptyReason: {
coding: [
{
system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'unavailable',
display: 'Text Only Summary',
},
],
},
})
const updated = healthHistoryDefinition.set(composition, {
otherNotes: 'Updated notes',
})
t.equal(updated.section.length, 1)
t.deepEqual(updated.section[0], {
title: 'Other Notes',
code: {
coding: [
{
system: 'https://ns.anesthesiacharting.com/composition-sections',
code: 'other-notes',
display: 'Other Notes',
},
],
},
emptyReason: {
coding: [
{
system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'unavailable',
display: 'Text Only Summary',
},
],
},
text: { status: 'generated', div: 'Updated notes' },
})
const nulled = healthHistoryDefinition.set(updated, {
otherNotes: null,
})
t.notOk(nulled.section, 'Has no section')
const emptyStringed = healthHistoryDefinition.set(updated, {
otherNotes: '',
})
t.notOk(emptyStringed.section, 'Has no section')
t.end()
})

@@ -73,2 +73,11 @@ // @ts-check

const findSectionPredicate = coding => {
return section =>
section.code &&
section.code.coding &&
section.code.coding.some(
c => c.system === coding.system && c.code === coding.code
)
}
// a section which just serializes the input json into an extension on the section entry

@@ -81,8 +90,4 @@ const getCompositionJsonSectionProp = ({

}) => {
const predicate = section =>
section.code &&
section.code.coding &&
section.code.coding.some(
c => c.system === coding.system && c.code === coding.code
)
const predicate = findSectionPredicate(coding)
return {

@@ -142,9 +147,47 @@ get(data) {

const getCompositionTextOnlySectionProp = ({ title, coding }) => {
const predicate = findSectionPredicate(coding)
return {
get(data) {
const sections = data.section || []
const existingSection = sections.find(predicate)
if (!existingSection) return null
return existingSection.text ? existingSection.text.div : null
},
set(data, value) {
const sections = data.section || []
const length = sections.length
const foundIndex = sections.findIndex(predicate)
const index = foundIndex !== -1 ? foundIndex : length
// If null or empty, we remove the whole section
if (value === null || value.trim() === '') {
return setValue(data, `section.[${index}]`, null)
}
return setValue(data, `section.[${index}]`, {
title,
code: { coding: [coding] },
text: {
status: 'generated',
div: value,
},
emptyReason: {
coding: [
{
system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'unavailable',
display: 'Text Only Summary',
},
],
},
})
},
}
}
const getCompositionSectionSingularEntryProp = ({ title, coding }) => {
const predicate = section =>
section.code &&
section.code.coding &&
section.code.coding.some(
c => c.system === coding.system && c.code === coding.code
)
const predicate = findSectionPredicate(coding)

@@ -201,8 +244,3 @@ return {

}) => {
const predicate = section =>
section.code &&
section.code.coding &&
section.code.coding.some(
c => c.system === coding.system && c.code === coding.code
)
const predicate = findSectionPredicate(coding)

@@ -394,4 +432,4 @@ return {

reasonCoding: {
system: 'http://snomed.info/sct',
code: '716186003',
system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'nilknown',
display: 'No known allergy',

@@ -410,4 +448,4 @@ },

reasonCoding: {
system: 'http://snomed.info/sct',
code: '242571000000102',
system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
code: 'nilknown',
display: 'Patient not on medication',

@@ -417,2 +455,10 @@ },

}),
otherNotes: getCompositionTextOnlySectionProp({
title: 'Other Notes',
coding: {
system: nsCompositionSections,
code: 'other-notes',
display: 'Other Notes',
},
}),
signature: getCompositionJsonSectionProp({

@@ -419,0 +465,0 @@ title: 'Signature',

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc