Skip to content

Feature/document import - #29

Merged
lindenmckenzie merged 7 commits into
mainfrom
feature/document-import
Oct 27, 2026
Merged

lindenmckenzie merged 7 commits into
mainfrom
feature/document-import

Conversation

@lindenmckenzie

Copy link
Copy Markdown
Contributor

What

Added document import command - it will add documents by using production data and then it will rebuild the term judgements by checking what documents are returned for each term.

I've additionally exposed the 'rebuildTermJudgements' to the CLI in case we want to rebuild for any other reason.

How to review

Try it by exporting the documents and the adding a new one from the ONS website.

Who can review

Not me.

@lindenmckenzie
lindenmckenzie requested a review from a team as a code owner October 22, 2026 10:30
@lindenmckenzie
lindenmckenzie force-pushed the feature/document-import branch from 7ecc25a to 2a17f3a Compare October 27, 2026 08:27

@cookel2 cookel2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to export the documents.csv, then add details of a new document from prod, then import it with my changes successfully. I then deleted the documents.csv from the root and re-ran the export to check that the change would be exported, which it was, so that all worked well. Just a few suggestions here.

Comment thread app/documents_test.go Resolved
Comment thread app/documents_test.go Resolved
Comment thread cmd/rebuild.go Outdated
return exportCmd, nil
}

func rebuildJudgementsCommand(outputPath *string) *cobra.Command {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outputPath parameter is unused so can be deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved.

Comment thread go.mod Outdated
github.com/ONSdigital/dp-healthcheck v1.6.4 // indirect
github.com/ONSdigital/dp-net/v3 v3.5.0 // indirect
github.com/ONSdigital/dp-otel-go v0.0.8 // indirect
github.com/ONSdigital/dp-search-api v1.59.0 // indirect

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you might need to run a go mod tidy as this has become a direct dependency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved.

Comment thread Makefile
import-judgements:
go run main.go import judgements -i judgements.csv

import-documents:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add this to the readme with details of how to get the information that needs to go into the documents.csv i.e. the doc_id, uri, and title. I think that last 2 are pretty obvious but for the doc_id I was unsure whether I should be looking for something or just making it up?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved.

@lindenmckenzie
lindenmckenzie force-pushed the feature/document-import branch from 2e739a0 to a239138 Compare October 27, 2026 14:34
@cookel2
cookel2 self-requested a review October 27, 2026 14:38
@lindenmckenzie
lindenmckenzie force-pushed the feature/document-import branch from a239138 to cb97386 Compare October 27, 2026 14:39

@cookel2 cookel2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lindenmckenzie
lindenmckenzie merged commit cb97386 into main Oct 27, 2026
7 checks passed
@lindenmckenzie
lindenmckenzie deleted the feature/document-import branch October 28, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants