Policy Nodes – Working with Nodes and their Output

In the series of articles we are starting today, we will use various simple policy source files and examine the output JavaScript – both in the testing harness and beyond. The goal is to identify potential issues that you can look out for an remediate in your own use of the Policy Node.

Let’s begin with a simple policy document relating to Copyright law. This is based on the old Copyright Permissions project in OPM, with the interview elements stripped out. Here it is:

# Policy: Possible Copyright Permission for Proposed Material Use

## 1. Purpose

This policy determines whether a person might need copyright permission for a proposed use of material. It considers the kind and 
amount of material, the copyright period, the rights involved in the proposed use, existing licences, ownership, and specified exceptions. 
A proposed use outside Australia also satisfies the policy's primary decision.

The outcome is deliberately qualified as **might need permission**. It does not determine that permission is definitely required or grant permission to use the material.

## 2. Inputs

An input marked **Conditional** is needed when the branch using it must be evaluated. A Boolean answer of `false` is a known answer; 
an unanswered value is not. The current date is evaluated when the copyright-period rule is applied.

| Input | Type | Required | Description |
|---|---|---:|---|
| `useOutsideAustralia` | Boolean | Conditional | Whether the person proposes to use the material outside Australia. A `true` value establishes the primary outcome directly. |
| `materialDescription` | Enumeration: `ValueListMaterial` | Conditional | Description used to identify ideas, names, and images excluded by Rule 2. |
| `isTextualMaterial` | Boolean | Conditional | Whether the material is textual material such as a journal article, novel, screenplay, poem, song lyrics, or report. |
| `isComputerProgram` | Boolean | Conditional | Whether the material is a computer program. |
| `isTextualCompilation` | Boolean | Conditional | Whether the material is a compilation of textual material, such as an anthology. |
| `isArtisticWork` | Boolean | Conditional | Whether the material is an artistic work such as a painting, drawing, cartoon, sculpture, craft work, architectural plans, building, photograph, map, or plan. |
| `isDramaticWork` | Boolean | Conditional | Whether the material is a dramatic work such as choreography, a screenplay, a play, or mime. |
| `isMusicalWork` | Boolean | Conditional | Whether the material is a musical work, distinct from lyrics or a recording. |
| `isCinematographFilm` | Boolean | Conditional | Whether the material is a film, including a film on video, DVD, or Blu-Ray. |
| `isSoundRecording` | Boolean | Conditional | Whether the material is a sound recording. |
| `isBroadcast` | Boolean | Conditional | Whether the material is a broadcast. |
| `isPublishedEdition` | Boolean | Conditional | Whether the material is a published edition. |
| `usesLargeAmount` | Boolean | Conditional | Whether the person proposes to use a large amount of the material. |
| `usesImportantPart` | Boolean | Conditional | Whether the person proposes to use an important, distinctive, or essential part of the material. |
| `ownerHasExclusiveRightForUse` | Boolean | Conditional | Whether the copyright owner has the exclusive right to use the material in the proposed way. |
| `organisationOwnsCopyright` | Boolean | Conditional | Whether the person's organisation owns the copyright in the material. |
| `holdsLicence` | Boolean | Conditional | Whether the person holds a licence to use the material. A computer-program shortcut can establish `true` under Rule 5. |
| `licenceCoversProposedUse` | Boolean | Conditional | Whether a licence held by the person covers the proposed use. |
| `hasComputerProgramLicence` | Boolean | Conditional | Whether the person has a licence to use the computer program. |
| `creatorStillAlive` | Boolean | Conditional | Whether the material's creator is still alive. |
| `creatorCanBeIdentified` | Boolean | Conditional | Whether the creator can be identified. |
| `wasPublishedPerformedOrBroadcast` | Boolean | Conditional | Whether the material has been published, performed, or broadcast. |
| `firstPublicationPerformanceOrBroadcastDate` | Date | Conditional | Date of the material's first publication, performance, or broadcast. |
| `creatorDeathDate` | Date | Conditional | Death date of the material's creator. |
| `currentDate` | Date | Conditional | Date against which copyright expiry is assessed. |
| `proposedUsePurpose` | Enumeration: `ValueListProposedUse` | Conditional | Purpose of the proposed use, for the specified exception rules. |
| `institutionDescription` | Text | Conditional | Description of the institution connected with the use; Rule 6 compares it with `a library`, `an educational institution`, and `both`. No value list is specified for this input. |
| `drawsOrPhotographsMaterial` | Boolean | Conditional | Whether the person proposes to draw or photograph the material. |
| `isBuildingPublicSculptureOrCraft` | Boolean | Conditional | Whether the material is a building, public sculpture, or craft work. Rule 6 includes a limited shortcut that can establish `false`. |
| `ownsMaterial` | Boolean | Conditional | Whether the person owns the material to be privately copied. |
| `proposesToCopyMaterial` | Boolean | Conditional | Whether the person proposes to copy the material. |
| `keepsCopyAndOriginalPrivately` | Boolean | Conditional | Whether the person proposes to keep both copy and original for private use. |
| `lendsCopyOrOriginalToFamilyOrHousehold` | Boolean | Conditional | Whether the person proposes to lend the copy or original to family or household members. |
| `governmentUse` | Boolean | Conditional | Whether the proposed use is for or on behalf of the Commonwealth, a State, or a Territory government. |
| `ownsComputerProgram` | Boolean | Conditional | Whether the person owns the computer program proposed for use. |

## 3. Enumerations

### 3.1 `ValueListMaterial`

| Value | Meaning |
|---|---|
| `an idea` | The material is described as an idea. |
| `a concept` | The material is described as a concept. |
| `information` | The material is described as information. |
| `a style` | The material is described as a style. |
| `a technique` | The material is described as a technique. |
| `a name` | The material is described as a name. |
| `a title` | The material is described as a title. |
| `a slogan` | The material is described as a slogan. |
| `an image of a person's face or body` | The material is described as an image of a person's face or body. |
| `none of the above` | None of the preceding descriptions applies. |

### 3.2 `ValueListProposedUse`

| Value | Meaning |
|---|---|
| `parody or satire` | The proposed purpose is parody or satire. |
| `criticism or review` | The proposed purpose is criticism or review. |
| `reporting news` | The proposed purpose is reporting news. |
| `private or domestic purposes` | The proposed purpose is private or domestic use. |
| `none of the above` | None of the preceding purposes applies. |

## 4. Output

| Output | Type | Description |
|---|---|---|
| `mightNeedCopyrightPermission` | Boolean | `true` when the domestic-use conditions in Rule 1 are all satisfied **or** the person proposes to use the material outside Australia; `false` when neither branch is satisfied and the decision can be evaluated. |

## 5. Copyright Permission Rules

### Rule 1 — Primary decision

The person might need copyright permission if either:

