npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@talkasab/body_part_index

v0.0.3

Published

Provides data and simple libraries for manipulating a standard list of anatomic locations.

Downloads

21

Readme

AnatomicLocations

Provides data and simple libraries for manipulating a standard list of anatomic locations.

Installation

npm i @talkasab/body_part_index

BodyPartIndex (Scenarios)

How to open the library?

To open the library, you first need to import it into your project. Then, you can use the BodyPartIndex object.

import { BodyPartIndex } from '@talkasab/body_part_index';

const index = new BodyPartIndex();

How to add local codes?

To add local codes to the library, you need to pass a JSON with the data linking the code to the radlexId.

const index = new BodyPartIndex({
    localBodyPartMappings: [
        {

            localCode: {
                code: '3110',
                system: 'StElsewhere'
            },
            radlexId: 'RID56'
        },
        {

            localCode: {
                code: '31129',
                system: 'StElsewhere'
            },
            radlexId: 'RID905'
        }
    ]
});

How to get a particular body part by RadLex ID, SNOMED, or another code?

To get a body part by id or any code (include local codes), you need to use the get function.

const index = new BodyPartIndex({
    localBodyPartMappings: [
        { 
            localCode: { 
                code: 'THX1138', 
                system: 'LOCAL' 
            }, 
            radlexId: 'RID294' 
        }
    ]
});
const bodyPart = index.get('RID294');
const bodyPart2 = index.get('265256');  // FMA code
const bodyPart3 = index.get('THX1138'); // Local code

This function returns a BodyPart object.

How to get a particular body part by code and system?

To get a body part by code AND system, you need to use the getByCodeAndSystem function.

const index = new BodyPartIndex();
const bodyPart = index.getByCodeAndSystem({
    code: '443167003',
    system: 'SNOMED'
});

This function returns a BodyPart object.

How to search for body parts based on names or synonyms?

The search function will return all the BodyParts that match a specific search value.

const index = new BodyPartIndex();
const bodyParts = index.search('adnexa');

BodyPart (Scenarios)

What can you get from a BodyPart?

const index = new BodyPartIndex();
const bodyPart = index.get('RID294');
bodyPart?.getDescription(); // "uterine adnexa"
bodyPart?.getSexSpecific(); // "Female"
bodyPart?.getSynonyms(); // ["adnexa"]
bodyPart?.getContainedBy(); // BodyPart object; RID2507, pelvis
bodyPart?.getPartOf(); // BodyPart object; RID270, female genital system
bodyPart?.getCodes(); // Array of Codes; [ {"system": "SNOMED", "code": "53065001"}, ... ]

How do deal with sided body parts?

For cases where the body part is sided, the index contains three versions: an unsided version, a left-sided version, and a right-sided version. All of these are aware of each other.

const index = new BodyPartIndex();
const bodyPart = index.get('RID294'); // uterine adnexa (side not specified)
// From the unsided version, get the right- and left-sided versions
const right = bodyPart?.getRight(); // BodyPart object; RID294_RID5825, right uterine adnexa
const left = bodyPart?.getLeft(); // BodyPart object; RID294_RID5824, left uterine adnexa
// From either of the sided versions, can get back to the unsided or to the other side
bodyPart?.isEqual(right?.getUnsided()); // true
right?.isEqual(left?.getRight()); // true

How to determine if one body part is contained by another?

To determine if a one body part is contained by another, use the isContained function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID56');
const bodyPart2 = index.get('RID199');
const isContained = bodyPart2?.isContained(bodyPart1);

How to get the contained children of a body part?

To get the immediate contained children, use the getImmediateContainedChildren function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID39569');
const immediateChildren = bodyPart1?.getImmediateContainedChildren();

To get all the contained children, use the getAllContainedChildren function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID39569');
const children = bodyPart1?.getAllContainedChildren();

How to get the contained ancestors of a body part?

To get the contained ancestors of a body part, use the getAllContainedAncestors function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID480');
const ancestors = bodyPart1?.getAllContainedAncestors();

How to determine if one body part is part of another?

To determine if a one body part is part of another, use the isPartOf function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID480');
const bodyPart2 = index.get('RID905');
const isPartOf = bodyPart2?.isPartOf(bodyPart1);

How to get the partOf children of a body part?

To get the immediate partOf children, use the getImmediatePartOfChildren function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID480');
const immediateChildren = bodyPart1?.getImmediatePartOfChildren();

To get all the partOf children, use the getAllPartOfChildren function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID480');
const children = bodyPart1?.getAllPartOfChildren();

How to get the partOf ancestors of a body part?

To get the partOf ancestors of a body part, use the getAllPartOfAncestors function.

const index = new BodyPartIndex();
const bodyPart1 = index.get('RID579');
const ancestors = bodyPart1?.getAllPartOfAncestors();