# Organization

Source: https://www.flexpa.com/docs/fhir/organization
Description: Organization is a supporting FHIR resource that is used to represent a payer, provider, or other organization.

GET `https://api.flexpa.com/fhir/Organization`

* [Organization](https://www.hl7.org/fhir/Organization.html) is a base FHIR Resource ( [JSON example](https://www.hl7.org/fhir/Organization-example.json))
* Commonly available via
  * [US Core Organization Profile](https://www.hl7.org/fhir/us/core/StructureDefinition-us-core-organization.html)
  * [C4BB Organization Profile](https://build.fhir.org/ig/HL7/carin-bb/StructureDefinition-C4BB-Organization.html)

**Organization** is a supporting FHIR resource that is used to represent a payer, provider, or other organization.

In contrast to many of the other resources in the Flexpa that are patient-specific, it serves as a foundational resource that supports the clinical and financial resources in the API. For instance, an ExplanationOfBenefit may have been issued by a particular payer Organization.

As a result, Organization is most often used as part of an `include` parameter in a search request to retrieve the related resources or is accessed via a read with a specific FHIR resource ID obtained from a financial or clinical resource.

## Schema

This is Flexpa's supported FHIR schema for the Organization resource.

**Note:**
Flexpa's Organization resource contains the data that the [Endpoint](https://www.flexpa.com/docs/network/directory) sent. When [NPI enrichment](https://www.flexpa.com/docs/records#npis) is enabled for your application, Flexpa also adds data from the official [NPPES](https://npiregistry.cms.hhs.gov/search) database to each Organization that has an NPI. NPI enrichment is a limited-availability capability.

NPPES data is added next to the data that the Endpoint sent and does not replace it, so an Organization can have both the Endpoint's and NPPES's address, telecom, and contact entries. When the Endpoint already sent a name, the NPPES name is added to `alias`.

Filter the top level arrays `identifier`, `telecom`, `address`, `contact`,and `type` with the following function to include only NPPES data points:

```ts
function filterByOfficialNPPESData(element: Element) {
  return element.extension.some(
    (extension) => extension.extension.some(
      (extension) => extension.valueReference?.reference.startsWith('https://npiregistry.cms.hhs.gov')
    )
  );
}

const identifiers = practitioner.identifier.filter(filterByOfficialNPPESData);
const telecoms = practitioner.telecom.filter(filterByOfficialNPPESData);
const addresses = practitioner.address.filter(filterByOfficialNPPESData);
const contacts = practitioner.contact.filter(filterByOfficialNPPESData);
const types = practitioner.type.filter(filterByOfficialNPPESData);
```

## Sample request

This is a sample request using `curl`

```shell
ACCESS_TOKEN=patient-access-token

curl "https://api.flexpa.com/fhir/Organization" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```

## Sample response

This is a sample response from Humana using Flexpa API in [test mode](https://www.flexpa.com/docs/test-mode#health-insurers)