1. the person proposes to use the material outside Australia; or
2. all domestic-use conditions hold: the material is protected by copyright, a substantial part is proposed for use, copyright has not expired, the owner controls the proposed use, no existing licence covers it, the person's organisation does not own the copyright, and no specified special exception covers the use.

Formally:

```text
mightNeedCopyrightPermission = useOutsideAustralia
  OR (
    protectedMaterial
    AND substantialPart
    AND copyrightNotExpired
    AND ownerControlsProposedUse
    AND NOT existingLicenceCoversUse
    AND NOT organisationOwnsCopyright
    AND NOT specialException
  )
```

### Rule 2 — Protected material

The material is protected for this decision if at least one material category in the inputs applies and the `materialDescription` is not an idea, concept, information, style, technique, name, title, slogan, or image of a person's face or body.

```text
excludedDescription = materialDescription IN {
  "an idea", "a concept", "information", "a style", "a technique",
  "a name", "a title", "a slogan",
  "an image of a person's face or body"
}

protectedMaterial = (
  isTextualMaterial OR isComputerProgram OR isTextualCompilation
  OR isArtisticWork OR isDramaticWork OR isMusicalWork
  OR isCinematographFilm OR isSoundRecording OR isBroadcast
  OR isPublishedEdition
) AND NOT excludedDescription
```

A film, sound recording, broadcast, or published edition can be considered separately from material within it, such as a script, music, or illustrations.

### Rule 3 — Substantial part and controlled use

```text
substantialPart = usesLargeAmount OR usesImportantPart
ownerControlsProposedUse = ownerHasExclusiveRightForUse
```

### Rule 4 — Copyright period

Copyright has not expired if the creator is still alive or the calculated expiry date is later than `currentDate`.

```text
copyrightNotExpired = creatorStillAlive
  OR (copyrightExpiryDate > currentDate)

yearEndOfFirstPublication =
  LAST_DAY_OF_YEAR(firstPublicationPerformanceOrBroadcastDate)

publishedDuringCreatorLifetime =
  firstPublicationPerformanceOrBroadcastDate < creatorDeathDate

publicationBasedPeriod = wasPublishedPerformedOrBroadcast
  AND (
    NOT creatorCanBeIdentified
    OR NOT publishedDuringCreatorLifetime
  )

pre2005EndDate = IF publicationBasedPeriod
  THEN yearEndOfFirstPublication + 50 calendar years
  ELSE creatorDeathDate + 50 calendar years

post2005EndDate = IF publicationBasedPeriod
  THEN yearEndOfFirstPublication + 70 calendar years
  ELSE creatorDeathDate + 70 calendar years

copyrightExpiryDate = IF pre2005EndDate < 2005-01-01
  THEN pre2005EndDate
  ELSE post2005EndDate
```

The two publication-based circumstances—creator identity cannot be ascertained, or publication occurred outside the creator's lifetime—have the same calculation for each period and are combined above.

### Rule 5 — Existing licence

An existing licence covers the use only when the person holds a licence and that licence covers the proposed use.

```text
existingLicenceCoversUse = holdsLicence AND licenceCoversProposedUse
```

If the material is a computer program and `hasComputerProgramLicence` is true, `holdsLicence` is established as true. This is a one-way rule; it does not establish `holdsLicence = false` for other material.

### Rule 6 — Special exception

A special exception applies when at least one of these conditions holds:

```text
specialException = fairDealing
  OR drawsOrPhotographsBuildingSculptureOrCraft
  OR privateCopying
  OR connectedWithLibrary
  OR connectedWithEducationalInstitution
  OR governmentUse
  OR (isComputerProgram
      AND (ownsComputerProgram OR hasComputerProgramLicence))

fairDealing = proposedUsePurpose IN {
  "criticism or review", "parody or satire", "reporting news"
}

drawsOrPhotographsBuildingSculptureOrCraft =
  drawsOrPhotographsMaterial AND isBuildingPublicSculptureOrCraft

privateCopying = ownsMaterial
  AND proposesToCopyMaterial
  AND proposedUsePurpose = "private or domestic purposes"
  AND (
    keepsCopyAndOriginalPrivately
    OR lendsCopyOrOriginalToFamilyOrHousehold
  )

connectedWithLibrary = institutionDescription IN {"a library", "both"}
connectedWithEducationalInstitution =
  institutionDescription IN {"an educational institution", "both"}
```

If the material is textual material, a computer program, a textual compilation, a dramatic work, a musical work, a film, a sound recording, or a published edition, `isBuildingPublicSculptureOrCraft` is established as false. This one-way rule does not establish that it is true for any other material.

## 6. Overall Decision

```text
mightNeedCopyrightPermission = useOutsideAustralia
  OR (
    protectedMaterial
    AND substantialPart
    AND copyrightNotExpired
    AND ownerControlsProposedUse
    AND NOT existingLicenceCoversUse
    AND NOT organisationOwnsCopyright
    AND NOT specialException
  )
```

The outcome retains the word **might**: it indicates possible need for permission under these rules.

## 7. Date and Boundary Rules

1. A pre-2005 period end date must be **strictly before** 1 January 2005 to be used. A date equal to 1 January 2005 takes the post-2005 calculation.
2. First publication, performance, or broadcast must be **strictly before** the creator's death date to count as occurring during the creator's lifetime. An equal date does not satisfy the comparison.
3. The calculated expiry date must be **strictly later than** `currentDate` to satisfy the date branch of `copyrightNotExpired`. An equal date does not satisfy it.
4. The publication-based date is calculated from the last day of the year containing the first publication, performance, or broadcast date. The alternative date is calculated from the creator's death date.
5. Durations use calendar years: 50 years for the pre-2005 calculation and 70 years for the post-2005 calculation.
6. A proposed use outside Australia satisfies the primary decision independently of the domestic-use conditions.

## 8. Validation Rules

1. `materialDescription` and `proposedUsePurpose`, when supplied, must be one of their listed values.
2. Dates used in Rule 4 must be valid dates. A needed date that is missing or invalid cannot establish the comparison that uses it.
3. A missing or unknown Boolean answer is not equivalent to `false`. If a required branch remains unresolved, the final outcome remains unresolved unless another branch independently establishes `true`.
4. The policy supplies no additional input-validation error messages.

Now, let’s examine the JavaScript that was generated.

