Skip to main content
Skip table of contents

Creating a pregnancy

Overview

When a Spine Client System wishes to create a new pregnancy record in the Spine, a request is made to the Create Pregnancy endpoint, passing a FHIR Bundle resource within the body of the request in JSON format. The bundle may contain any valid combination of resources relating to the pregnancy, but at a minimum, it must contain:

  • A single Patient resource with Identifier and BirthDate properties populated

  • An Observation resource conforming to at least one of the EDD FHIR Profiles:

    • Observation-BNet-Preg-EDDAgreed

    • Observation-BNet-Preg-EDDbyScan

    • Observation-BNet-Preg-EDDbyDate

If a new pregnancy is successfully created, a response with status code 201 - Created is returned, including headers indicating the Location and Logical ID of the new pregnancy.

If a pregnancy matching all three identifying parameters already exists, the Spine will return a 409 - Conflict status code. In this circumstance, the Spine Client System should make a request to the Find Pregnancy endpoint to obtain the Logical ID for subsequent updates to the record.

Existing Pregnancies without an EDD

If a pregnancy record exists within the BadgerNet database which does not have an EDD but matches on National ID and Date of Birth, then this existing pregnancy will be updated. In this case, a 204 - No Content response is returned, including headers indicating the Location and Logical ID of the updated existing pregnancy.

Request

POST [baseUrl]/Patient/$create-pregnancy

Request Flow

Request Flow - Create Pregnancy

Response

Possible response codes

Code

Description

201

Created

See response headers:
X-Logical-Id to obtain the ID of the created record
Location to obtain the full URL to read the pregnancy

204

No Content

An existing record was updated. See response headers:
X-Logical-Id to obtain the ID of the updated record
Location to obtain the full URL to read the pregnancy

422

Unprocessable Entity

The supplied bundle failed validation

409

Conflict

An existing record matches all three keys supplied in the request

403

Forbidden

An existing record exists, however the client making the request is not a stakeholder in that record

Example

Request Body

JSON
{
    "resourceType": "Bundle",
    "type": "collection",
    "entry": [
        {
            "resource": {
                "resourceType": "Patient",
                "identifier": [
                    {
                        "use": "official",
                        "system": "https://fhir.nhs.uk/Id/nhs-number",
                        "value": "NationalID123"
                    }
                ],
                "name": [
                    {
                        "use": "official",
                        "family": "Solis",
                        "given": [
                            "Gabrielle"
                        ]
                    }
                ],
                "birthDate": "1986-11-01"
            }
        },
        {
            "resource": {
                "resourceType": "Observation",
                "code": {
                    "coding": [
                        {
                            "system": "http://snomed.info/sct",
                            "code": "161714006"
                        }
                    ]
                },
                "valueDateTime": "2023-07-03"
            }
        }
    ]
}

Response

The response’s body does not contain any information on a successful result.

Header Code

Description

201

Pregnancy record has been successfully created

204

An existing pregnancy record has been successfully updated


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.