This page provides an overview on how and when to configure a schema on
an HL7v2 store to parse HL7v2 messages.

## Default schema

The Cloud Healthcare API uses a default schema to parse HL7v2 messages that conform
to the HL7v2 standard. If your HL7v2 messages conform to the standard, and
do not contain custom segments, fields, or any other data that deviates from
the standard, see [Enable schematized parsing for HL7v2 messages](https://docs.cloud.google.com/healthcare-api/docs/how-tos/hl7v2-default-parser.md.txt).

## Custom schema

If you have HL7v2 messages that don't conform to the HL7v2 standard, see
[Use a custom schema to parse HL7v2 messages](https://docs.cloud.google.com/healthcare-api/docs/how-tos/hl7v2-custom-parser.md.txt).

## Select a parser version

You can specify options for the parser in the [`ParserConfig`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.md.txt#ParserConfig) object, regardless of whether you're using the
default schema or a custom schema. The `ParserConfig` contains a
[`ParserVersion`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.md.txt#ParserVersion)
object that lets you specify a version for the parser. See the [reference documentation](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.md.txt#ParserVersion.ENUM_VALUES) for details on each version.

We recommend that, for all use cases, you specify the
[`V3`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.md.txt#ParserVersion.ENUM_VALUES.V3)
version of the parser. The `V3` version has the following advantages:

- It contains the existing functionality in the `V2` version.
- When used with the default parser, it unescapes the following default escaped
  HL7v2 control characters:

  - Field separator: `|`
  - Component separator: `^`
  - Sub-component separator: `&`
  - Repetition separator: `~`
  - Escape character: `\`
  - Truncation character: `#`
- When used with a custom parser, the `V3` parser uses improved matching
  techniques over the other parser versions.