function mightNeedCopyrightPermission(useOutsideAustralia, materialDescription, isTextualMaterial, isComputerProgram, isTextualCompilation, isArtisticWork, isDramaticWork, isMusicalWork, isCinematographFilm, isSoundRecording, isBroadcast, isPublishedEdition, usesLargeAmount, usesImportantPart, ownerHasExclusiveRightForUse, organisationOwnsCopyright, holdsLicence, licenceCoversProposedUse, hasComputerProgramLicence, creatorStillAlive, creatorCanBeIdentified, wasPublishedPerformedOrBroadcast, firstPublicationPerformanceOrBroadcastDate, creatorDeathDate, currentDate, proposedUsePurpose, institutionDescription, drawsOrPhotographsMaterial, isBuildingPublicSculptureOrCraft, ownsMaterial, proposesToCopyMaterial, keepsCopyAndOriginalPrivately, lendsCopyOrOriginalToFamilyOrHousehold, governmentUse, ownsComputerProgram) {
    "use strict";
    var inputNames = ["useOutsideAustralia", "materialDescription", "isTextualMaterial", "isComputerProgram", 
"isTextualCompilation", "isArtisticWork", "isDramaticWork", "isMusicalWork", "isCinematographFilm", "isSoundRecording", 
"isBroadcast", "isPublishedEdition", "usesLargeAmount", "usesImportantPart", "ownerHasExclusiveRightForUse", "organisationOwnsCopyright", "holdsLicence", "licenceCoversProposedUse", "hasComputerProgramLicence", "creatorStillAlive", "creatorCanBeIdentified", "wasPublishedPerformedOrBroadcast", "firstPublicationPerformanceOrBroadcastDate", "creatorDeathDate", "currentDate", "proposedUsePurpose", "institutionDescription", "drawsOrPhotographsMaterial", "isBuildingPublicSculptureOrCraft", "ownsMaterial", "proposesToCopyMaterial", "keepsCopyAndOriginalPrivately", "lendsCopyOrOriginalToFamilyOrHousehold", "governmentUse", "ownsComputerProgram"];
    function isValidDateString(s) {
        if (typeof s !== 'string')
            return false;
        var d = new Date(s);
        return !isNaN(d.getTime())
    }
    function parseDateOrNull(s) {
        if (!isValidDateString(s))
            return null;
        var d = new Date(s);
        d.setUTCHours(0, 0, 0, 0);
        return d
    }
    function lastDayOfYear(d) {
        var y = d.getUTCFullYear();
        var r = new Date(Date.UTC(y, 11, 31));
        r.setUTCHours(0, 0, 0, 0);
        return r
    }
    function addYears(d, y) {
        var r = new Date(d.getTime());
        r.setUTCFullYear(r.getUTCFullYear() + y);
        return r
    }
    var resultValue = false;
    var holdsLicenceEffective = holdsLicence === true || (isComputerProgram === true && hasComputerProgramLicence === true);
    var excludedDescriptionsList = ["an idea", "a concept", "information", "a style", "a technique", "a name", "a title", "a slogan", "an image of a person's face or body"];
    var excludedDescription = false;
    if (typeof materialDescription === 'string') {
        excludedDescription = excludedDescriptionsList.indexOf(materialDescription) !== -1
    } else {
        excludedDescription = false
    }
    var anyMaterialKind = (isTextualMaterial === true) || (isComputerProgram === true) || (isTextualCompilation === true) || (isArtisticWork === true) || (isDramaticWork === true) || (isMusicalWork === true) || (isCinematographFilm === true) || (isSoundRecording === true) || (isBroadcast === true) || (isPublishedEdition === true);
    var protectedMaterial = anyMaterialKind && !excludedDescription;
    var substantialPart = (usesLargeAmount === true) || (usesImportantPart === true);
    var ownerControlsProposedUse = ownerHasExclusiveRightForUse === true;
    var existingLicenceCoversUse = holdsLicenceEffective === true && licenceCoversProposedUse === true;
    var isBuildingShortcutFalse = (isTextualMaterial === true) || (isComputerProgram === true) || (isTextualCompilation === true) || (isDramaticWork === true) || (isMusicalWork === true) || (isCinematographFilm === true) || (isSoundRecording === true) || (isPublishedEdition === true);
    var isBuildingPublicSculptureOrCraftEffective = (isBuildingShortcutFalse === true) ? false : (isBuildingPublicSculptureOrCraft === true);
    var fairDealing = (proposedUsePurpose === "criticism or review") || (proposedUsePurpose === "parody or satire") || (proposedUsePurpose === "reporting news");
    var drawsOrPhotographsBuildingSculptureOrCraft = (drawsOrPhotographsMaterial === true) && (isBuildingPublicSculptureOrCraftEffective === true);
    var privateCopying = (ownsMaterial === true) && (proposesToCopyMaterial === true) && (proposedUsePurpose === "private or domestic purposes") && ((keepsCopyAndOriginalPrivately === true) || (lendsCopyOrOriginalToFamilyOrHousehold === true));
    var connectedWithLibrary = (institutionDescription === "a library") || (institutionDescription === "both");
    var connectedWithEducationalInstitution = (institutionDescription === "an educational institution") || (institutionDescription === "both");
    var specialException = (fairDealing === true) || (drawsOrPhotographsBuildingSculptureOrCraft === true) || (privateCopying === true) || (connectedWithLibrary === true) || (connectedWithEducationalInstitution === true) || (governmentUse === true) || (isComputerProgram === true && ((ownsComputerProgram === true) || (hasComputerProgramLicence === true)));
    var copyrightNotExpired = false;
    var creatorAliveKnown = creatorStillAlive === true;
    var expiryDate = null;
    if (creatorAliveKnown === true) {
        copyrightNotExpired = true
    } else {
        var pubDate = parseDateOrNull(firstPublicationPerformanceOrBroadcastDate);
        var deathDate = parseDateOrNull(creatorDeathDate);
        var currDate = parseDateOrNull(currentDate);
        if (currDate === null) {
            copyrightNotExpired = false
        } else {
            if (pubDate === null || deathDate === null) {
                copyrightNotExpired = false
            } else {
                var publishedDuringCreatorLifetime = pubDate.getTime() < deathDate.getTime();
                var publicationBasedPeriod = (wasPublishedPerformedOrBroadcast === true) && ((creatorCanBeIdentified === false) || (publishedDuringCreatorLifetime === false));
                var yearEndOfFirstPublication = lastDayOfYear(pubDate);
                var pre2005EndDate = publicationBasedPeriod ? addYears(yearEndOfFirstPublication, 50) : addYears(deathDate, 50);
                var post2005EndDate = publicationBasedPeriod ? addYears(yearEndOfFirstPublication, 70) : addYears(deathDate, 70);
                var cutoff = new Date(Date.UTC(2005, 0, 1));
                cutoff.setUTCHours(0, 0, 0, 0);
                copyrightExpiryDate = pre2005EndDate.getTime() < cutoff.getTime() ? pre2005EndDate : post2005EndDate;
                copyrightNotExpired = copyrightExpiryDate.getTime() > currDate.getTime();
            }
        }
    }
    var domesticConditions = protectedMaterial === true && substantialPart === true && copyrightNotExpired === true && ownerControlsProposedUse === true && (existingLicenceCoversUse !== true) && (organisationOwnsCopyright !== true) && (specialException !== true);
    if (useOutsideAustralia === true) {
        resultValue = true
    } else {
        resultValue = domesticConditions === true
    }
    return {
        mightNeedCopyrightPermission: resultValue
    };
}

