# Profile

> The way in which visits need to be performed.

Page: https://docs.icepack.ai/nvd/profile/

## Overview

Profiles represent a set of constraints that are applied over a series of visits. A profile is linked to a [visit](/nvd/visit/) object which defines the customer information (such as location).

### Applicable models

* NVD `nvd-hap0j2y4zlm1`

## Profile

The profile object contains the information regarding the number of visits in this profile and the frequency type. If a non-standard profile is required, a custom cycle can be specified.

### Schema definition

```protobuf
message Profile {
  required eFrequency frequencyType = 1;
  repeated customCycle allowableCycles = 2;  
  optional int32 numVisits = 3;
}
```



### Fields

frequencyType
: The type of frequency applicable in this profile. Frequencies are typically linked to the concept of a week, the length of which is defined in the [configuration](/nvd/configuration/) of the NVD model.

allowableCycles
: A list of allowable cycles if a custom frequency type is used. The length of a custom cycle must correspond to the length of the period specified in the [configuration](/nvd/configuration/).

numVisits
: The number of visits which corresponds to the custom cycles specified in `allowableCycles`. While the number of visits could be derived from the list of `allowableCycles`, this provides a simple checksum to ensure that the user has specified the list of custom cycles correctly.


### Examples
A profile consisting of one visit in a period length of 20 days (with a 5 day week).
```protobuf
frequencyType: ONCE_A_MONTH
```



A profile consisting of four visits in a period length of 20 days (with a 6 day week).
```protobuf
frequencyType: ONCE_A_WEEK
```



A more complex example is provided where the period length is 5 days (with a 5 day week). This particular profile specifies that a visit may either occur on the first or last day in the period (either Monday or Friday).
```protobuf
allowableCycles {
  visitProfile: true
  visitProfile: false
  visitProfile: false
  visitProfile: false
  visitProfile: false
}
allowableCycles {
  visitProfile: false
  visitProfile: false
  visitProfile: false
  visitProfile: false
  visitProfile: true
}
numVisits: 1
```



### Notes

* The most common usage of the NVD model is to simply specify a `frequencyType` which is not custom and use one of the pre-specified frequencies. The use of custom frequencies should ideally be avoided (where possible) as it forces the modeller to abstract the visit rules to a higher level.
* Profiles are very powerful constraints, but they're also what make this model particularly difficult to solve. It specifies an exact visit structure that must be kept between days.

<hr>

## Profile.eFrequency

The profile frequency defines the frequency at which a visit should be performed.

### Schema definition 

```protobuf
enum eFrequency {
  CUSTOM = 0;
  SEVEN_TIMES_A_WEEK = 1;
  SIX_TIMES_A_WEEK = 2;
  FIVE_TIMES_A_WEEK = 3;
  FOUR_TIMES_A_WEEK = 4;
  THREE_TIMES_A_WEEK = 5;
  TWICE_A_WEEK = 6;
  ONCE_A_WEEK = 7;
  EVERY_SECOND_WEEK = 8;
  ONCE_A_MONTH = 9;
```



### Notes

* A frequency should correspond to the length of the period specified in the [configuration](/nvd/configuration/). As an example, a `ONCE_A_MONTH` frequency is invalid for a model which has a period length of 5 (i.e. one week) as the `ONCE_A_MONTH` frequency implicitly requires 4 weeks.

<hr>

## Profile customCycle

A custom cycle is used to define an instance of a feasible visit pattern.

### Schema definition 

```protobuf
message customCycle {
  repeated bool visitProfile = 2;
}
```



### Fields 

visitProfile
: An ordered list of indicators of where in the period a valid **instance** of a profile may exist. The profile allows a list of custom cycles to be specified, allowing an exhaustive manner in which the set of allowable days may be specified.

### Examples

The following example illustrates a single custom cycle which contains two visits, on the first and third days of the period. This would typically be used in conjunction with several other custom cycles which can be provided on a particular profile.

```protobuf
visitProfile: true
visitProfile: false
visitProfile: true
visitProfile: false
visitProfile: false
```



### Notes

* The length of the `customCycle` must correspond to the period length.
* A single common frequency should be used across all custom cycles. I.e. a custom cycle with one visit may not be used in the same profile as a custom cycle with three visits. There are use cases for this style of modelling, but it is currently unsupported by the API. 

<hr>

