Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Add RegEx for patients and contacts #314

Open
wants to merge 4 commits into
base: main
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
14 changes: 14 additions & 0 deletions sections/contacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,19 @@ curl https://api.au1.cliniko.com/v1/contacts/1 \

## Create Contact

**Validation**

When creating a contact, setting the contact's country must be done using the `country_code` parameter.
This is the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) country code.

A contact's `doctor_type` may be the string value `general_practitioner` or `specialist`. To clear the value,
set it to `null`.

`email`, if supplied, is validated using the following RegEx in Ruby:
```ruby
/\A[A-Z0-9!#$%&'\*+-\/=?^_`{\|}~]+@[A-Z0-9.-]+\.[A-Z]{2,63}\z/i
```

**Resources**

- `POST /contacts` create a contact
Expand Down Expand Up @@ -196,12 +203,19 @@ Headers { Location: http://api.cliniko.com/contacts/1 }

## Update Contact

**Validation**

When updating a contact, changing the contact's country must be done using the `country_code` parameter.
This is the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) country code.

A contact's `doctor_type` may be the string value `general_practitioner` or `specialist`. To clear the value,
set it to `null`.

`email`, if supplied, is validated using the following RegEx in Ruby:
```ruby
/\A[A-Z0-9!#$%&'\*+-\/=?^_`{\|}~]+@[A-Z0-9.-]+\.[A-Z]{2,63}\z/i
```

**Resources**

- `PUT /contacts/:id` update a contact
Expand Down
14 changes: 14 additions & 0 deletions sections/patients.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,13 @@ curl https://api.au1.cliniko.com/v1/patients/1 \
> The `/patients` endpoint will continue to return a patient's gender, but you may only use the new properties when _creating_ or _updating_ patients. Note that we are not serving the current value of `gender` in either of the new fields - these need to be updated separately, either through the Cliniko UI, or through the API.
> Find more on why we've made this switch here: [Changes coming to patient gender and sex](https://groups.google.com/a/redguava.com.au/forum/#!topic/cliniko-api/H5fXFk_MH98)

**Validation**

Patient records must have a `first_name` and `last_name`. `email`, if supplied, is validated using the following RegEx in Ruby:
```ruby
/\A[A-Z0-9!#$%&'\*+-\/=?^_`{\|}~]+@[A-Z0-9.-]+\.[A-Z]{2,63}\z/i
```

**Resources**

- `POST /patients` create a patient
Expand Down Expand Up @@ -503,6 +510,13 @@ Headers { Location: http://api.cliniko.com/patients/1 }
> The `/patients` endpoint will continue to return a patient's gender, but you may only use the new properties when _creating_ or _updating_ patients. Note that we are not serving the current value of `gender` in either of the new fields - these need to be updated separately, either through the Cliniko UI, or through the API.
> Find more on why we've made this switch here: [Changes coming to patient gender and sex](https://groups.google.com/a/redguava.com.au/forum/#!topic/cliniko-api/H5fXFk_MH98)

**Validation**

Patient records must have a `first_name` and `last_name`. `email`, if supplied, is validated using the following RegEx in Ruby:
```ruby
/\A[A-Z0-9!#$%&'\*+-\/=?^_`{\|}~]+@[A-Z0-9.-]+\.[A-Z]{2,63}\z/i
```

**Resources**

- `PUT /patients/:id` update a patient
Expand Down