Now let’s work our way through the results of this first attempt:

  1. Line 3: What is the purpose of the inputNames variable? It is never used in any function. It’s redundant.
  2. Line 54 : What is the reason for the expiryDate variable? It is never used in any function. It’s redundant.
  3. Line 74 : An attempt is made to assign a value to undeclared copyrightExpiryDate – that will throw a reference error as this script is in strict mode.
  4. Booleans that are unknown are treated as false. The !== true will accept (amongst other things) null and undefined.
  5. Impossible calendar dates like 31st February 2026 pass and can skew the results as they are parsed into the following month.
  6. The useOutsideAustralia is evaluated too late.

It feels tempting to point at the generator and scream. But to be honest, this kind of policy falls into a classic trap for anyone “who used to use something else”. Preparing policy documents for the Policy Node is not a conversion job – they have to be prepared as policy documents, not as “things I converted from another piece of software”. The business is the source of truth, not a converted artefact from Oracle Intelligent Advisor.

So let’s go back to the Policy Document and clean it up – stripping out all the conversion stuff. Here is what we might have:

# Copyright Permission Review Policy

## Purpose and decision

This policy decides whether a proposed use of material requires a copyright-permission review. The decision is returned as the Boolean `mightNeedCopyrightPermission`. The field name is retained for compatibility; the rules below determine its value.

If the proposed use is outside Australia, return `true`. No other criteria apply to that case.

For a proposed use in Australia, return `true` only when every condition in the domestic decision rule is met. Otherwise return `false` once the relevant facts are known.

## Information supplied

The inputs describe one proposed use. Boolean fields contain `true` or `false`; an unanswered field is not `false`. Dates are calendar dates.

| Area | Inputs |
|---|---|
| Location | `useOutsideAustralia` (Boolean) |
| Material | `materialDescription` (one of the values below); `isTextualMaterial`, `isComputerProgram`, `isTextualCompilation`, `isArtisticWork`, `isDramaticWork`, `isMusicalWork`, `isCinematographFilm`, `isSoundRecording`, `isBroadcast`, `isPublishedEdition` (Booleans) |
| Amount and rights | `usesLargeAmount`, `usesImportantPart`, `ownerHasExclusiveRightForUse`, `organisationOwnsCopyright` (Booleans) |
| Licence | `holdsLicence`, `licenceCoversProposedUse`, `hasComputerProgramLicence` (Booleans) |
| Copyright period | `creatorStillAlive`, `creatorCanBeIdentified`, `wasPublishedPerformedOrBroadcast` (Booleans); `firstPublicationPerformanceOrBroadcastDate`, `creatorDeathDate`, `currentDate` (Dates) |
| Proposed purpose and institution | `proposedUsePurpose` (one of the values below); `institutionDescription` (Text) |
| Other circumstances | `drawsOrPhotographsMaterial`, `isBuildingPublicSculptureOrCraft`, `ownsMaterial`, `proposesToCopyMaterial`, `keepsCopyAndOriginalPrivately`, `lendsCopyOrOriginalToFamilyOrHousehold`, `governmentUse`, `ownsComputerProgram` (Booleans) |

Accepted `materialDescription` values are `an idea`, `a concept`, `information`, `a style`, `a technique`, `a name`, `a title`, `a slogan`, `an image of a person's face or body`, and `none of the above`.

Accepted `proposedUsePurpose` values are `parody or satire`, `criticism or review`, `reporting news`, `private or domestic purposes`, and `none of the above`.

The institution descriptions used by the rules are `a library`, `an educational institution`, and `both`. Other descriptions do not establish either institution condition.

## Domestic decision

For a use in Australia, return `true` when all of the following are true:

1. The material is in at least one covered category and is not in an excluded description.
2. The proposed use takes a large amount or an important, distinctive, or essential part.
3. Copyright has not expired under the period rule below.
4. The copyright owner has the exclusive right to use the material in the proposed way.
5. No existing licence covers the proposed use.
6. The person's organisation does not own the copyright.
7. None of the specified exceptions below applies.

Formally:

```text
domesticDecision = protectedMaterial
  AND (usesLargeAmount OR usesImportantPart)
  AND copyrightNotExpired
  AND ownerHasExclusiveRightForUse
  AND NOT existingLicenceCoversUse
  AND NOT organisationOwnsCopyright
  AND NOT specialException

mightNeedCopyrightPermission = useOutsideAustralia OR domesticDecision
```

### Covered and excluded material

`protectedMaterial` is true if at least one of the ten material-category Boolean inputs is true and `materialDescription` is not any of the following: `an idea`, `a concept`, `information`, `a style`, `a technique`, `a name`, `a title`, `a slogan`, or `an image of a person's face or body`.

### Copyright period

Copyright has not expired if the creator is still alive. Otherwise, calculate an expiry date and compare it with `currentDate`. The expiry date must be **later than** `currentDate`; equality does not pass.

Use the publication-based period when the material was published, performed, or broadcast and either the creator cannot be identified or the first publication, performance, or broadcast was **not before** the creator's death. Otherwise use the creator's death date.

```text
publicationBasedPeriod = wasPublishedPerformedOrBroadcast
  AND (NOT creatorCanBeIdentified
       OR firstPublicationPerformanceOrBroadcastDate >= creatorDeathDate)

publicationBaseDate = last calendar day of the year containing
  firstPublicationPerformanceOrBroadcastDate

pre2005EndDate = IF publicationBasedPeriod
  THEN publicationBaseDate + 50 calendar years
  ELSE creatorDeathDate + 50 calendar years

post2005EndDate = IF publicationBasedPeriod
  THEN publicationBaseDate + 70 calendar years
  ELSE creatorDeathDate + 70 calendar years

copyrightExpiryDate = IF pre2005EndDate < 2005-01-01
  THEN pre2005EndDate
  ELSE post2005EndDate

copyrightNotExpired = creatorStillAlive
  OR copyrightExpiryDate > currentDate
```

The `2005-01-01` comparison is strict. A pre-2005 end date equal to that date uses the post-2005 calculation.

### Existing licence

An existing licence covers the proposed use only when the person holds a licence **and** that licence covers this use. 
For computer-program material, `hasComputerProgramLicence = true` also establishes that the person holds a licence. 
It does not, by itself, establish that the licence covers the proposed use.

```text
holdsLicenceEffective = holdsLicence
  OR (isComputerProgram AND hasComputerProgramLicence)

existingLicenceCoversUse = holdsLicenceEffective
  AND licenceCoversProposedUse
```

### Specified exceptions

`specialException` is true if any one of these circumstances applies:

- The proposed purpose is `criticism or review`, `parody or satire`, or `reporting news`.
- The person draws or photographs material that is a building, public sculpture, or craft work.
- The person owns the material, proposes to copy it for `private or domestic purposes`, and will either 
keep both copy and original privately or lend one to family or household members.
- The institution description is `a library`, `an educational institution`, or `both`.
- The use is for or on behalf of the Commonwealth, a State, or a Territory government.
- The material is a computer program and the person either owns it or has a computer-program licence.

For the drawing-or-photography exception, treat `isBuildingPublicSculptureOrCraft` as `false` when any of these material categories is true: textual material, computer program, textual compilation, dramatic work, musical work, cinematograph film, sound recording, or published edition. Otherwise use the supplied value of `isBuildingPublicSculptureOrCraft`.

## Decision and data quality

Evaluate the outside-Australia rule first. When `useOutsideAustralia` is `true`, return `true` without requiring domestic-use information.

For a domestic use, evaluate only the facts needed to resolve the decision. Do not treat an unanswered Boolean as `false` or an 
absent date as a valid date. 
If necessary information is missing or invalid and no other rule establishes the result, do not return a Boolean decision; 
request the missing or corrected information. An unrecognised value for either listed value set is invalid.

This policy defines a decision for the supplied facts. It does not itself grant permission or provide a statement of current copyright law.

The policy document no longer hankers after an earlier solution’s architecture. It stops trying to second-guess how things should be done, and concentrates on the policy. And the JavaScript looks like this.

function copyrightPermissionDecision(useOutsideAustralia, materialDescription, isTextualMaterial, isComputerProgram, isTextualCompilation, isArtisticWork, isDramaticWork, isMusicalWork, isCinematographFilm, isSoundRecording, isBroadcast, isPublishedEdition, usesLargeAmount, usesImportantPart, ownerHasExclusiveRightForUse, organisationOwnsCopyright, holdsLicence, licenceCoversProposedUse, hasComputerProgramLicence, creatorStillAlive, creatorCanBeIdentified, wasPublishedPerformedOrBroadcast, firstPublicationPerformanceOrBroadcastDate, creatorDeathDate, currentDate, proposedUsePurpose, institutionDescription, drawsOrPhotographsMaterial, isBuildingPublicSculptureOrCraft, ownsMaterial, proposesToCopyMaterial, keepsCopyAndOriginalPrivately, lendsCopyOrOriginalToFamilyOrHousehold, governmentUse, ownsComputerProgram) {
    "use strict";
    var missingInputs = [];
    if (typeof useOutsideAustralia != "boolean")
        missingInputs.push("useOutsideAustralia");
    var acceptedMaterialDescriptions = ["an idea", "a concept", "information", "a style", "a technique", "a name", "a title", "a slogan", "an image of a person's face or body", "none of the above"];
    if (typeof materialDescription != "string")
        missingInputs.push("materialDescription");
    else if (acceptedMaterialDescriptions.indexOf(materialDescription) === -1)
        return {
            result: {
                mightNeedCopyrightPermission: null,
                missingInputs: ["invalid materialDescription"]
            }
        };
    var materialBooleans = [isTextualMaterial, isComputerProgram, isTextualCompilation, isArtisticWork, isDramaticWork, isMusicalWork, isCinematographFilm, isSoundRecording, isBroadcast, isPublishedEdition];
    for (var i = 0; i < materialBooleans.length; i++) {
        if (typeof materialBooleans[i] !== "boolean") {
            missingInputs.push(["isTextualMaterial", "isComputerProgram", "isTextualCompilation", "isArtisticWork", "isDramaticWork", "isMusicalWork", "isCinematographFilm", "isSoundRecording", "isBroadcast", "isPublishedEdition"][i]);
        }
    }
    if (typeof usesLargeAmount != "boolean")
        missingInputs.push("usesLargeAmount");
    if (typeof usesImportantPart != "boolean")
        missingInputs.push("usesImportantPart");
    if (typeof ownerHasExclusiveRightForUse != "boolean")
        missingInputs.push("ownerHasExclusiveRightForUse");
    if (typeof organisationOwnsCopyright != "boolean")
        missingInputs.push("organisationOwnsCopyright");
    if (typeof holdsLicence != "boolean")
        missingInputs.push("holdsLicence");
    if (typeof licenceCoversProposedUse != "boolean")
        missingInputs.push("licenceCoversProposedUse");
    if (typeof hasComputerProgramLicence != "boolean")
        missingInputs.push("hasComputerProgramLicence");
    if (typeof creatorStillAlive != "boolean")
        missingInputs.push("creatorStillAlive");
    if (typeof creatorCanBeIdentified != "boolean")
        missingInputs.push("creatorCanBeIdentified");
    if (typeof wasPublishedPerformedOrBroadcast != "boolean")
        missingInputs.push("wasPublishedPerformedOrBroadcast");
    if (typeof currentDate != "string")
        missingInputs.push("currentDate");
    var acceptedPurposes = ["parody or satire", "criticism or review", "reporting news", "private or domestic purposes", "none of the above"];
    if (typeof proposedUsePurpose != "string")
        missingInputs.push("proposedUsePurpose");
    else if (acceptedPurposes.indexOf(proposedUsePurpose) === -1)
        return {
            result: {
                mightNeedCopyrightPermission: null,
                missingInputs: ["invalid proposedUsePurpose"]
            }
        };
    if (typeof institutionDescription != "string")
        missingInputs.push("institutionDescription");
    var otherBooleans = [drawsOrPhotographsMaterial, isBuildingPublicSculptureOrCraft, ownsMaterial, proposesToCopyMaterial, keepsCopyAndOriginalPrivately, lendsCopyOrOriginalToFamilyOrHousehold, governmentUse, ownsComputerProgram];
    for (var j = 0; j < otherBooleans.length; j++) {
        if (typeof otherBooleans[j] !== "boolean") {
            missingInputs.push(["drawsOrPhotographsMaterial", "isBuildingPublicSculptureOrCraft", "ownsMaterial", "proposesToCopyMaterial", "keepsCopyAndOriginalPrivately", "lendsCopyOrOriginalToFamilyOrHousehold", "governmentUse", "ownsComputerProgram"][j]);
        }
    }
    if (missingInputs.length > 0)
        return {
            result: {
                mightNeedCopyrightPermission: null,
                missingInputs: missingInputs
            }
        };
    if (useOutsideAustralia === true)
        return {
            result: {
                mightNeedCopyrightPermission: true,
                missingInputs: []
            }
        };
    var materialCategories = [isTextualMaterial, isComputerProgram, isTextualCompilation, isArtisticWork, isDramaticWork, isMusicalWork, isCinematographFilm, isSoundRecording, isBroadcast, isPublishedEdition];
    var anyMaterialCategory = false;
    for (var k = 0; k < materialCategories.length; k++) {
        if (materialCategories[k] === true) {
            anyMaterialCategory = true;
            break;
        }
    }
    var excludedDescriptions = ["an idea", "a concept", "information", "a style", "a technique", "a name", "a title", "a slogan", "an image of a person's face or body"];
    var materialDescriptionExcluded = excludedDescriptions.indexOf(materialDescription) !== -1;
    var protectedMaterial = anyMaterialCategory && !materialDescriptionExcluded;
    var usesLargeOrImportant = usesLargeAmount || usesImportantPart;
    var holdsLicenceEffective = holdsLicence || (isComputerProgram && hasComputerProgramLicence);
    var existingLicenceCoversUse = holdsLicenceEffective && licenceCoversProposedUse;
    var publicationBasedPeriod = wasPublishedPerformedOrBroadcast && (!creatorCanBeIdentified || (typeof firstPublicationPerformanceOrBroadcastDate === "string" && typeof creatorDeathDate === "string" && firstPublicationPerformanceOrBroadcastDate >= creatorDeathDate));
    function parseDate(d) {
        if (typeof d != "string")
            return null;
        var dt = new Date(d + "T00:00:00Z");
        return isNaN(dt.getTime()) ? null : dt;
    }
    var currentDt = parseDate(currentDate);
    if (currentDt === null)
        return {
            result: {
                mightNeedCopyrightPermission: null,
                missingInputs: ["currentDate"]
            }
        };
    if (creatorStillAlive === true) {
        var copyrightNotExpired = true;
    } else {
        if (publicationBasedPeriod) {
            if (typeof firstPublicationPerformanceOrBroadcastDate != "string")
                return {
                    result: {
                        mightNeedCopyrightPermission: null,
                        missingInputs: ["firstPublicationPerformanceOrBroadcastDate"]
                    }
                };
            if (typeof creatorDeathDate != "string")
                return {
                    result: {
                        mightNeedCopyrightPermission: null,
                        missingInputs: ["creatorDeathDate"]
                    }
                };
            var pubDate = parseDate(firstPublicationPerformanceOrBroadcastDate);
            var deathDate = parseDate(creatorDeathDate);
            if (pubDate === null)
                return {
                    result: {
                        mightNeedCopyrightPermission: null,
                        missingInputs: ["firstPublicationPerformanceOrBroadcastDate"]
                    }
                };
            if (deathDate === null)
                return {
                    result: {
                        mightNeedCopyrightPermission: null,
                        missingInputs: ["creatorDeathDate"]
                    }
                };
            var publicationBaseDate = new Date(Date.UTC(pubDate.getUTCFullYear(), 11, 31));
            var pre2005EndDate = new Date(publicationBaseDate);
            pre2005EndDate.setUTCFullYear(pre2005EndDate.getUTCFullYear() + 50);
            var comparisonDate = new Date(Date.UTC(2005, 0, 1));
            var post2005EndDate = new Date(publicationBaseDate);
            post2005EndDate.setUTCFullYear(post2005EndDate.getUTCFullYear() + 70);
            var copyrightExpiryDate = pre2005EndDate < comparisonDate ? pre2005EndDate : post2005EndDate;
            var copyrightNotExpired = copyrightExpiryDate.getTime() > currentDt.getTime();
        } else {
            if (typeof creatorDeathDate != "string")
                return {
                    result: {
                        mightNeedCopyrightPermission: null,
                        missingInputs: ["creatorDeathDate"]
                    }
                };
            var deathDt = parseDate(creatorDeathDate);
            if (deathDt === null)
                return {
                    result: {
                        mightNeedCopyrightPermission: null,
                        missingInputs: ["creatorDeathDate"]
                    }
                };
            var pre2005EndDate = new Date(deathDt);
            pre2005EndDate.setUTCFullYear(pre2005EndDate.getUTCFullYear() + 50);
            var comparisonDate = new Date(Date.UTC(2005, 0, 1));
            var post2005EndDate = new Date(deathDt);
            post2005EndDate.setUTCFullYear(post2005EndDate.getUTCFullYear() + 70);
            var copyrightExpiryDate = pre2005EndDate < comparisonDate ? pre2005EndDate : post2005EndDate;
            var copyrightNotExpired = copyrightExpiryDate.getTime() > currentDt.getTime();
        }
    }
    var drawsException = false;
    var buildingExceptionApplicable = true;
    if (isTextualMaterial || isComputerProgram || isTextualCompilation || isDramaticWork || isMusicalWork || isCinematographFilm || isSoundRecording || isPublishedEdition)
        buildingExceptionApplicable = false;
    var isBuildingPublicSculptureOrCraftEffective = buildingExceptionApplicable ? isBuildingPublicSculptureOrCraft : false;
    if ((proposedUsePurpose === "criticism or review" || proposedUsePurpose === "parody or satire" || proposedUsePurpose === "reporting news"))
        drawsException = true;
    if (drawsOrPhotographsMaterial && isBuildingPublicSculptureOrCraftEffective)
        drawsException = true;
    var ownCopyPrivateException = ownsMaterial && proposesToCopyMaterial && (proposedUsePurpose === "private or domestic purposes") && (keepsCopyAndOriginalPrivately || lendsCopyOrOriginalToFamilyOrHousehold);
    var institutionException = (institutionDescription === "a library" || institutionDescription === "an educational institution" || institutionDescription === "both");
    var governmentException = governmentUse === true;
    var computerProgramException = isComputerProgram && (ownsComputerProgram || hasComputerProgramLicence);
    var specialException = drawsException || ownCopyPrivateException || institutionException || governmentException || computerProgramException;
    var domesticDecision = protectedMaterial && usesLargeOrImportant && copyrightNotExpired && ownerHasExclusiveRightForUse && !existingLicenceCoversUse && !organisationOwnsCopyright && !specialException;
    return {
        result: {
            mightNeedCopyrightPermission: domesticDecision,
            missingInputs: []
        }
    };
}

This time around, the generated code is a credible translation of the policy. Its main strengths are the valid code, recognisable rule structure, and correctly connected exception logic. The remaining issues are whether the Workflow expects the { result: { mightNeedCopyrightPermission, missingInputs } } response shape and whether a set of representative complete payloads produces the intended decisions—especially around copyright-expiry dates, licences, and exceptions. So mostly, we are down to “test it to see if it behaves as expected”.

But there is one more “converter” trap. Did you notice that at the end of the MD, like the good old Oracle Intelligent Advisor person that I am, I wrote :

“If necessary information is missing or invalid and no other rule establishes the result, do not return a Boolean decision; request the missing or corrected information.”

I was still thinking like an interview designer. This is a Workflow and a REST API. So I removed it:

# Copyright Permission Review Policy

## Purpose and decision

This policy decides whether a proposed use of material requires a copyright-permission review. The decision is returned as the Boolean `mightNeedCopyrightPermission`. The field name is retained for compatibility; the rules below determine its value.

If the proposed use is outside Australia, return `true`. No other criteria apply to that case.

For a proposed use in Australia, return `true` only when every condition in the domestic decision rule is met. Otherwise return `false` once the relevant facts are known.

## Information supplied

The Workflow supplies one complete, valid set of inputs for each proposed use. Boolean fields contain `true` or `false`. Dates are calendar dates.

| Area | Inputs |
|---|---|
| Location | `useOutsideAustralia` (Boolean) |
| Material | `materialDescription` (one of the values below); `isTextualMaterial`, `isComputerProgram`, `isTextualCompilation`, `isArtisticWork`, `isDramaticWork`, `isMusicalWork`, `isCinematographFilm`, `isSoundRecording`, `isBroadcast`, `isPublishedEdition` (Booleans) |
| Amount and rights | `usesLargeAmount`, `usesImportantPart`, `ownerHasExclusiveRightForUse`, `organisationOwnsCopyright` (Booleans) |
| Licence | `holdsLicence`, `licenceCoversProposedUse`, `hasComputerProgramLicence` (Booleans) |
| Copyright period | `creatorStillAlive`, `creatorCanBeIdentified`, `wasPublishedPerformedOrBroadcast` (Booleans); `firstPublicationPerformanceOrBroadcastDate`, `creatorDeathDate`, `currentDate` (Dates) |
| Proposed purpose and institution | `proposedUsePurpose` (one of the values below); `institutionDescription` (Text) |
| Other circumstances | `drawsOrPhotographsMaterial`, `isBuildingPublicSculptureOrCraft`, `ownsMaterial`, `proposesToCopyMaterial`, `keepsCopyAndOriginalPrivately`, `lendsCopyOrOriginalToFamilyOrHousehold`, `governmentUse`, `ownsComputerProgram` (Booleans) |

Accepted `materialDescription` values are `an idea`, `a concept`, `information`, `a style`, `a technique`, `a name`, `a title`, `a slogan`, `an image of a person's face or body`, and `none of the above`.

Accepted `proposedUsePurpose` values are `parody or satire`, `criticism or review`, `reporting news`, `private or domestic purposes`, and `none of the above`.

The institution descriptions used by the rules are `a library`, `an educational institution`, and `both`. Other descriptions do not establish either institution condition.

## Domestic decision

For a use in Australia, return `true` when all of the following are true:

1. The material is in at least one covered category and is not in an excluded description.
2. The proposed use takes a large amount or an important, distinctive, or essential part.
3. Copyright has not expired under the period rule below.
4. The copyright owner has the exclusive right to use the material in the proposed way.
5. No existing licence covers the proposed use.
6. The person's organisation does not own the copyright.
7. None of the specified exceptions below applies.

Formally:

```text
domesticDecision = protectedMaterial
  AND (usesLargeAmount OR usesImportantPart)
  AND copyrightNotExpired
  AND ownerHasExclusiveRightForUse
  AND NOT existingLicenceCoversUse
  AND NOT organisationOwnsCopyright
  AND NOT specialException

mightNeedCopyrightPermission = useOutsideAustralia OR domesticDecision
```

### Covered and excluded material

`protectedMaterial` is true if at least one of the ten material-category Boolean inputs is true and `materialDescription` is not any of the following: `an idea`, `a concept`, `information`, `a style`, `a technique`, `a name`, `a title`, `a slogan`, or `an image of a person's face or body`.

### Copyright period

Copyright has not expired if the creator is still alive. Otherwise, calculate an expiry date and compare it with `currentDate`. The expiry date must be **later than** `currentDate`; equality does not pass.

Use the publication-based period when the material was published, performed, or broadcast and either the creator cannot be identified or the first publication, performance, or broadcast was **not before** the creator's death. Otherwise use the creator's death date.

```text
publicationBasedPeriod = wasPublishedPerformedOrBroadcast
  AND (NOT creatorCanBeIdentified
       OR firstPublicationPerformanceOrBroadcastDate >= creatorDeathDate)

publicationBaseDate = last calendar day of the year containing
  firstPublicationPerformanceOrBroadcastDate

pre2005EndDate = IF publicationBasedPeriod
  THEN publicationBaseDate + 50 calendar years
  ELSE creatorDeathDate + 50 calendar years

post2005EndDate = IF publicationBasedPeriod
  THEN publicationBaseDate + 70 calendar years
  ELSE creatorDeathDate + 70 calendar years

copyrightExpiryDate = IF pre2005EndDate < 2005-01-01
  THEN pre2005EndDate
  ELSE post2005EndDate

copyrightNotExpired = creatorStillAlive
  OR copyrightExpiryDate > currentDate
```

The `2005-01-01` comparison is strict. A pre-2005 end date equal to that date uses the post-2005 calculation.

### Existing licence

An existing licence covers the proposed use only when the person holds a licence **and** that licence covers this use. For computer-program material, `hasComputerProgramLicence = true` also establishes that the person holds a licence. It does not, by itself, establish that the licence covers the proposed use.

```text
holdsLicenceEffective = holdsLicence
  OR (isComputerProgram AND hasComputerProgramLicence)

existingLicenceCoversUse = holdsLicenceEffective
  AND licenceCoversProposedUse
```

### Specified exceptions

`specialException` is true if any one of these circumstances applies:

- The proposed purpose is `criticism or review`, `parody or satire`, or `reporting news`.
- The person draws or photographs material that is a building, public sculpture, or craft work.
- The person owns the material, proposes to copy it for `private or domestic purposes`, and will either keep both copy and original privately or lend one to family or household members.
- The institution description is `a library`, `an educational institution`, or `both`.
- The use is for or on behalf of the Commonwealth, a State, or a Territory government.
- The material is a computer program and the person either owns it or has a computer-program licence.

For the drawing-or-photography exception, treat `isBuildingPublicSculptureOrCraft` as `false` when any of these material categories is true: textual material, computer program, textual compilation, dramatic work, musical work, cinematograph film, sound recording, or published edition. Otherwise use the supplied value of `isBuildingPublicSculptureOrCraft`.

And this time round, the resulting JavaScript has now a simple Boolean as the output, and the whole missing inputs circus has disappeared.

function mightNeedCopyrightPermission(useOutsideAustralia, materialDescription, isTextualMaterial, isComputerProgram, isTextualCompilation, isArtisticWork, isDramaticWork, isMusicalWork, isCinematographFilm, isSoundRecording, isBroadcast, isPublishedEdition, usesLargeAmount, usesImportantPart, ownerHasExclusiveRightForUse, organisationOwnsCopyright, holdsLicence, licenceCoversProposedUse, hasComputerProgramLicence, creatorStillAlive, creatorCanBeIdentified, wasPublishedPerformedOrBroadcast, firstPublicationPerformanceOrBroadcastDate, creatorDeathDate, currentDate, proposedUsePurpose, institutionDescription, drawsOrPhotographsMaterial, isBuildingPublicSculptureOrCraft, ownsMaterial, proposesToCopyMaterial, keepsCopyAndOriginalPrivately, lendsCopyOrOriginalToFamilyOrHousehold, governmentUse, ownsComputerProgram) {
    "use strict";
    if (typeof useOutsideAustralia !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof materialDescription !== 'string')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isTextualMaterial !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isComputerProgram !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isTextualCompilation !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isArtisticWork !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isDramaticWork !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isMusicalWork !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isCinematographFilm !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isSoundRecording !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isBroadcast !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isPublishedEdition !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof usesLargeAmount !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof usesImportantPart !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof ownerHasExclusiveRightForUse !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof organisationOwnsCopyright !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof holdsLicence !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof licenceCoversProposedUse !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof hasComputerProgramLicence !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof creatorStillAlive !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof creatorCanBeIdentified !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof wasPublishedPerformedOrBroadcast !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof firstPublicationPerformanceOrBroadcastDate !== 'string')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof creatorDeathDate !== 'string')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof currentDate !== 'string')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof proposedUsePurpose !== 'string')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof institutionDescription !== 'string')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof drawsOrPhotographsMaterial !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof isBuildingPublicSculptureOrCraft !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof ownsMaterial !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof proposesToCopyMaterial !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof keepsCopyAndOriginalPrivately !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof lendsCopyOrOriginalToFamilyOrHousehold !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof governmentUse !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (typeof ownsComputerProgram !== 'boolean')
        return {
            mightNeedCopyrightPermission: null
        };
    if (useOutsideAustralia === true)
        return {
            mightNeedCopyrightPermission: true
        };
    var protectedCategories = [isTextualMaterial, isComputerProgram, isTextualCompilation, isArtisticWork, isDramaticWork, isMusicalWork, isCinematographFilm, isSoundRecording, isBroadcast, isPublishedEdition];
    var anyCategory = protectedCategories.indexOf(true) !== -1;
    var excludedDescriptions = ['an idea', 'a concept', 'information', 'a style', 'a technique', 'a name', 'a title', 'a slogan', 'an image of a person\'s face or body'];
    var isExcludedDescription = excludedDescriptions.indexOf(materialDescription) !== -1;
    var protectedMaterial = anyCategory && !isExcludedDescription;
    var usesLargeOrImportant = usesLargeAmount || usesImportantPart;
    function parseDateStrict(s) {
        var d = new Date(s);
        if (isNaN(d.getTime()))
            return null;
        return d;
    }
    if (protectedMaterial && usesLargeOrImportant) {
        var copyrightNotExpired = false;
        if (creatorStillAlive === true) {
            copyrightNotExpired = true;
        } else {
            var fpDate = parseDateStrict(firstPublicationPerformanceOrBroadcastDate);
            var deathDate = parseDateStrict(creatorDeathDate);
            var nowDate = parseDateStrict(currentDate);
            if (fpDate === null || deathDate === null || nowDate === null)
                return {
                    mightNeedCopyrightPermission: null
                };
            var publicationBasedPeriod = wasPublishedPerformedOrBroadcast && (!creatorCanBeIdentified || fpDate.getTime() >= deathDate.getTime());
            function lastCalendarDayOfYear(d) {
                var y = d.getUTCFullYear();
                return new Date(Date.UTC(y, 11, 31));
            }
            var publicationBaseDate = lastCalendarDayOfYear(fpDate);
            function addYears(d, y) {
                return new Date(Date.UTC(d.getUTCFullYear() + y, d.getUTCMonth(), d.getUTCDate()));
            }
            var pre2005EndDate = publicationBasedPeriod ? addYears(publicationBaseDate, 50) : addYears(deathDate, 50);
            var post2005EndDate = publicationBasedPeriod ? addYears(publicationBaseDate, 70) : addYears(deathDate, 70);
            var cutoff = new Date(Date.UTC(2005, 0, 1));
            var copyrightExpiryDate = pre2005EndDate.getTime() < cutoff.getTime() ? pre2005EndDate : post2005EndDate;
            if (copyrightExpiryDate.getTime() > nowDate.getTime())
                copyrightNotExpired = true;
            else
                copyrightNotExpired = false;
        }
        var holdsLicenceEffective = holdsLicence || (isComputerProgram && hasComputerProgramLicence);
        var existingLicenceCoversUse = holdsLicenceEffective && licenceCoversProposedUse;
        var isBuildingExceptionApplicable = function () {
            var disqualifying = isTextualMaterial || isComputerProgram || isTextualCompilation || isDramaticWork || isMusicalWork || isCinematographFilm || isSoundRecording || isPublishedEdition;
            if (disqualifying)
                return false;
            return isBuildingPublicSculptureOrCraft;
        }
        ();
        var specialException = false;
        if (proposedUsePurpose === 'criticism or review' || proposedUsePurpose === 'parody or satire' || proposedUsePurpose === 'reporting news')
            specialException = true;
        if (drawsOrPhotographsMaterial && isBuildingExceptionApplicable)
            specialException = true;
        if (ownsMaterial && proposesToCopyMaterial && proposedUsePurpose === 'private or domestic purposes' && (keepsCopyAndOriginalPrivately || lendsCopyOrOriginalToFamilyOrHousehold))
            specialException = true;
        if (institutionDescription === 'a library' || institutionDescription === 'an educational institution' || institutionDescription === 'both')
            specialException = true;
        if (governmentUse === true)
            specialException = true;
        if (isComputerProgram && (ownsComputerProgram || hasComputerProgramLicence))
            specialException = true;
        var domesticDecision = protectedMaterial && usesLargeOrImportant && copyrightNotExpired && ownerHasExclusiveRightForUse && !existingLicenceCoversUse && !organisationOwnsCopyright && !specialException;
        return {
            mightNeedCopyrightPermission: domesticDecision
        };
    }
    return {
        mightNeedCopyrightPermission: false
    };
}

So by sticking to policy wording even closer, we can clearly see – in a single example, I grant you – source document language influencing the generated function.

I hope this post has helped give you guidance about how to proceed with Policy Nodes.

Author: Richard Napier

With over thirty years experience in ERP, CRM, CX and Policy Automation, Richard Napier has lived through all the hype cycles of the last three decades - windows, client server, web, SaaS, cloud and AI. He is the owner of Intelligent Advisor IT Consulting and Co-Founder of siebelhub.com.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Intelligent Advisor IT Consulting Serving Customers Worldwide
Hide picture