← All repositories

reportage

A life-logging app for iPhone

git clone https://code.inqk.net/reportage.git


commit 6dd422249dca5f44372386b491e5408462ac0d6a
parent b294eafff7e49d0eb6f8cde60c291948cde05793
Author: Michael Camilleri <[email protected]>
Date:   Fri, 16 Oct 2026 14:01:59 +0900

Add project scaffold, data model and Reporter importer

This commit begins Phase 1 of the design. It sets up the project in the
same shape as Crossmate — an XcodeGen project.yml, build and test
scripts that pick a simulator automatically, and a .swift-format
configuration — together with the Core Data model and an importer for
Reporter's JSON export, so the data model can be proven against a
decade of real reports before any UI depends on it.

The model stores questions, reports and responses, with each report's
context encoded as a single value and its time zone recorded explicitly.
It also normalises the Weather Underground and Dark Sky eras, treats the
placeholder records written after Dark Sky shut down as no weather, and
infers information Reporter did not record.

Imports are idempotent. Reports and questions keep their Reporter IDs,
so importing a newer export adds only the new reports, and questions
already in the store keep any edits made in Reportage. Each report
keeps its original snapshot in legacy byte for byte, because the
importer slices the source bytes rather than re-serialising the decoded
value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Diffstat

A.swift-format | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage.xcodeproj/project.pbxproj | 592++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 7+++++++
AReportage.xcodeproj/xcshareddata/xcschemes/Reportage.xcscheme | 125+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage/Info.plist | 34++++++++++++++++++++++++++++++++++
AReportage/ReportageApp.swift | 13+++++++++++++
AReportage/Services/ReporterImport/JSONSlicer.swift | 157+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage/Services/ReporterImport/ReporterArchive.swift | 237+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage/Services/ReporterImport/ReporterImportPlan.swift | 618+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage/Services/ReporterImport/ReporterImportVerifier.swift | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage/Services/ReporterImport/ReporterImporter.swift | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage/Services/ReporterImport/ReporterTimeZones.swift | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReportage/Views/ContentView.swift | 12++++++++++++
AScripts/build.sh | 15+++++++++++++++
AScripts/select-simulator.sh | 32++++++++++++++++++++++++++++++++
AScripts/test-unit.sh | 13+++++++++++++
AShared/Models/Context.swift | 142+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AShared/Models/Question.swift | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
AShared/Models/Report.swift | 48++++++++++++++++++++++++++++++++++++++++++++++++
AShared/Models/Response.swift | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AShared/Persistence/EntityMapping.swift | 143+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AShared/Persistence/LegacyBlob.swift | 13+++++++++++++
AShared/Persistence/PersistenceController.swift | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AShared/Persistence/ReportageModel.xcdatamodeld/ReportageModel.xcdatamodel/contents | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Support/TestHelpers.swift | 50++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Support/reporter-fixture.json | 97+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Unit/JSONSlicerTests.swift | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Unit/ModelCodingTests.swift | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Unit/RealExportVerificationTests.swift | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Unit/ReporterArchiveTests.swift | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Unit/ReporterImportPlanTests.swift | 333+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATests/Unit/ReporterImporterTests.swift | 119+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproject.yml | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

33 files changed, 3763 insertions(+), 0 deletions(-)

diff --git a/.swift-format b/.swift-format

@@ -0,0 +1,75 @@
+{
+  "fileScopedDeclarationPrivacy" : {
+    "accessLevel" : "private"
+  },
+  "indentConditionalCompilationBlocks" : true,
+  "indentSwitchCaseLabels" : false,
+  "indentation" : {
+    "spaces" : 4
+  },
+  "lineBreakAroundMultilineExpressionChainComponents" : false,
+  "lineBreakBeforeControlFlowKeywords" : false,
+  "lineBreakBeforeEachArgument" : false,
+  "lineBreakBeforeEachGenericRequirement" : false,
+  "lineBreakBetweenDeclarationAttributes" : false,
+  "lineLength" : 100,
+  "maximumBlankLines" : 1,
+  "multiElementCollectionTrailingCommas" : true,
+  "noAssignmentInExpressions" : {
+    "allowedFunctions" : [
+      "XCTAssertNoThrow"
+    ]
+  },
+  "prioritizeKeepingFunctionOutputTogether" : false,
+  "reflowMultilineStringLiterals" : "never",
+  "respectsExistingLineBreaks" : true,
+  "rules" : {
+    "AllPublicDeclarationsHaveDocumentation" : false,
+    "AlwaysUseLiteralForEmptyCollectionInit" : false,
+    "AlwaysUseLowerCamelCase" : true,
+    "AmbiguousTrailingClosureOverload" : true,
+    "AvoidRetroactiveConformances" : true,
+    "BeginDocumentationCommentWithOneLineSummary" : false,
+    "DoNotUseSemicolons" : true,
+    "DontRepeatTypeInStaticProperties" : true,
+    "FileScopedDeclarationPrivacy" : true,
+    "FullyIndirectEnum" : true,
+    "GroupNumericLiterals" : true,
+    "IdentifiersMustBeASCII" : true,
+    "NeverForceUnwrap" : false,
+    "NeverUseForceTry" : false,
+    "NeverUseImplicitlyUnwrappedOptionals" : false,
+    "NoAccessLevelOnExtensionDeclaration" : true,
+    "NoAssignmentInExpressions" : true,
+    "NoBlockComments" : true,
+    "NoCasesWithOnlyFallthrough" : true,
+    "NoEmptyLinesOpeningClosingBraces" : false,
+    "NoEmptyTrailingClosureParentheses" : true,
+    "NoLabelsInCasePatterns" : true,
+    "NoLeadingUnderscores" : false,
+    "NoParensAroundConditions" : true,
+    "NoPlaygroundLiterals" : true,
+    "NoVoidReturnOnFunctionSignature" : true,
+    "OmitExplicitReturns" : false,
+    "OneCasePerLine" : true,
+    "OneVariableDeclarationPerLine" : true,
+    "OnlyOneTrailingClosureArgument" : true,
+    "OrderedImports" : true,
+    "ReplaceForEachWithForLoop" : true,
+    "ReturnVoidInsteadOfEmptyTuple" : true,
+    "TypeNamesShouldBeCapitalized" : true,
+    "UseEarlyExits" : false,
+    "UseExplicitNilCheckInConditions" : true,
+    "UseLetInEveryBoundCaseVariable" : true,
+    "UseShorthandTypeNames" : true,
+    "UseSingleLinePropertyGetter" : true,
+    "UseSynthesizedInitializer" : true,
+    "UseTripleSlashForDocumentationComments" : true,
+    "UseWhereClausesInForLoops" : false,
+    "ValidateDocumentationComments" : false
+  },
+  "spacesAroundRangeFormationOperators" : false,
+  "spacesBeforeEndOfLineComments" : 2,
+  "tabWidth" : 8,
+  "version" : 1
+}

diff --git a/Reportage.xcodeproj/project.pbxproj b/Reportage.xcodeproj/project.pbxproj

@@ -0,0 +1,592 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 77;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		06415D2A2EDA6E92ECAC96FA /* Report.swift in Sources */ = {isa = PBXBuildFile; fileRef = B03734F91822E7F161432075 /* Report.swift */; };
+		28D2CDAAB0777233D4465A83 /* ReporterArchiveTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487F88C880B5DE69964C6A37 /* ReporterArchiveTests.swift */; };
+		3175E324135E1CF5A73683D1 /* ReporterTimeZones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7196D553D769071DB876B606 /* ReporterTimeZones.swift */; };
+		3244B8439B5E4F79FF84C156 /* JSONSlicer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 643C730A99F0B7BA8C1F8A8E /* JSONSlicer.swift */; };
+		36A35625365E87B39CB88194 /* ReporterImporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48D44876FDE4293FA0460595 /* ReporterImporter.swift */; };
+		3FBE5C53D33EF78752BEACE0 /* ReporterImportVerifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED0CAE575381DCB86FB8EE9 /* ReporterImportVerifier.swift */; };
+		406D536D7764B3FEB140CAA0 /* EntityMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE7248E73E2859EFF232170 /* EntityMapping.swift */; };
+		4A0DEFB7E69A9FC5EAAD99D4 /* RealExportVerificationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF3B490F336FCE1E1E3DDBA /* RealExportVerificationTests.swift */; };
+		68DDAB8BB2E679EB7EC1E9C1 /* ReporterImportPlan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798E1DE82BD53EC5BEBA76B7 /* ReporterImportPlan.swift */; };
+		6F06CC539C4D17B343A9321C /* LegacyBlob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FFB17809ADA84F1036E2A7 /* LegacyBlob.swift */; };
+		89AD9247DEBDB7017EC8E017 /* reporter-fixture.json in Resources */ = {isa = PBXBuildFile; fileRef = 60457C07EF790C11D6C47EDF /* reporter-fixture.json */; };
+		8ADBA81D5D9ECCDCD5BDA742 /* JSONSlicerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4AFF3D49ED9E8AC69390925 /* JSONSlicerTests.swift */; };
+		8AF60BB296144ED9D11EA053 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6024EA06BE24A189D4F7D0E4 /* Response.swift */; };
+		961848A8D899BC67FA43F475 /* ReportageApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 383FF2C73A8FBAA2AB13D653 /* ReportageApp.swift */; };
+		964408E4D25713F627048C77 /* ModelCodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C606A9B0EF8D84950B9681B /* ModelCodingTests.swift */; };
+		9EF3CB3707CD6B5AFFD3B767 /* ReporterArchive.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC1C5F0F722477CDA949F018 /* ReporterArchive.swift */; };
+		AD22705E9154633961006403 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B8284AB637F8542721C8A /* ContentView.swift */; };
+		C5D94FEC4507054E6497E85B /* PersistenceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61C0B5BB02ECDBE84F5F73FA /* PersistenceController.swift */; };
+		C8E02DEA2119E61D31667FFE /* ReporterImportPlanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FD562C0C92C1D59881C771E /* ReporterImportPlanTests.swift */; };
+		DF632654B427EE32C44C6F78 /* Context.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F200EBD30BC12D2313E6C6F /* Context.swift */; };
+		E68EF6274FD2F6D54D49F5BD /* ReporterImporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 917C4579342FAC42F6C616FC /* ReporterImporterTests.swift */; };
+		E8CC84072697836F87D8A00D /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20C574BC234EDBD4056E2B7 /* TestHelpers.swift */; };
+		EFF44121C9ECBFBCAC1D7730 /* ReportageModel.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = A49FBFD55992A79B9A6492C4 /* ReportageModel.xcdatamodeld */; };
+		F38A1CCFAF016AB982EAB791 /* Question.swift in Sources */ = {isa = PBXBuildFile; fileRef = B007E6BACAA214C7332EF77C /* Question.swift */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		C4BC163B82A12D0810FCC0E8 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = E54115BC20AD1649DD951B20 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = CADA375B316EB71CDEE1FE5B;
+			remoteInfo = Reportage;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		0B35602A218BE4EE399835FD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+		1F200EBD30BC12D2313E6C6F /* Context.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Context.swift; sourceTree = "<group>"; };
+		30FFB17809ADA84F1036E2A7 /* LegacyBlob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyBlob.swift; sourceTree = "<group>"; };
+		383FF2C73A8FBAA2AB13D653 /* ReportageApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportageApp.swift; sourceTree = "<group>"; };
+		3DF3B490F336FCE1E1E3DDBA /* RealExportVerificationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealExportVerificationTests.swift; sourceTree = "<group>"; };
+		3ED0CAE575381DCB86FB8EE9 /* ReporterImportVerifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterImportVerifier.swift; sourceTree = "<group>"; };
+		487F88C880B5DE69964C6A37 /* ReporterArchiveTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterArchiveTests.swift; sourceTree = "<group>"; };
+		48D44876FDE4293FA0460595 /* ReporterImporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterImporter.swift; sourceTree = "<group>"; };
+		5BE7248E73E2859EFF232170 /* EntityMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityMapping.swift; sourceTree = "<group>"; };
+		5C2AB8F226532A0889E2BCAD /* Reportage.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Reportage.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		5C606A9B0EF8D84950B9681B /* ModelCodingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelCodingTests.swift; sourceTree = "<group>"; };
+		6024EA06BE24A189D4F7D0E4 /* Response.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Response.swift; sourceTree = "<group>"; };
+		60457C07EF790C11D6C47EDF /* reporter-fixture.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "reporter-fixture.json"; sourceTree = "<group>"; };
+		61C0B5BB02ECDBE84F5F73FA /* PersistenceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceController.swift; sourceTree = "<group>"; };
+		643C730A99F0B7BA8C1F8A8E /* JSONSlicer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONSlicer.swift; sourceTree = "<group>"; };
+		7196D553D769071DB876B606 /* ReporterTimeZones.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterTimeZones.swift; sourceTree = "<group>"; };
+		798E1DE82BD53EC5BEBA76B7 /* ReporterImportPlan.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterImportPlan.swift; sourceTree = "<group>"; };
+		7ABE75DB46245AFDE8A44A48 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
+		7FD562C0C92C1D59881C771E /* ReporterImportPlanTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterImportPlanTests.swift; sourceTree = "<group>"; };
+		917C4579342FAC42F6C616FC /* ReporterImporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterImporterTests.swift; sourceTree = "<group>"; };
+		9A5B8284AB637F8542721C8A /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
+		A20C574BC234EDBD4056E2B7 /* TestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestHelpers.swift; sourceTree = "<group>"; };
+		B007E6BACAA214C7332EF77C /* Question.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Question.swift; sourceTree = "<group>"; };
+		B03734F91822E7F161432075 /* Report.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Report.swift; sourceTree = "<group>"; };
+		CC1C5F0F722477CDA949F018 /* ReporterArchive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReporterArchive.swift; sourceTree = "<group>"; };
+		D03D0770BA2E26D7E4A7DECC /* ReportageModel.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = ReportageModel.xcdatamodel; sourceTree = "<group>"; };
+		D4AFF3D49ED9E8AC69390925 /* JSONSlicerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONSlicerTests.swift; sourceTree = "<group>"; };
+		E21F898FF60FC3A6AFCA06E9 /* Reportage Unit Tests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = "Reportage Unit Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXGroup section */
+		4C708676FBAD641AD92F8CA0 /* Reportage */ = {
+			isa = PBXGroup;
+			children = (
+				0B35602A218BE4EE399835FD /* Info.plist */,
+				383FF2C73A8FBAA2AB13D653 /* ReportageApp.swift */,
+				60B58F5030E4A690025C51F5 /* Services */,
+				CA92EB21187B147C08A112F7 /* Views */,
+			);
+			path = Reportage;
+			sourceTree = "<group>";
+		};
+		4EF63181707B888F4ECDB980 /* Models */ = {
+			isa = PBXGroup;
+			children = (
+				1F200EBD30BC12D2313E6C6F /* Context.swift */,
+				B007E6BACAA214C7332EF77C /* Question.swift */,
+				B03734F91822E7F161432075 /* Report.swift */,
+				6024EA06BE24A189D4F7D0E4 /* Response.swift */,
+			);
+			path = Models;
+			sourceTree = "<group>";
+		};
+		5253526A8B292306AB33EFF0 /* Support */ = {
+			isa = PBXGroup;
+			children = (
+				60457C07EF790C11D6C47EDF /* reporter-fixture.json */,
+				A20C574BC234EDBD4056E2B7 /* TestHelpers.swift */,
+			);
+			name = Support;
+			path = Tests/Support;
+			sourceTree = "<group>";
+		};
+		60B58F5030E4A690025C51F5 /* Services */ = {
+			isa = PBXGroup;
+			children = (
+				F7B8E02FFC282DCD163E25FE /* ReporterImport */,
+			);
+			path = Services;
+			sourceTree = "<group>";
+		};
+		6939F7C2C95274DF2BB62D20 /* Shared */ = {
+			isa = PBXGroup;
+			children = (
+				4EF63181707B888F4ECDB980 /* Models */,
+				B9570B011A58C1B1BF00FB73 /* Persistence */,
+			);
+			path = Shared;
+			sourceTree = "<group>";
+		};
+		78F7B34F781A8894EDCB8C74 /* Unit */ = {
+			isa = PBXGroup;
+			children = (
+				D4AFF3D49ED9E8AC69390925 /* JSONSlicerTests.swift */,
+				5C606A9B0EF8D84950B9681B /* ModelCodingTests.swift */,
+				3DF3B490F336FCE1E1E3DDBA /* RealExportVerificationTests.swift */,
+				487F88C880B5DE69964C6A37 /* ReporterArchiveTests.swift */,
+				917C4579342FAC42F6C616FC /* ReporterImporterTests.swift */,
+				7FD562C0C92C1D59881C771E /* ReporterImportPlanTests.swift */,
+			);
+			name = Unit;
+			path = Tests/Unit;
+			sourceTree = "<group>";
+		};
+		7EAE4854ED2FFD31702D2993 = {
+			isa = PBXGroup;
+			children = (
+				E41738BD317EF71D850CF801 /* Generated */,
+				4C708676FBAD641AD92F8CA0 /* Reportage */,
+				6939F7C2C95274DF2BB62D20 /* Shared */,
+				5253526A8B292306AB33EFF0 /* Support */,
+				78F7B34F781A8894EDCB8C74 /* Unit */,
+				B5824AFC6F20AC08247A4DC5 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		B5824AFC6F20AC08247A4DC5 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				E21F898FF60FC3A6AFCA06E9 /* Reportage Unit Tests.xctest */,
+				5C2AB8F226532A0889E2BCAD /* Reportage.app */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		B9570B011A58C1B1BF00FB73 /* Persistence */ = {
+			isa = PBXGroup;
+			children = (
+				5BE7248E73E2859EFF232170 /* EntityMapping.swift */,
+				30FFB17809ADA84F1036E2A7 /* LegacyBlob.swift */,
+				61C0B5BB02ECDBE84F5F73FA /* PersistenceController.swift */,
+				A49FBFD55992A79B9A6492C4 /* ReportageModel.xcdatamodeld */,
+			);
+			path = Persistence;
+			sourceTree = "<group>";
+		};
+		CA92EB21187B147C08A112F7 /* Views */ = {
+			isa = PBXGroup;
+			children = (
+				9A5B8284AB637F8542721C8A /* ContentView.swift */,
+			);
+			path = Views;
+			sourceTree = "<group>";
+		};
+		E41738BD317EF71D850CF801 /* Generated */ = {
+			isa = PBXGroup;
+			children = (
+				7ABE75DB46245AFDE8A44A48 /* Config.xcconfig */,
+			);
+			path = Generated;
+			sourceTree = "<group>";
+		};
+		F7B8E02FFC282DCD163E25FE /* ReporterImport */ = {
+			isa = PBXGroup;
+			children = (
+				643C730A99F0B7BA8C1F8A8E /* JSONSlicer.swift */,
+				CC1C5F0F722477CDA949F018 /* ReporterArchive.swift */,
+				48D44876FDE4293FA0460595 /* ReporterImporter.swift */,
+				798E1DE82BD53EC5BEBA76B7 /* ReporterImportPlan.swift */,
+				3ED0CAE575381DCB86FB8EE9 /* ReporterImportVerifier.swift */,
+				7196D553D769071DB876B606 /* ReporterTimeZones.swift */,
+			);
+			path = ReporterImport;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		86F8617594446FA3ED0A3D35 /* Reportage Unit Tests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 36EF424AAAFA9D347CDAF12B /* Build configuration list for PBXNativeTarget "Reportage Unit Tests" */;
+			buildPhases = (
+				9D9D7490B6C348C5A05545C7 /* Sources */,
+				69A4C9BA585E4956850349EF /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				5E0FFA61CE9F785C1F7B062B /* PBXTargetDependency */,
+			);
+			name = "Reportage Unit Tests";
+			packageProductDependencies = (
+			);
+			productName = "Reportage Unit Tests";
+			productReference = E21F898FF60FC3A6AFCA06E9 /* Reportage Unit Tests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+		CADA375B316EB71CDEE1FE5B /* Reportage */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 0BDF6397081D7F97A8283020 /* Build configuration list for PBXNativeTarget "Reportage" */;
+			buildPhases = (
+				9F7B3262E96479048C6F2F04 /* Sources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = Reportage;
+			packageProductDependencies = (
+			);
+			productName = Reportage;
+			productReference = 5C2AB8F226532A0889E2BCAD /* Reportage.app */;
+			productType = "com.apple.product-type.application";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		E54115BC20AD1649DD951B20 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				BuildIndependentTargetsInParallel = YES;
+				LastUpgradeCheck = 1430;
+				TargetAttributes = {
+					86F8617594446FA3ED0A3D35 = {
+						DevelopmentTeam = 7TD7PZBNXP;
+						ProvisioningStyle = Automatic;
+					};
+					CADA375B316EB71CDEE1FE5B = {
+						DevelopmentTeam = 7TD7PZBNXP;
+						ProvisioningStyle = Automatic;
+					};
+				};
+			};
+			buildConfigurationList = FB3AF546A563926C1C0CD963 /* Build configuration list for PBXProject "Reportage" */;
+			developmentRegion = en;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				Base,
+				en,
+			);
+			mainGroup = 7EAE4854ED2FFD31702D2993;
+			minimizedProjectReferenceProxies = 1;
+			preferredProjectObjectVersion = 77;
+			productRefGroup = B5824AFC6F20AC08247A4DC5 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				CADA375B316EB71CDEE1FE5B /* Reportage */,
+				86F8617594446FA3ED0A3D35 /* Reportage Unit Tests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		69A4C9BA585E4956850349EF /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				89AD9247DEBDB7017EC8E017 /* reporter-fixture.json in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		9D9D7490B6C348C5A05545C7 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8ADBA81D5D9ECCDCD5BDA742 /* JSONSlicerTests.swift in Sources */,
+				964408E4D25713F627048C77 /* ModelCodingTests.swift in Sources */,
+				4A0DEFB7E69A9FC5EAAD99D4 /* RealExportVerificationTests.swift in Sources */,
+				28D2CDAAB0777233D4465A83 /* ReporterArchiveTests.swift in Sources */,
+				C8E02DEA2119E61D31667FFE /* ReporterImportPlanTests.swift in Sources */,
+				E68EF6274FD2F6D54D49F5BD /* ReporterImporterTests.swift in Sources */,
+				E8CC84072697836F87D8A00D /* TestHelpers.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9F7B3262E96479048C6F2F04 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				AD22705E9154633961006403 /* ContentView.swift in Sources */,
+				DF632654B427EE32C44C6F78 /* Context.swift in Sources */,
+				406D536D7764B3FEB140CAA0 /* EntityMapping.swift in Sources */,
+				3244B8439B5E4F79FF84C156 /* JSONSlicer.swift in Sources */,
+				6F06CC539C4D17B343A9321C /* LegacyBlob.swift in Sources */,
+				C5D94FEC4507054E6497E85B /* PersistenceController.swift in Sources */,
+				F38A1CCFAF016AB982EAB791 /* Question.swift in Sources */,
+				06415D2A2EDA6E92ECAC96FA /* Report.swift in Sources */,
+				961848A8D899BC67FA43F475 /* ReportageApp.swift in Sources */,
+				EFF44121C9ECBFBCAC1D7730 /* ReportageModel.xcdatamodeld in Sources */,
+				9EF3CB3707CD6B5AFFD3B767 /* ReporterArchive.swift in Sources */,
+				68DDAB8BB2E679EB7EC1E9C1 /* ReporterImportPlan.swift in Sources */,
+				3FBE5C53D33EF78752BEACE0 /* ReporterImportVerifier.swift in Sources */,
+				36A35625365E87B39CB88194 /* ReporterImporter.swift in Sources */,
+				3175E324135E1CF5A73683D1 /* ReporterTimeZones.swift in Sources */,
+				8AF60BB296144ED9D11EA053 /* Response.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		5E0FFA61CE9F785C1F7B062B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = CADA375B316EB71CDEE1FE5B /* Reportage */;
+			targetProxy = C4BC163B82A12D0810FCC0E8 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		0D07121C45CBEC3A5F5278E1 /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 7ABE75DB46245AFDE8A44A48 /* Config.xcconfig */;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_EXTENSIONS = YES;
+				ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				DEVELOPMENT_TEAM = 7TD7PZBNXP;
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_USER_SCRIPT_SANDBOXING = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 26.0;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				MTL_FAST_MATH = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				STRING_CATALOG_GENERATE_SYMBOLS = YES;
+				SWIFT_COMPILATION_MODE = wholemodule;
+				SWIFT_EMIT_LOC_STRINGS = YES;
+				SWIFT_OPTIMIZATION_LEVEL = "-O";
+				SWIFT_VERSION = 6;
+			};
+			name = Release;
+		};
+		116B0C18BAD90E0A7CCF5037 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				BUNDLE_LOADER = "$(TEST_HOST)";
+				CODE_SIGN_STYLE = Automatic;
+				GENERATE_INFOPLIST_FILE = YES;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = net.inqk.reportage.unittests;
+				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Reportage.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Reportage";
+			};
+			name = Debug;
+		};
+		34465E754A4E240D0400832F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 7ABE75DB46245AFDE8A44A48 /* Config.xcconfig */;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_EXTENSIONS = YES;
+				ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DEVELOPMENT_TEAM = 7TD7PZBNXP;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
+				ENABLE_USER_SCRIPT_SANDBOXING = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(inherited)",
+					"DEBUG=1",
+				);
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 26.0;
+				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+				MTL_FAST_MATH = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				STRING_CATALOG_GENERATE_SYMBOLS = YES;
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+				SWIFT_EMIT_LOC_STRINGS = YES;
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+				SWIFT_VERSION = 6;
+			};
+			name = Debug;
+		};
+		929BBA3FACC7860F41C02F89 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				BUNDLE_LOADER = "$(TEST_HOST)";
+				CODE_SIGN_STYLE = Automatic;
+				GENERATE_INFOPLIST_FILE = YES;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = net.inqk.reportage.unittests;
+				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Reportage.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Reportage";
+			};
+			name = Release;
+		};
+		950494B4051565F793BC0C07 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				CODE_SIGN_STYLE = Automatic;
+				INFOPLIST_FILE = Reportage/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
+				OTHER_LDFLAGS = "$(inherited) -Wl,-no_deduplicate";
+				PRODUCT_BUNDLE_IDENTIFIER = net.inqk.reportage;
+				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = 1;
+			};
+			name = Release;
+		};
+		BB279E52E686782A1BA19C8C /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				CODE_SIGN_STYLE = Automatic;
+				INFOPLIST_FILE = Reportage/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = net.inqk.reportage;
+				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = 1;
+			};
+			name = Debug;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		0BDF6397081D7F97A8283020 /* Build configuration list for PBXNativeTarget "Reportage" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				BB279E52E686782A1BA19C8C /* Debug */,
+				950494B4051565F793BC0C07 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		36EF424AAAFA9D347CDAF12B /* Build configuration list for PBXNativeTarget "Reportage Unit Tests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				116B0C18BAD90E0A7CCF5037 /* Debug */,
+				929BBA3FACC7860F41C02F89 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		FB3AF546A563926C1C0CD963 /* Build configuration list for PBXProject "Reportage" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				34465E754A4E240D0400832F /* Debug */,
+				0D07121C45CBEC3A5F5278E1 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+/* End XCConfigurationList section */
+
+/* Begin XCVersionGroup section */
+		A49FBFD55992A79B9A6492C4 /* ReportageModel.xcdatamodeld */ = {
+			isa = XCVersionGroup;
+			children = (
+				D03D0770BA2E26D7E4A7DECC /* ReportageModel.xcdatamodel */,
+			);
+			currentVersion = D03D0770BA2E26D7E4A7DECC /* ReportageModel.xcdatamodel */;
+			path = ReportageModel.xcdatamodeld;
+			sourceTree = "<group>";
+			versionGroupType = wrapper.xcdatamodel;
+		};
+/* End XCVersionGroup section */
+	};
+	rootObject = E54115BC20AD1649DD951B20 /* Project object */;
+}

diff --git a/Reportage.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Reportage.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:">
+   </FileRef>
+</Workspace>

diff --git a/Reportage.xcodeproj/xcshareddata/xcschemes/Reportage.xcscheme b/Reportage.xcodeproj/xcshareddata/xcschemes/Reportage.xcscheme

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1430"
+   version = "1.7">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES"
+      runPostActionsOnFailure = "NO">
+      <PreActions>
+         <ExecutionAction
+            ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
+            <ActionContent
+               title = "Run Script"
+               scriptText = "cd &quot;${SRCROOT}&quot;&#10;mkdir -p Generated&#10;unset SWIFT_DEBUG_INFORMATION_FORMAT SWIFT_DEBUG_INFORMATION_VERSION&#10;buildYear=`git log -1 --format=%cd --date=format:%Y`&#10;buildVersion=`git rev-list HEAD | wc -l | tr -d &apos; &apos;`&#10;{&#10;  echo &apos;#include? &quot;Local.xcconfig&quot;&apos;&#10;  echo &quot;CURRENT_PROJECT_VERSION = $buildYear.$buildVersion&quot;&#10;} &gt; Generated/Config.xcconfig&#10;">
+               <EnvironmentBuildable>
+                  <BuildableReference
+                     BuildableIdentifier = "primary"
+                     BlueprintIdentifier = "CADA375B316EB71CDEE1FE5B"
+                     BuildableName = "Reportage.app"
+                     BlueprintName = "Reportage"
+                     ReferencedContainer = "container:Reportage.xcodeproj">
+                  </BuildableReference>
+               </EnvironmentBuildable>
+            </ActionContent>
+         </ExecutionAction>
+      </PreActions>
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "CADA375B316EB71CDEE1FE5B"
+               BuildableName = "Reportage.app"
+               BlueprintName = "Reportage"
+               ReferencedContainer = "container:Reportage.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      onlyGenerateCoverageForSpecifiedTargets = "NO">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "CADA375B316EB71CDEE1FE5B"
+            BuildableName = "Reportage.app"
+            BlueprintName = "Reportage"
+            ReferencedContainer = "container:Reportage.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <Testables>
+         <TestableReference
+            skipped = "NO"
+            parallelizable = "NO"
+            testExecutionOrdering = "random">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "86F8617594446FA3ED0A3D35"
+               BuildableName = "Reportage Unit Tests.xctest"
+               BlueprintName = "Reportage Unit Tests"
+               ReferencedContainer = "container:Reportage.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+      </Testables>
+      <CommandLineArguments>
+      </CommandLineArguments>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "CADA375B316EB71CDEE1FE5B"
+            BuildableName = "Reportage.app"
+            BlueprintName = "Reportage"
+            ReferencedContainer = "container:Reportage.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <CommandLineArguments>
+      </CommandLineArguments>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "CADA375B316EB71CDEE1FE5B"
+            BuildableName = "Reportage.app"
+            BlueprintName = "Reportage"
+            ReferencedContainer = "container:Reportage.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <CommandLineArguments>
+      </CommandLineArguments>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

diff --git a/Reportage/Info.plist b/Reportage/Info.plist

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
+	<key>CFBundleDisplayName</key>
+	<string>Reportage</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0.0</string>
+	<key>CFBundleVersion</key>
+	<string>$(CURRENT_PROJECT_VERSION)</string>
+	<key>ITSAppUsesNonExemptEncryption</key>
+	<false/>
+	<key>LSRequiresIPhoneOS</key>
+	<true/>
+	<key>UILaunchScreen</key>
+	<dict/>
+	<key>UISupportedInterfaceOrientations</key>
+	<array>
+		<string>UIInterfaceOrientationPortrait</string>
+	</array>
+</dict>
+</plist>

diff --git a/Reportage/ReportageApp.swift b/Reportage/ReportageApp.swift

@@ -0,0 +1,13 @@
+import SwiftUI
+
+@main
+struct ReportageApp: App {
+    private let persistence = PersistenceController()
+
+    var body: some Scene {
+        WindowGroup {
+            ContentView()
+                .environment(\.managedObjectContext, persistence.viewContext)
+        }
+    }
+}

diff --git a/Reportage/Services/ReporterImport/JSONSlicer.swift b/Reportage/Services/ReporterImport/JSONSlicer.swift

@@ -0,0 +1,157 @@
+import Foundation
+
+/// Finds the byte ranges of JSON values without decoding them.
+///
+/// The Reporter importer keeps each snapshot's original bytes in
+/// `Report.legacy`. Re-serialising a decoded snapshot would reorder keys and
+/// reformat numbers, so the importer slices the source bytes instead and
+/// decodes each slice separately.
+///
+/// The slicer assumes well-formed JSON. It checks structure only as far as it
+/// needs to find value boundaries; each slice is validated when it's decoded.
+enum JSONSlicer {
+    enum Error: Swift.Error, Equatable {
+        case unexpectedEnd
+        case unexpectedByte(UInt8, offset: Int)
+    }
+
+    /// Returns the members of the object starting at `offset`, in order.
+    static func objectMembers(in data: Data, at offset: Int) throws -> [(
+        key: String, range: Range<Int>
+    )] {
+        try data.withUnsafeBytes { raw in
+            var cursor = Cursor(
+                bytes: raw.bindMemory(to: UInt8.self), position: offset - data.startIndex)
+            var members: [(key: String, range: Range<Int>)] = []
+            try cursor.expect(UInt8(ascii: "{"))
+            cursor.skipWhitespace()
+            if try cursor.peek() == UInt8(ascii: "}") { return members }
+            while true {
+                cursor.skipWhitespace()
+                let keyStart = cursor.position
+                try cursor.skipString()
+                let key = try decodeKey(Data(raw[keyStart..<cursor.position]))
+                cursor.skipWhitespace()
+                try cursor.expect(UInt8(ascii: ":"))
+                cursor.skipWhitespace()
+                let valueStart = cursor.position
+                try cursor.skipValue()
+                members.append(
+                    (key, (valueStart + data.startIndex)..<(cursor.position + data.startIndex)))
+                cursor.skipWhitespace()
+                if try cursor.next() == UInt8(ascii: "}") { return members }
+            }
+        }
+    }
+
+    /// Returns the ranges of the elements of the array occupying `range`.
+    static func arrayElements(in data: Data, range: Range<Int>) throws -> [Range<Int>] {
+        try data.withUnsafeBytes { raw in
+            let start = range.lowerBound - data.startIndex
+            var cursor = Cursor(bytes: raw.bindMemory(to: UInt8.self), position: start)
+            var elements: [Range<Int>] = []
+            try cursor.expect(UInt8(ascii: "["))
+            cursor.skipWhitespace()
+            if try cursor.peek() == UInt8(ascii: "]") { return elements }
+            while true {
+                cursor.skipWhitespace()
+                let elementStart = cursor.position
+                try cursor.skipValue()
+                elements.append(
+                    (elementStart + data.startIndex)..<(cursor.position + data.startIndex))
+                cursor.skipWhitespace()
+                if try cursor.next() == UInt8(ascii: "]") { return elements }
+            }
+        }
+    }
+
+    private static func decodeKey(_ quoted: Data) throws -> String {
+        if !quoted.contains(UInt8(ascii: "\\")) {
+            return String(decoding: quoted.dropFirst().dropLast(), as: UTF8.self)
+        }
+        return try JSONDecoder().decode(String.self, from: quoted)
+    }
+
+    private struct Cursor {
+        let bytes: UnsafeBufferPointer<UInt8>
+        var position: Int
+
+        func peek() throws -> UInt8 {
+            guard position < bytes.count else { throw Error.unexpectedEnd }
+            return bytes[position]
+        }
+
+        mutating func next() throws -> UInt8 {
+            let byte = try peek()
+            position += 1
+            return byte
+        }
+
+        mutating func expect(_ expected: UInt8) throws {
+            let byte = try next()
+            guard byte == expected else {
+                throw Error.unexpectedByte(byte, offset: position - 1)
+            }
+        }
+
+        mutating func skipWhitespace() {
+            while position < bytes.count {
+                switch bytes[position] {
+                case 0x20, 0x09, 0x0A, 0x0D: position += 1
+                default: return
+                }
+            }
+        }
+
+        /// Skips a string, including both quotes.
+        mutating func skipString() throws {
+            try expect(UInt8(ascii: "\""))
+            while true {
+                switch try next() {
+                case UInt8(ascii: "\\"): position += 1
+                case UInt8(ascii: "\""): return
+                default: continue
+                }
+            }
+        }
+
+        mutating func skipValue() throws {
+            switch try peek() {
+            case UInt8(ascii: "\""):
+                try skipString()
+            case UInt8(ascii: "{"), UInt8(ascii: "["):
+                var depth = 0
+                while true {
+                    switch try peek() {
+                    case UInt8(ascii: "\""):
+                        try skipString()
+                        continue
+                    case UInt8(ascii: "{"), UInt8(ascii: "["):
+                        depth += 1
+                    case UInt8(ascii: "}"), UInt8(ascii: "]"):
+                        depth -= 1
+                    default:
+                        break
+                    }
+                    position += 1
+                    if depth == 0 { return }
+                }
+            default:
+                // A number or literal: runs until the next delimiter.
+                let start = position
+                while position < bytes.count {
+                    switch bytes[position] {
+                    case UInt8(ascii: ","), UInt8(ascii: "}"), UInt8(ascii: "]"),
+                        0x20, 0x09, 0x0A, 0x0D:
+                        guard position > start else {
+                            throw Error.unexpectedByte(bytes[position], offset: position)
+                        }
+                        return
+                    default:
+                        position += 1
+                    }
+                }
+            }
+        }
+    }
+}

diff --git a/Reportage/Services/ReporterImport/ReporterArchive.swift b/Reportage/Services/ReporterImport/ReporterArchive.swift

@@ -0,0 +1,237 @@
+import Foundation
+
+/// A parsed Reporter JSON export: two top-level arrays, `questions` and
+/// `snapshots`. Each snapshot keeps its original bytes alongside the decoded
+/// fields.
+struct ReporterArchive: Sendable {
+    enum Error: Swift.Error, Equatable {
+        case noJSONObject
+        case missingArray(String)
+    }
+
+    struct Snapshot: Sendable {
+        /// The snapshot's bytes exactly as they appear in the export.
+        var raw: Data
+        /// `nil` when the snapshot couldn't be decoded.
+        var fields: ReporterSnapshot?
+        var decodingError: String?
+    }
+
+    var questions: [ReporterQuestion]
+    var snapshots: [Snapshot]
+
+    init(data: Data) throws {
+        // The export starts with junk (EF BF BF, an encoded U+FFFF) before the
+        // opening brace.
+        guard let start = data.firstIndex(of: UInt8(ascii: "{")) else {
+            throw Error.noJSONObject
+        }
+        let members = try JSONSlicer.objectMembers(in: data, at: start)
+        func range(of key: String) throws -> Range<Int> {
+            guard let member = members.first(where: { $0.key == key }) else {
+                throw Error.missingArray(key)
+            }
+            return member.range
+        }
+
+        let decoder = JSONDecoder()
+        questions = try decoder.decode(
+            [ReporterQuestion].self, from: data[try range(of: "questions")])
+        snapshots = try JSONSlicer.arrayElements(in: data, range: try range(of: "snapshots")).map {
+            range in
+            let raw = Data(data[range])
+            do {
+                return Snapshot(
+                    raw: raw, fields: try decoder.decode(ReporterSnapshot.self, from: raw))
+            } catch {
+                return Snapshot(raw: raw, fields: nil, decodingError: String(describing: error))
+            }
+        }
+    }
+}
+
+// MARK: - Export records
+
+// Field names follow the export. Only the fields Reportage normalises are
+// declared; everything else survives in `Report.legacy`. Numbers are decoded
+// leniently because the export mixes ints, floats and numeric strings for the
+// same field.
+
+struct ReporterQuestion: Decodable, Sendable {
+    var uniqueIdentifier: String
+    var prompt: String
+    var questionType: Int
+    var placeholderString: String?
+}
+
+struct ReporterSnapshot: Decodable, Sendable {
+    var uniqueIdentifier: String
+    var date: String
+    var reportImpetus: LenientNumber?
+    var battery: LenientNumber?
+    var connection: LenientNumber?
+    var steps: LenientNumber?
+    var responses: [ReporterResponse]?
+    var location: ReporterLocation?
+    var weather: ReporterWeather?
+    var audio: ReporterAudio?
+    var altitude: ReporterAltitude?
+    var photoSet: ReporterPhotoSet?
+}
+
+struct ReporterResponse: Decodable, Sendable {
+    var questionPrompt: String
+    var answeredOptions: [String]?
+    var tokens: [ReporterText]?
+    var textResponses: [ReporterText]?
+    var numericResponse: LenientDecimal?
+    var locationResponse: ReporterLocationResponse?
+}
+
+struct ReporterText: Decodable, Sendable {
+    var text: String
+}
+
+struct ReporterLocationResponse: Decodable, Sendable {
+    var text: String
+    var foursquareVenueId: String?
+    var location: ReporterLocation?
+}
+
+struct ReporterLocation: Decodable, Sendable {
+    var latitude: LenientNumber
+    var longitude: LenientNumber
+    var altitude: LenientNumber?
+    var horizontalAccuracy: LenientNumber?
+    var verticalAccuracy: LenientNumber?
+    var speed: LenientNumber?
+    var course: LenientNumber?
+    var timestamp: String?
+    var placemark: ReporterPlacemark?
+}
+
+struct ReporterPlacemark: Decodable, Sendable {
+    var name: String?
+    var subThoroughfare: String?
+    var thoroughfare: String?
+    var subLocality: String?
+    var locality: String?
+    var subAdministrativeArea: String?
+    var administrativeArea: String?
+    var postalCode: String?
+    var country: String?
+    var inlandWater: String?
+    var ocean: String?
+}
+
+struct ReporterWeather: Decodable, Sendable {
+    /// Only present in Weather Underground records.
+    var stationID: String?
+    /// The condition. Absent from the placeholder records written after
+    /// Dark Sky shut down.
+    var weather: String?
+    var tempC: LenientNumber?
+    var feelslikeC: LenientNumber?
+    var dewpointC: LenientNumber?
+    /// `"50%"`, or occasionally a bare number.
+    var relativeHumidity: LenientNumber?
+    var pressureMb: LenientNumber?
+    var windKPH: LenientNumber?
+    var windGustKPH: LenientNumber?
+    var windDegrees: LenientNumber?
+    var visibilityKM: LenientNumber?
+    var uv: LenientNumber?
+    /// Dark Sky only, 0–1.
+    var cloudCover: LenientNumber?
+    /// Dark Sky only, 0–1.
+    var precipProbability: LenientNumber?
+    var precipTodayMetric: LenientNumber?
+}
+
+struct ReporterAudio: Decodable, Sendable {
+    var avg: LenientNumber?
+    var peak: LenientNumber?
+}
+
+struct ReporterAltitude: Decodable, Sendable {
+    var floorsAscended: LenientNumber?
+    var floorsDescended: LenientNumber?
+    /// Kilopascals.
+    var pressure: LenientNumber?
+}
+
+struct ReporterPhotoSet: Decodable, Sendable {
+    var photos: [ReporterPhoto]
+}
+
+struct ReporterPhoto: Decodable, Sendable {
+    var dateTime: String?
+    /// Unsigned; the hemisphere is in `latitudeRef`.
+    var latitude: LenientNumber?
+    var latitudeRef: String?
+    /// Unsigned; the hemisphere is in `longitudeRef`.
+    var longitude: LenientNumber?
+    var longitudeRef: String?
+    var pixelWidth: LenientNumber?
+    var pixelHeight: LenientNumber?
+    var make: String?
+    var model: String?
+}
+
+// MARK: - Lenient numbers
+
+/// A number that may appear as an int, a float or a string such as `"50%"`.
+struct LenientNumber: Decodable, Hashable, Sendable {
+    var value: Double
+
+    var int: Int? { value.isFinite ? Int(exactly: value.rounded()) : nil }
+
+    init(_ value: Double) {
+        self.value = value
+    }
+
+    init(from decoder: Decoder) throws {
+        let container = try decoder.singleValueContainer()
+        if let double = try? container.decode(Double.self) {
+            value = double
+            return
+        }
+        let string = try container.decode(String.self)
+        guard let double = Double(Self.trimmed(string)) else {
+            throw DecodingError.dataCorruptedError(
+                in: container,
+                debugDescription: "Not a number: \(string)"
+            )
+        }
+        value = double
+    }
+
+    static func trimmed(_ string: String) -> String {
+        string.trimmingCharacters(in: .whitespaces.union(CharacterSet(charactersIn: "%")))
+    }
+}
+
+/// Like `LenientNumber`, but exact. Used for numeric answers, which Reporter
+/// stores as strings.
+struct LenientDecimal: Decodable, Hashable, Sendable {
+    var value: Decimal
+
+    init(from decoder: Decoder) throws {
+        let container = try decoder.singleValueContainer()
+        if let string = try? container.decode(String.self) {
+            guard
+                let decimal = Decimal(
+                    string: LenientNumber.trimmed(string), locale: Locale(identifier: "en_US_POSIX")
+                )
+            else {
+                throw DecodingError.dataCorruptedError(
+                    in: container,
+                    debugDescription: "Not a number: \(string)"
+                )
+            }
+            value = decimal
+        } else {
+            value = try container.decode(Decimal.self)
+        }
+    }
+}

diff --git a/Reportage/Services/ReporterImport/ReporterImportPlan.swift b/Reportage/Services/ReporterImport/ReporterImportPlan.swift

@@ -0,0 +1,618 @@
+import CryptoKit
+import Foundation
+
+/// The Reportage questions and reports a Reporter archive maps to, plus a
+/// summary of how they were derived. Building a plan is pure; writing it to
+/// the store is `ReporterImporter`'s job.
+struct ReporterImportPlan: Sendable {
+    var questions: [Question]
+    /// Sorted by date.
+    var reports: [Report]
+    var summary: ReporterImportSummary
+
+    init(archive: ReporterArchive, now: Date = Date()) {
+        var builder = Builder(now: now)
+        builder.addQuestions(archive.questions)
+        for (index, snapshot) in archive.snapshots.enumerated() {
+            builder.addSnapshot(snapshot, index: index)
+        }
+        builder.resolveTimeZones()
+        builder.inferKinds()
+        builder.inferAskOn()
+        builder.inferChoiceOptions()
+        questions = builder.questions
+        reports = builder.pending.map(\.report)
+        summary = builder.summarise()
+    }
+}
+
+/// What an import found and did. Counts describe the whole archive; the
+/// `inserted`/`alreadyPresent` counts describe what the store write changed.
+struct ReporterImportSummary: Hashable, Sendable {
+    struct Fallback: Hashable, Sendable {
+        var reportID: String
+        var reason: FallbackReason
+    }
+
+    enum FallbackReason: Hashable, Sendable {
+        /// No usable placemark: missing, or a country the importer doesn't
+        /// know (`country` is non-nil then). The zone came from the nearest
+        /// report in time.
+        case timeZoneFromNeighbour(country: String?)
+        /// No report in the archive had a usable placemark; the zone is the
+        /// fixed offset of the timestamp.
+        case timeZoneFromOffset
+        /// `reportImpetus` was missing or unknown; the kind was inferred from
+        /// the questions in the report.
+        case kindInferred(impetus: Int?)
+        /// A response carried answers in more than one field. The one matching
+        /// the question's kind was kept; all of them remain in `legacy`.
+        case extraAnswerIgnored(questionID: String)
+        /// A response's prompt matched no question in the export. It was
+        /// attached to an archived question synthesised from the prompt.
+        case unmatchedPrompt(questionID: String)
+    }
+
+    struct Failure: Hashable, Sendable {
+        /// Position of the snapshot in the export.
+        var index: Int
+        var reportID: String?
+        var message: String
+    }
+
+    var questionCount = 0
+    var reportCount = 0
+    var reportsByKind: [ReportKind: Int] = [:]
+    /// Answered (not skipped) responses per question ID.
+    var answersByQuestion: [String: Int] = [:]
+    /// By year in each report's own time zone.
+    var reportsByYear: [Int: Int] = [:]
+    var reportsByTimeZone: [String: Int] = [:]
+    var fallbacks: [Fallback] = []
+    var failures: [Failure] = []
+    var warnings: [String] = []
+
+    var questionsInserted = 0
+    var questionsUpdated = 0
+    var reportsInserted = 0
+    var reportsAlreadyPresent = 0
+}
+
+// MARK: - Building
+
+private struct Builder {
+    struct Pending {
+        var report: Report
+        var index: Int
+        var impetus: Int?
+        var country: String?
+        var hasZone: Bool
+        var kindKnown: Bool
+        var questionIDs: Set<String>
+    }
+
+    let now: Date
+    var questions: [Question] = []
+    var pending: [Pending] = []
+    var fallbacks: [ReporterImportSummary.Fallback] = []
+    var failures: [ReporterImportSummary.Failure] = []
+    var warnings: [String] = []
+    private var questionIndexByPrompt: [String: Int] = [:]
+    private var questionIndexByID: [String: Int] = [:]
+    private var seenReportIDs: Set<UUID> = []
+
+    init(now: Date) {
+        self.now = now
+    }
+
+    // MARK: Questions
+
+    mutating func addQuestions(_ reporterQuestions: [ReporterQuestion]) {
+        for (order, reporterQuestion) in reporterQuestions.enumerated() {
+            let kind = Self.questionKind(reporterQuestion.questionType) ?? .note
+            if Self.questionKind(reporterQuestion.questionType) == nil {
+                warnings.append(
+                    "Question \(reporterQuestion.uniqueIdentifier) has unknown type "
+                        + "\(reporterQuestion.questionType); imported as a note"
+                )
+            }
+            let question = Question(
+                id: reporterQuestion.uniqueIdentifier,
+                prompt: reporterQuestion.prompt,
+                kind: kind,
+                placeholder: reporterQuestion.placeholderString,
+                askOn: [],
+                order: order,
+                modifiedAt: now
+            )
+            if questionIndexByPrompt[question.prompt] != nil {
+                warnings.append("Question \(question.id) repeats an earlier question's prompt")
+            } else {
+                questionIndexByPrompt[question.prompt] = questions.count
+            }
+            questionIndexByID[question.id] = questions.count
+            questions.append(question)
+        }
+    }
+
+    static func questionKind(_ questionType: Int) -> QuestionKind? {
+        switch questionType {
+        case 0: .tokens
+        case 1: .choice
+        case 2: .yesNo
+        case 3: .location
+        case 4: .people
+        case 5: .number
+        case 6: .note
+        default: nil
+        }
+    }
+
+    /// Returns the index of the question a response belongs to, synthesising
+    /// an archived question when the prompt matches none in the export.
+    private mutating func questionIndex(
+        for response: ReporterResponse, reportID: String, date: Date
+    ) -> Int {
+        if let index = questionIndexByPrompt[response.questionPrompt] {
+            return index
+        }
+        let digest = SHA256.hash(data: Data(response.questionPrompt.utf8))
+        let id = "reporter-prompt-" + digest.prefix(8).map { String(format: "%02x", $0) }.joined()
+        fallbacks.append(.init(reportID: reportID, reason: .unmatchedPrompt(questionID: id)))
+        let index = questions.count
+        questions.append(
+            Question(
+                id: id,
+                prompt: response.questionPrompt,
+                kind: Self.answers(in: response).first?.kind.questionKind ?? .note,
+                askOn: [],
+                order: index,
+                archivedAt: date,
+                modifiedAt: now
+            )
+        )
+        questionIndexByPrompt[response.questionPrompt] = index
+        questionIndexByID[id] = index
+        return index
+    }
+
+    // MARK: Snapshots
+
+    mutating func addSnapshot(_ snapshot: ReporterArchive.Snapshot, index: Int) {
+        guard let fields = snapshot.fields else {
+            fail(index, nil, snapshot.decodingError ?? "Undecodable snapshot")
+            return
+        }
+        let reportID = fields.uniqueIdentifier
+        guard let id = UUID(uuidString: reportID) else {
+            fail(index, reportID, "Identifier is not a UUID")
+            return
+        }
+        guard seenReportIDs.insert(id).inserted else {
+            fail(index, reportID, "Duplicate identifier")
+            return
+        }
+        guard let date = ReporterDates.parse(fields.date) else {
+            fail(index, reportID, "Unparseable date")
+            return
+        }
+        let legacy: Data
+        do {
+            legacy = try LegacyBlob.compress(snapshot.raw)
+        } catch {
+            fail(index, reportID, "Compression failed: \(error)")
+            return
+        }
+
+        var responses: [Response] = []
+        var questionIDs: Set<String> = []
+        for reporterResponse in fields.responses ?? [] {
+            let questionIndex = questionIndex(for: reporterResponse, reportID: reportID, date: date)
+            let question = questions[questionIndex]
+            // Synthesised questions are archived as of their last use.
+            if let archivedAt = question.archivedAt, date > archivedAt {
+                questions[questionIndex].archivedAt = date
+            }
+            let answers = Self.answers(in: reporterResponse)
+            let preferred = answers.first { $0.kind.matches(question.kind) } ?? answers.first
+            if answers.count > 1 {
+                fallbacks.append(
+                    .init(reportID: reportID, reason: .extraAnswerIgnored(questionID: question.id)))
+            }
+            responses.append(
+                Response(
+                    questionID: question.id, prompt: reporterResponse.questionPrompt,
+                    value: preferred?.value)
+            )
+            questionIDs.insert(question.id)
+        }
+
+        let impetus = fields.reportImpetus?.int
+        let kind = impetus.flatMap(Self.reportKind(impetus:))
+        let placemark = fields.location?.placemark
+        let zone = ReporterTimeZones.zone(
+            country: placemark?.country,
+            administrativeArea: placemark?.administrativeArea
+        )
+        let report = Report(
+            id: id,
+            date: date,
+            timeZone: zone ?? ReporterDates.offsetZone(fields.date),
+            kind: kind ?? .manual,
+            trigger: .imported,
+            state: .complete,
+            context: Self.context(of: fields),
+            responses: responses,
+            legacy: legacy,
+            modifiedAt: date
+        )
+        pending.append(
+            Pending(
+                report: report,
+                index: index,
+                impetus: impetus,
+                country: placemark?.country,
+                hasZone: zone != nil,
+                kindKnown: kind != nil,
+                questionIDs: questionIDs
+            )
+        )
+    }
+
+    private mutating func fail(_ index: Int, _ reportID: String?, _ message: String) {
+        failures.append(.init(index: index, reportID: reportID, message: message))
+    }
+
+    static func reportKind(impetus: Int) -> ReportKind? {
+        switch impetus {
+        case 0: .manual
+        case 2: .random
+        case 3: .bedtime
+        case 4: .wake
+        // 1 appears in a handful of reports but its meaning is unknown.
+        default: nil
+        }
+    }
+
+    // MARK: Answers
+
+    enum AnswerKind {
+        case options
+        case tokens
+        case text
+        case number
+        case place
+
+        func matches(_ kind: QuestionKind) -> Bool {
+            switch (self, kind) {
+            case (.options, .yesNo), (.options, .choice): true
+            case (.tokens, .tokens), (.tokens, .people): true
+            case (.text, .note): true
+            case (.number, .number): true
+            case (.place, .location): true
+            default: false
+            }
+        }
+
+        var questionKind: QuestionKind {
+            switch self {
+            case .options: .choice
+            case .tokens: .tokens
+            case .text: .note
+            case .number: .number
+            case .place: .location
+            }
+        }
+    }
+
+    /// Every answer field present in the response.
+    static func answers(in response: ReporterResponse) -> [(kind: AnswerKind, value: ResponseValue)]
+    {
+        var answers: [(kind: AnswerKind, value: ResponseValue)] = []
+        if let options = response.answeredOptions {
+            answers.append((.options, .options(options)))
+        }
+        if let tokens = response.tokens {
+            answers.append((.tokens, .tokens(tokens.map(\.text))))
+        }
+        if let texts = response.textResponses {
+            answers.append((.text, .text(texts.map(\.text).joined(separator: "\n"))))
+        }
+        if let number = response.numericResponse {
+            answers.append((.number, .number(number.value)))
+        }
+        if let location = response.locationResponse {
+            let place = Place(
+                name: location.text,
+                coordinate: location.location.map {
+                    Coordinate(latitude: $0.latitude.value, longitude: $0.longitude.value)
+                },
+                accuracy: location.location?.horizontalAccuracy.flatMap(Self.nonNegative),
+                externalID: location.foursquareVenueId.map {
+                    ExternalPlaceID(source: .foursquare, value: $0)
+                }
+            )
+            answers.append((.place, .place(place)))
+        }
+        return answers
+    }
+
+    // MARK: Context
+
+    static func context(of snapshot: ReporterSnapshot) -> Context {
+        var context = Context()
+        if let location = snapshot.location {
+            let placemark = location.placemark.map(Self.placemark(_:))
+            context.location = LocationContext(
+                coordinate: Coordinate(
+                    latitude: location.latitude.value, longitude: location.longitude.value),
+                // Core Location reports a negative vertical accuracy when the
+                // altitude is invalid, and negative values for unknown speed,
+                // course and horizontal accuracy.
+                altitude: location.verticalAccuracy.flatMap(nonNegative) == nil
+                    ? nil : location.altitude?.value,
+                horizontalAccuracy: location.horizontalAccuracy.flatMap(nonNegative),
+                verticalAccuracy: location.verticalAccuracy.flatMap(nonNegative),
+                speed: location.speed.flatMap(nonNegative),
+                course: location.course.flatMap(nonNegative),
+                timestamp: location.timestamp.flatMap(ReporterDates.parse),
+                placemark: placemark == Placemark() ? nil : placemark
+            )
+        }
+        context.weather = snapshot.weather.flatMap(weather(_:))
+        if let audio = snapshot.audio, audio.avg != nil || audio.peak != nil {
+            context.audio = AudioContext(
+                source: .microphone, average: audio.avg?.value, peak: audio.peak?.value)
+        }
+        if snapshot.steps != nil || snapshot.altitude != nil {
+            context.motion = MotionContext(
+                steps: snapshot.steps?.int,
+                floorsAscended: snapshot.altitude?.floorsAscended?.int,
+                floorsDescended: snapshot.altitude?.floorsDescended?.int,
+                pressure: snapshot.altitude?.pressure?.value
+            )
+        }
+        let connectivity = snapshot.connection?.int.flatMap(Self.connectivity(_:))
+        let battery = snapshot.battery.flatMap(nonNegative)
+        if battery != nil || connectivity != nil {
+            context.device = DeviceContext(batteryLevel: battery, connectivity: connectivity)
+        }
+        if let photoSet = snapshot.photoSet {
+            context.photos = PhotosContext(
+                count: photoSet.photos.count, photos: photoSet.photos.map(photo(_:)))
+        }
+        return context
+    }
+
+    static func placemark(_ placemark: ReporterPlacemark) -> Placemark {
+        Placemark(
+            name: placemark.name,
+            subThoroughfare: placemark.subThoroughfare,
+            thoroughfare: placemark.thoroughfare,
+            subLocality: placemark.subLocality,
+            locality: placemark.locality,
+            subAdministrativeArea: placemark.subAdministrativeArea,
+            administrativeArea: placemark.administrativeArea,
+            postalCode: placemark.postalCode,
+            country: placemark.country,
+            inlandWater: placemark.inlandWater,
+            ocean: placemark.ocean
+        )
+    }
+
+    /// Normalises Weather Underground and Dark Sky records. The records
+    /// written after Dark Sky shut down have no condition and placeholder
+    /// readings (0 °F rendered as −17.8 °C), so they count as no weather.
+    static func weather(_ weather: ReporterWeather) -> WeatherContext? {
+        guard let condition = weather.weather else { return nil }
+        // Weather Underground used values like -999 and -9999 for "missing".
+        func reading(_ number: LenientNumber?) -> Double? {
+            guard let value = number?.value, value > -999 else { return nil }
+            return value
+        }
+        return WeatherContext(
+            source: weather.stationID != nil ? .wunderground : .darkSky,
+            condition: condition.isEmpty ? nil : condition,
+            temperature: reading(weather.tempC),
+            feelsLike: reading(weather.feelslikeC),
+            dewPoint: reading(weather.dewpointC),
+            humidity: reading(weather.relativeHumidity).map { $0 / 100 },
+            pressure: reading(weather.pressureMb),
+            windSpeed: reading(weather.windKPH),
+            windGust: reading(weather.windGustKPH),
+            windDirection: reading(weather.windDegrees),
+            visibility: reading(weather.visibilityKM),
+            uvIndex: reading(weather.uv),
+            cloudCover: reading(weather.cloudCover),
+            precipitationChance: reading(weather.precipProbability),
+            precipitationToday: reading(weather.precipTodayMetric)
+        )
+    }
+
+    /// Reporter's `connection` values. Not documented; inferred from the
+    /// archive's distribution (mostly 1, a quarter 0, a handful of 2).
+    static func connectivity(_ connection: Int) -> DeviceContext.Connectivity? {
+        switch connection {
+        case 0: .cellular
+        case 1: .wifi
+        case 2: DeviceContext.Connectivity.none
+        default: nil
+        }
+    }
+
+    static func photo(_ photo: ReporterPhoto) -> PhotoMetadata {
+        var coordinate: Coordinate?
+        if let latitude = photo.latitude?.value, let longitude = photo.longitude?.value {
+            coordinate = Coordinate(
+                latitude: photo.latitudeRef == "S" ? -abs(latitude) : latitude,
+                longitude: photo.longitudeRef == "W" ? -abs(longitude) : longitude
+            )
+        }
+        return PhotoMetadata(
+            date: photo.dateTime.flatMap(ReporterDates.parse),
+            coordinate: coordinate,
+            pixelWidth: photo.pixelWidth?.int,
+            pixelHeight: photo.pixelHeight?.int,
+            make: photo.make,
+            model: photo.model
+        )
+    }
+
+    static func nonNegative(_ number: LenientNumber) -> Double? {
+        number.value >= 0 ? number.value : nil
+    }
+
+    // MARK: Inference
+
+    /// Gives reports without a usable placemark the zone of the nearest
+    /// report in time that has one.
+    mutating func resolveTimeZones() {
+        pending.sort { ($0.report.date, $0.index) < ($1.report.date, $1.index) }
+        let resolved = pending.indices.filter { pending[$0].hasZone }
+        var cursor = 0
+        for i in pending.indices where !pending[i].hasZone {
+            while cursor < resolved.count && resolved[cursor] < i { cursor += 1 }
+            let before = cursor > 0 ? resolved[cursor - 1] : nil
+            let after = cursor < resolved.count ? resolved[cursor] : nil
+            let date = pending[i].report.date
+            let nearest = [before, after].compactMap { $0 }.min {
+                abs(pending[$0].report.date.timeIntervalSince(date))
+                    < abs(pending[$1].report.date.timeIntervalSince(date))
+            }
+            let reportID = pending[i].report.id.uuidString
+            if let nearest {
+                pending[i].report.timeZone = pending[nearest].report.timeZone
+                fallbacks.append(
+                    .init(
+                        reportID: reportID,
+                        reason: .timeZoneFromNeighbour(country: pending[i].country)))
+            } else {
+                fallbacks.append(.init(reportID: reportID, reason: .timeZoneFromOffset))
+            }
+        }
+    }
+
+    /// Infers the kind of reports whose impetus is missing or unknown from
+    /// the questions they contain, weighted by how often each question appears
+    /// in each survey among reports whose kind is known. The random and
+    /// manual surveys are the same, so a report that looks like either is
+    /// classed as manual: nothing shows that a prompt fired.
+    mutating func inferKinds() {
+        var counts: [String: [SurveyKinds.Element: Int]] = [:]
+        for report in pending where report.kindKnown {
+            let survey = SurveyKinds(surveyFor: report.report.kind)
+            for id in report.questionIDs {
+                counts[id, default: [:]][survey, default: 0] += 1
+            }
+        }
+        let surveys: [(SurveyKinds, ReportKind)] = [
+            (.random, .manual), (.wake, .wake), (.bedtime, .bedtime),
+        ]
+        for i in pending.indices where !pending[i].kindKnown {
+            var best: (kind: ReportKind, score: Double) = (.manual, 0)
+            for (survey, kind) in surveys {
+                let score = pending[i].questionIDs.reduce(0.0) { score, id in
+                    let byKind = counts[id] ?? [:]
+                    let total = byKind.values.reduce(0, +)
+                    return total == 0 ? score : score + Double(byKind[survey] ?? 0) / Double(total)
+                }
+                if score > best.score { best = (kind, score) }
+            }
+            pending[i].report.kind = best.kind
+            fallbacks.append(
+                .init(
+                    reportID: pending[i].report.id.uuidString,
+                    reason: .kindInferred(impetus: pending[i].impetus))
+            )
+        }
+    }
+
+    /// Reporter doesn't record which survey each question belongs to. The
+    /// most recent report of each kind shows the survey as last configured
+    /// (skipped questions still appear as empty responses). Questions in none
+    /// of those surveys get every survey they were ever part of.
+    mutating func inferAskOn() {
+        var latest: [SurveyKinds.Element: Pending] = [:]
+        var everAskedOn: [String: SurveyKinds] = [:]
+        for report in pending {
+            let survey = SurveyKinds(surveyFor: report.report.kind)
+            if report.kindKnown { latest[survey] = report }
+            for id in report.questionIDs {
+                everAskedOn[id, default: []].insert(survey)
+            }
+        }
+        for i in questions.indices {
+            let id = questions[i].id
+            var askOn: SurveyKinds = []
+            for (survey, report) in latest where report.questionIDs.contains(id) {
+                askOn.insert(survey)
+            }
+            questions[i].askOn = askOn.isEmpty ? everAskedOn[id] ?? [] : askOn
+        }
+    }
+
+    /// The export doesn't include the answer list for choice questions, so it
+    /// is rebuilt from the answers given, most common first.
+    mutating func inferChoiceOptions() {
+        var counts: [String: [String: Int]] = [:]
+        for report in pending {
+            for response in report.report.responses {
+                if case .options(let options) = response.value {
+                    for option in options {
+                        counts[response.questionID, default: [:]][option, default: 0] += 1
+                    }
+                }
+            }
+        }
+        for i in questions.indices where questions[i].kind == .choice {
+            let byOption = counts[questions[i].id] ?? [:]
+            questions[i].options = byOption.keys.sorted {
+                (byOption[$0]!, $1) > (byOption[$1]!, $0)
+            }
+        }
+    }
+
+    func summarise() -> ReporterImportSummary {
+        var summary = ReporterImportSummary()
+        summary.questionCount = questions.count
+        summary.reportCount = pending.count
+        var calendar = Calendar(identifier: .gregorian)
+        for item in pending {
+            let report = item.report
+            summary.reportsByKind[report.kind, default: 0] += 1
+            summary.reportsByTimeZone[report.timeZone, default: 0] += 1
+            calendar.timeZone = TimeZone(identifier: report.timeZone) ?? .gmt
+            summary.reportsByYear[calendar.component(.year, from: report.date), default: 0] += 1
+            for response in report.responses where response.value != nil {
+                summary.answersByQuestion[response.questionID, default: 0] += 1
+            }
+        }
+        summary.fallbacks = fallbacks
+        summary.failures = failures
+        summary.warnings = warnings
+        return summary
+    }
+}
+
+// MARK: - Dates
+
+enum ReporterDates {
+    /// Reporter writes `2014-02-13T16:22:07+0900`: no fractional seconds and
+    /// no colon in the offset.
+    private static let style = Date.ISO8601FormatStyle(timeZoneSeparator: .omitted)
+
+    static func parse(_ string: String) -> Date? {
+        try? style.parse(string)
+    }
+
+    /// A fixed-offset zone identifier (such as `GMT+0900`) from the offset at
+    /// the end of a Reporter timestamp.
+    static func offsetZone(_ string: String) -> String {
+        let offset = string.suffix(5)
+        guard offset.count == 5, let sign = offset.first, sign == "+" || sign == "-",
+            let hours = Int(offset.dropFirst().prefix(2)), let minutes = Int(offset.suffix(2))
+        else { return "GMT" }
+        let seconds = (hours * 3600 + minutes * 60) * (sign == "-" ? -1 : 1)
+        return TimeZone(secondsFromGMT: seconds)?.identifier ?? "GMT"
+    }
+}

diff --git a/Reportage/Services/ReporterImport/ReporterImportVerifier.swift b/Reportage/Services/ReporterImport/ReporterImportVerifier.swift

@@ -0,0 +1,91 @@
+#if DEBUG
+    import CoreData
+    import Foundation
+
+    /// Compares a Reporter export with the store, report by report and response
+    /// by response, checking the stored values against the export's own fields
+    /// rather than against `ReporterImportPlan`, so a mapping bug can't hide
+    /// behind itself.
+    enum ReporterImportVerifier {
+        struct Mismatch: Hashable, Sendable, CustomStringConvertible {
+            var reportID: String
+            var problem: String
+
+            var description: String { "\(reportID): \(problem)" }
+        }
+
+        static func verify(
+            _ archive: ReporterArchive,
+            in context: NSManagedObjectContext
+        ) throws -> [Mismatch] {
+            let request = ReportEntity.fetchRequest()
+            request.relationshipKeyPathsForPrefetching = ["responses"]
+            var stored: [UUID: Report] = [:]
+            for entity in try context.fetch(request) {
+                let report = try entity.report()
+                stored[report.id] = report
+            }
+
+            var mismatches: [Mismatch] = []
+            for snapshot in archive.snapshots {
+                guard let fields = snapshot.fields else { continue }
+                let reportID = fields.uniqueIdentifier
+                func mismatch(_ problem: String) {
+                    mismatches.append(Mismatch(reportID: reportID, problem: problem))
+                }
+                guard let id = UUID(uuidString: reportID), let report = stored[id] else {
+                    mismatch("not in store")
+                    continue
+                }
+                if report.date != ReporterDates.parse(fields.date) {
+                    mismatch("date differs")
+                }
+                if try report.legacy.map(LegacyBlob.decompress) != snapshot.raw {
+                    mismatch("legacy bytes differ")
+                }
+                if TimeZone(identifier: report.timeZone) == nil {
+                    mismatch("invalid time zone")
+                }
+                let reporterResponses = fields.responses ?? []
+                guard report.responses.count == reporterResponses.count else {
+                    mismatch(
+                        "\(report.responses.count) responses, expected \(reporterResponses.count)")
+                    continue
+                }
+                for (index, (response, reporterResponse)) in zip(
+                    report.responses, reporterResponses
+                ).enumerated() {
+                    if response.prompt != reporterResponse.questionPrompt {
+                        mismatch("response \(index) prompt differs")
+                    }
+                    if !matches(response.value, reporterResponse) {
+                        mismatch("response \(index) value differs")
+                    }
+                }
+            }
+            return mismatches
+        }
+
+        private static func matches(_ value: ResponseValue?, _ response: ReporterResponse) -> Bool {
+            switch value {
+            case nil:
+                return response.answeredOptions == nil && response.tokens == nil
+                    && response.textResponses == nil && response.numericResponse == nil
+                    && response.locationResponse == nil
+            case .options(let options):
+                return options == response.answeredOptions
+            case .tokens(let tokens):
+                return tokens == response.tokens?.map(\.text)
+            case .text(let text):
+                return text == response.textResponses?.map(\.text).joined(separator: "\n")
+            case .number(let number):
+                return number == response.numericResponse?.value
+            case .place(let place):
+                return place.name == response.locationResponse?.text
+                    && place.externalID?.value == response.locationResponse?.foursquareVenueId
+                    && place.coordinate?.latitude
+                        == response.locationResponse?.location?.latitude.value
+            }
+        }
+    }
+#endif

diff --git a/Reportage/Services/ReporterImport/ReporterImporter.swift b/Reportage/Services/ReporterImport/ReporterImporter.swift

@@ -0,0 +1,83 @@
+import CoreData
+import Foundation
+
+/// Imports a Reporter JSON export into the store.
+///
+/// The import is idempotent: questions and reports keep their Reporter IDs,
+/// and reports already in the store are left alone, so importing a newer
+/// export adds only what's new. Existing questions keep any edits made in
+/// Reportage; only their choice options grow.
+struct ReporterImporter: Sendable {
+    static let batchSize = 500
+
+    let persistence: PersistenceController
+
+    @concurrent
+    func importArchive(at url: URL, now: Date = Date()) async throws -> ReporterImportSummary {
+        try await importArchive(Data(contentsOf: url, options: .mappedIfSafe), now: now)
+    }
+
+    @concurrent
+    func importArchive(_ data: Data, now: Date = Date()) async throws -> ReporterImportSummary {
+        let plan = ReporterImportPlan(archive: try ReporterArchive(data: data), now: now)
+        let context = persistence.newBackgroundContext()
+        return try await context.perform {
+            try Self.write(plan, into: context)
+        }
+    }
+
+    private static func write(
+        _ plan: ReporterImportPlan,
+        into context: NSManagedObjectContext
+    ) throws -> ReporterImportSummary {
+        var summary = plan.summary
+
+        let existingQuestions = try context.fetch(QuestionEntity.fetchRequest())
+        var questionsByID: [String: QuestionEntity] = [:]
+        for entity in existingQuestions {
+            if let id = entity.id { questionsByID[id] = entity }
+        }
+        for question in plan.questions {
+            if let entity = questionsByID[question.id] {
+                var current = try entity.question()
+                let added = question.options.filter { !current.options.contains($0) }
+                guard !added.isEmpty else { continue }
+                current.options += added
+                current.modifiedAt = question.modifiedAt
+                try entity.update(from: current)
+                summary.questionsUpdated += 1
+            } else {
+                try QuestionEntity(context: context).update(from: question)
+                summary.questionsInserted += 1
+            }
+        }
+        try context.save()
+        context.reset()
+
+        let idRequest = NSFetchRequest<NSDictionary>(entityName: "ReportEntity")
+        idRequest.resultType = .dictionaryResultType
+        idRequest.propertiesToFetch = ["id"]
+        let existingIDs = Set(try context.fetch(idRequest).compactMap { $0["id"] as? UUID })
+
+        var unsaved = 0
+        for report in plan.reports {
+            if existingIDs.contains(report.id) {
+                summary.reportsAlreadyPresent += 1
+                continue
+            }
+            try ReportEntity(context: context).update(from: report)
+            summary.reportsInserted += 1
+            unsaved += 1
+            if unsaved == batchSize {
+                try context.save()
+                context.reset()
+                unsaved = 0
+            }
+        }
+        if context.hasChanges {
+            try context.save()
+        }
+        context.reset()
+        return summary
+    }
+}

diff --git a/Reportage/Services/ReporterImport/ReporterTimeZones.swift b/Reportage/Services/ReporterImport/ReporterTimeZones.swift

@@ -0,0 +1,80 @@
+import Foundation
+
+/// Assigns IANA time zones to Reporter snapshots from their placemarks.
+///
+/// Reporter rendered every timestamp in +0900, so the local zone of each
+/// report was lost. The placemark's country (and, for countries spanning
+/// several zones, its administrative area) recovers it. Country names appear
+/// in whichever language the device used at the time, so both Japanese and
+/// English names are matched.
+enum ReporterTimeZones {
+    static func zone(country: String?, administrativeArea: String?) -> String? {
+        guard let country, let code = countryCodes[normalised(country)] else { return nil }
+        if let zone = singleZoneCountries[code] { return zone }
+        guard let area = administrativeArea, let zones = regionalZones[code] else { return nil }
+        return zones[normalised(area)]
+    }
+
+    private static func normalised(_ string: String) -> String {
+        string.trimmingCharacters(in: .whitespaces).lowercased()
+    }
+
+    private static let countryCodes: [String: String] = {
+        let names: [String: [String]] = [
+            "JP": ["Japan", "日本"],
+            "AU": ["Australia", "オーストラリア"],
+            "VN": ["Vietnam", "Viet Nam", "ベトナム"],
+            "HK": ["Hong Kong", "香港"],
+            "TW": ["Taiwan", "台湾"],
+            "CN": ["China", "中国", "中華人民共和国"],
+            "KR": ["South Korea", "Korea", "韓国", "大韓民国"],
+            "SG": ["Singapore", "シンガポール"],
+            "TH": ["Thailand", "タイ"],
+            "NZ": ["New Zealand", "ニュージーランド"],
+            "GB": ["United Kingdom", "イギリス", "英国"],
+        ]
+        var codes: [String: String] = [:]
+        for (code, aliases) in names {
+            for alias in aliases {
+                codes[normalised(alias)] = code
+            }
+        }
+        return codes
+    }()
+
+    private static let singleZoneCountries: [String: String] = [
+        "JP": "Asia/Tokyo",
+        "VN": "Asia/Ho_Chi_Minh",
+        "HK": "Asia/Hong_Kong",
+        "TW": "Asia/Taipei",
+        "CN": "Asia/Shanghai",
+        "KR": "Asia/Seoul",
+        "SG": "Asia/Singapore",
+        "TH": "Asia/Bangkok",
+        "NZ": "Pacific/Auckland",
+        "GB": "Europe/London",
+    ]
+
+    /// Keyed by normalised administrative area, which CoreLocation gives as
+    /// an abbreviation (`NSW`) in both languages.
+    private static let regionalZones: [String: [String: String]] = [
+        "AU": [
+            "nsw": "Australia/Sydney",
+            "new south wales": "Australia/Sydney",
+            "act": "Australia/Sydney",
+            "australian capital territory": "Australia/Sydney",
+            "vic": "Australia/Melbourne",
+            "victoria": "Australia/Melbourne",
+            "qld": "Australia/Brisbane",
+            "queensland": "Australia/Brisbane",
+            "sa": "Australia/Adelaide",
+            "south australia": "Australia/Adelaide",
+            "wa": "Australia/Perth",
+            "western australia": "Australia/Perth",
+            "tas": "Australia/Hobart",
+            "tasmania": "Australia/Hobart",
+            "nt": "Australia/Darwin",
+            "northern territory": "Australia/Darwin",
+        ]
+    ]
+}

diff --git a/Reportage/Views/ContentView.swift b/Reportage/Views/ContentView.swift

@@ -0,0 +1,12 @@
+import SwiftUI
+
+/// Placeholder until the Phase 2 survey and report list exist.
+struct ContentView: View {
+    var body: some View {
+        ContentUnavailableView("Reportage", systemImage: "list.bullet.clipboard")
+    }
+}
+
+#Preview {
+    ContentView()
+}

diff --git a/Scripts/build.sh b/Scripts/build.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+set -euo pipefail
+
+source "$(dirname "${BASH_SOURCE[0]}")/select-simulator.sh"
+select_simulator "${1:-27}"
+
+if command -v xcode-build-server &>/dev/null; then
+  xcode-build-server config -scheme "Reportage" -project "Reportage.xcodeproj"
+fi
+
+echo "Using ${DEVICE}, iOS ${RUNTIME}"
+xcodebuild build \
+  -scheme "Reportage" \
+  -destination "platform=iOS Simulator,name=${DEVICE},OS=${DESTINATION_OS}" \
+  2>&1

diff --git a/Scripts/select-simulator.sh b/Scripts/select-simulator.sh

@@ -0,0 +1,32 @@
+#!/bin/bash
+# Shared helper: resolves a usable iOS Simulator for the given major version.
+# Source this file, then call: select_simulator [major]   (default major: 27)
+# On success sets RUNTIME, DESTINATION_OS, and DEVICE; on failure prints to stderr and returns 1.
+
+select_simulator() {
+  local major="${1:-27}"
+
+  local runtime_line
+  runtime_line=$(xcrun simctl list runtimes available \
+    | grep "iOS ${major}\." \
+    | sort -t. -k1,1n -k2,2n \
+    | tail -1 || true)
+
+  RUNTIME=$(sed 's/.*iOS \([0-9.]*\).*/\1/' <<<"${runtime_line}")
+  DESTINATION_OS=$(sed 's/.*(\([0-9.]*\) -.*/\1/' <<<"${runtime_line}")
+
+  if [ -z "$RUNTIME" ] || [ -z "$DESTINATION_OS" ]; then
+    echo "No available iOS ${major}.x simulator runtime found." >&2
+    return 1
+  fi
+
+  DEVICE=$(xcrun simctl list devices available "iOS ${RUNTIME}" \
+    | grep "iPhone" \
+    | head -1 \
+    | sed 's/^ *\(.*\) ([A-F0-9-]*).*/\1/' || true)
+
+  if [ -z "$DEVICE" ]; then
+    echo "No available iPhone simulator found for iOS ${RUNTIME}." >&2
+    return 1
+  fi
+}

diff --git a/Scripts/test-unit.sh b/Scripts/test-unit.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+set -euo pipefail
+
+source "$(dirname "${BASH_SOURCE[0]}")/select-simulator.sh"
+select_simulator "${1:-27}"
+
+echo "Using ${DEVICE}, iOS ${RUNTIME}"
+xcodebuild test \
+  -scheme "Reportage" \
+  -destination "platform=iOS Simulator,name=${DEVICE},OS=${DESTINATION_OS}" \
+  -only-testing:"Reportage Unit Tests" \
+  -parallel-testing-enabled NO \
+  2>&1

diff --git a/Shared/Models/Context.swift b/Shared/Models/Context.swift

@@ -0,0 +1,142 @@
+import Foundation
+
+/// Context captured automatically with a report. Every section is optional: a
+/// provider that failed, was denied or had nothing to say leaves its section
+/// `nil`.
+///
+/// Units are metric throughout and noted on each field.
+struct Context: Codable, Hashable, Sendable {
+    var location: LocationContext?
+    var weather: WeatherContext?
+    var audio: AudioContext?
+    var motion: MotionContext?
+    var device: DeviceContext?
+    var photos: PhotosContext?
+}
+
+struct LocationContext: Codable, Hashable, Sendable {
+    var coordinate: Coordinate
+    /// Metres above sea level.
+    var altitude: Double?
+    /// Metres.
+    var horizontalAccuracy: Double?
+    /// Metres.
+    var verticalAccuracy: Double?
+    /// Metres per second.
+    var speed: Double?
+    /// Degrees clockwise from true north.
+    var course: Double?
+    /// When the fix was taken.
+    var timestamp: Date?
+    var placemark: Placemark?
+}
+
+struct Placemark: Codable, Hashable, Sendable {
+    var name: String?
+    var subThoroughfare: String?
+    var thoroughfare: String?
+    var subLocality: String?
+    var locality: String?
+    var subAdministrativeArea: String?
+    var administrativeArea: String?
+    var postalCode: String?
+    var country: String?
+    var inlandWater: String?
+    var ocean: String?
+}
+
+struct WeatherContext: Codable, Hashable, Sendable {
+    enum Source: String, Codable, Sendable {
+        case wunderground
+        case darkSky
+        case weatherKit
+    }
+
+    var source: Source
+    /// `true` when the values were fetched after the fact rather than at the
+    /// time of the report.
+    var backfilled: Bool?
+    var condition: String?
+    /// °C.
+    var temperature: Double?
+    /// °C.
+    var feelsLike: Double?
+    /// °C.
+    var dewPoint: Double?
+    /// Fraction, 0–1.
+    var humidity: Double?
+    /// Hectopascals.
+    var pressure: Double?
+    /// Kilometres per hour.
+    var windSpeed: Double?
+    /// Kilometres per hour.
+    var windGust: Double?
+    /// Degrees clockwise from north that the wind is blowing from.
+    var windDirection: Double?
+    /// Kilometres.
+    var visibility: Double?
+    var uvIndex: Double?
+    /// Fraction, 0–1.
+    var cloudCover: Double?
+    /// Fraction, 0–1.
+    var precipitationChance: Double?
+    /// Millimetres since local midnight.
+    var precipitationToday: Double?
+}
+
+struct AudioContext: Codable, Hashable, Sendable {
+    enum Source: String, Codable, Sendable {
+        case microphone
+        case healthEnvironmental
+    }
+
+    var source: Source
+    /// Decibels. Microphone values are dBFS; Health values are dBA SPL.
+    var average: Double?
+    var peak: Double?
+}
+
+struct MotionContext: Codable, Hashable, Sendable {
+    /// Steps so far today.
+    var steps: Int?
+    var floorsAscended: Int?
+    var floorsDescended: Int?
+    /// Barometric pressure, kilopascals.
+    var pressure: Double?
+    /// Metres.
+    var relativeAltitude: Double?
+}
+
+struct DeviceContext: Codable, Hashable, Sendable {
+    enum BatteryState: String, Codable, Sendable {
+        case unplugged
+        case charging
+        case full
+    }
+
+    enum Connectivity: String, Codable, Sendable {
+        case wifi
+        case cellular
+        case none
+    }
+
+    /// Fraction, 0–1.
+    var batteryLevel: Double?
+    var batteryState: BatteryState?
+    var connectivity: Connectivity?
+}
+
+struct PhotosContext: Codable, Hashable, Sendable {
+    /// Photos taken since the previous report.
+    var count: Int
+    var photos: [PhotoMetadata] = []
+}
+
+struct PhotoMetadata: Codable, Hashable, Sendable {
+    var date: Date?
+    var coordinate: Coordinate?
+    var pixelWidth: Int?
+    var pixelHeight: Int?
+    var make: String?
+    var model: String?
+}

diff --git a/Shared/Models/Question.swift b/Shared/Models/Question.swift

@@ -0,0 +1,55 @@
+import Foundation
+
+/// A survey question. Questions are archived rather than deleted so that the
+/// responses recorded against them keep their meaning.
+struct Question: Hashable, Sendable {
+    /// Imported questions keep Reporter's `uniqueIdentifier` (for example
+    /// `default-question-2`); new questions use UUID strings.
+    var id: String
+    var prompt: String
+    var kind: QuestionKind
+    /// The fixed answer list for `choice` questions. Empty for other kinds.
+    var options: [String] = []
+    var placeholder: String?
+    /// The surveys the question appears in.
+    var askOn: SurveyKinds
+    /// Sort order within a survey.
+    var order: Int
+    var archivedAt: Date?
+    var modifiedAt: Date
+}
+
+enum QuestionKind: String, Codable, Sendable, CaseIterable {
+    case yesNo
+    case choice
+    case tokens
+    case people
+    case location
+    case number
+    case note
+}
+
+/// The set of surveys a question is asked in. Manual reports use the random
+/// survey, so there is no separate member for them.
+struct SurveyKinds: OptionSet, Hashable, Sendable {
+    let rawValue: Int16
+
+    static let random = SurveyKinds(rawValue: 1 << 0)
+    static let wake = SurveyKinds(rawValue: 1 << 1)
+    static let bedtime = SurveyKinds(rawValue: 1 << 2)
+
+    static let all: SurveyKinds = [.random, .wake, .bedtime]
+
+    /// The survey a report of the given kind presents.
+    init(surveyFor kind: ReportKind) {
+        switch kind {
+        case .random, .manual: self = .random
+        case .wake: self = .wake
+        case .bedtime: self = .bedtime
+        }
+    }
+
+    init(rawValue: Int16) {
+        self.rawValue = rawValue
+    }
+}

diff --git a/Shared/Models/Report.swift b/Shared/Models/Report.swift

@@ -0,0 +1,48 @@
+import Foundation
+
+/// One report: a moment in time, the answers given about it and the context
+/// captured with it.
+struct Report: Hashable, Sendable {
+    /// Imported reports keep Reporter's `uniqueIdentifier`, which makes
+    /// re-importing idempotent.
+    var id: UUID
+    /// The moment being described: when the prompt fired or the passive log
+    /// was tapped, not when the survey was finished.
+    var date: Date
+    /// IANA identifier of the zone the report was made in.
+    var timeZone: String
+    var kind: ReportKind
+    var trigger: ReportTrigger
+    var state: ReportState
+    var promptedAt: Date?
+    var completedAt: Date?
+    var context = Context()
+    var responses: [Response] = []
+    /// For imported reports: the original Reporter snapshot JSON, compressed
+    /// with `LegacyBlob`.
+    var legacy: Data?
+    var modifiedAt: Date
+}
+
+enum ReportKind: String, Codable, Sendable, CaseIterable {
+    case random
+    case wake
+    case bedtime
+    case manual
+}
+
+enum ReportTrigger: String, Codable, Sendable, CaseIterable {
+    case notification
+    case app
+    case watch
+    /// Shortcuts, Control Center, the Action button and other App Intent
+    /// surfaces.
+    case intent
+    case imported
+}
+
+enum ReportState: String, Codable, Sendable, CaseIterable {
+    /// Logged, awaiting answers.
+    case passive
+    case complete
+}

diff --git a/Shared/Models/Response.swift b/Shared/Models/Response.swift

@@ -0,0 +1,87 @@
+import Foundation
+
+/// The answer to one question in a report.
+struct Response: Codable, Hashable, Sendable {
+    var questionID: String
+    /// The prompt as worded when the question was answered.
+    var prompt: String
+    /// `nil` when the question was shown but skipped.
+    var value: ResponseValue?
+}
+
+/// An answer, tagged by shape. Encodes as a single-key object, for example
+/// `{"tokens": ["coffee", "work"]}`.
+enum ResponseValue: Hashable, Sendable {
+    case options([String])
+    case tokens([String])
+    case number(Decimal)
+    case text(String)
+    case place(Place)
+}
+
+extension ResponseValue: Codable {
+    private enum CodingKeys: String, CodingKey {
+        case options
+        case tokens
+        case number
+        case text
+        case place
+    }
+
+    init(from decoder: Decoder) throws {
+        let container = try decoder.container(keyedBy: CodingKeys.self)
+        guard container.allKeys.count == 1, let key = container.allKeys.first else {
+            throw DecodingError.dataCorrupted(
+                DecodingError.Context(
+                    codingPath: container.codingPath,
+                    debugDescription: "Expected exactly one response value key"
+                )
+            )
+        }
+        switch key {
+        case .options: self = .options(try container.decode([String].self, forKey: key))
+        case .tokens: self = .tokens(try container.decode([String].self, forKey: key))
+        case .number: self = .number(try container.decode(Decimal.self, forKey: key))
+        case .text: self = .text(try container.decode(String.self, forKey: key))
+        case .place: self = .place(try container.decode(Place.self, forKey: key))
+        }
+    }
+
+    func encode(to encoder: Encoder) throws {
+        var container = encoder.container(keyedBy: CodingKeys.self)
+        switch self {
+        case .options(let options): try container.encode(options, forKey: .options)
+        case .tokens(let tokens): try container.encode(tokens, forKey: .tokens)
+        case .number(let number): try container.encode(number, forKey: .number)
+        case .text(let text): try container.encode(text, forKey: .text)
+        case .place(let place): try container.encode(place, forKey: .place)
+        }
+    }
+}
+
+/// A named place given as an answer to a location question.
+struct Place: Codable, Hashable, Sendable {
+    var name: String
+    var coordinate: Coordinate?
+    /// Horizontal accuracy of `coordinate`, in metres.
+    var accuracy: Double?
+    var externalID: ExternalPlaceID?
+}
+
+/// An identifier for a place in an external directory.
+struct ExternalPlaceID: Codable, Hashable, Sendable {
+    enum Source: String, Codable, Sendable {
+        /// Foursquare venue IDs, from Reporter.
+        case foursquare
+        /// `MKMapItem.Identifier` raw values.
+        case mapKit
+    }
+
+    var source: Source
+    var value: String
+}
+
+struct Coordinate: Codable, Hashable, Sendable {
+    var latitude: Double
+    var longitude: Double
+}

diff --git a/Shared/Persistence/EntityMapping.swift b/Shared/Persistence/EntityMapping.swift

@@ -0,0 +1,143 @@
+import CoreData
+import Foundation
+
+/// Conversions between the value types in `Models/` and their Core Data
+/// entities. Encoded fields (`options`, `context`, `value`) are JSON.
+enum ModelCoding {
+    static func encode<T: Encodable>(_ value: T) throws -> Data {
+        let encoder = JSONEncoder()
+        encoder.outputFormatting = .sortedKeys
+        return try encoder.encode(value)
+    }
+
+    static func decode<T: Decodable>(_ type: T.Type, from data: Data) throws -> T {
+        try JSONDecoder().decode(type, from: data)
+    }
+}
+
+enum EntityMappingError: Error, Equatable {
+    case missingField(entity: String, field: String)
+    case unknownValue(entity: String, field: String, value: String)
+}
+
+extension QuestionEntity {
+    func update(from question: Question) throws {
+        id = question.id
+        prompt = question.prompt
+        kind = question.kind.rawValue
+        options = question.options.isEmpty ? nil : try ModelCoding.encode(question.options)
+        placeholder = question.placeholder
+        askOn = question.askOn.rawValue
+        order = Int32(question.order)
+        archivedAt = question.archivedAt
+        modifiedAt = question.modifiedAt
+    }
+
+    func question() throws -> Question {
+        guard let id, let prompt, let modifiedAt else {
+            throw EntityMappingError.missingField(entity: "Question", field: "id/prompt/modifiedAt")
+        }
+        guard let kind = kind.flatMap(QuestionKind.init(rawValue:)) else {
+            throw EntityMappingError.unknownValue(
+                entity: "Question", field: "kind", value: self.kind ?? "nil")
+        }
+        return Question(
+            id: id,
+            prompt: prompt,
+            kind: kind,
+            options: try options.map { try ModelCoding.decode([String].self, from: $0) } ?? [],
+            placeholder: placeholder,
+            askOn: SurveyKinds(rawValue: askOn),
+            order: Int(order),
+            archivedAt: archivedAt,
+            modifiedAt: modifiedAt
+        )
+    }
+}
+
+extension ReportEntity {
+    /// Copies `report` into the entity, replacing any existing responses.
+    func update(from report: Report) throws {
+        guard let context = managedObjectContext else {
+            preconditionFailure("ReportEntity must be inserted before updating")
+        }
+        id = report.id
+        date = report.date
+        timeZone = report.timeZone
+        kind = report.kind.rawValue
+        trigger = report.trigger.rawValue
+        state = report.state.rawValue
+        promptedAt = report.promptedAt
+        completedAt = report.completedAt
+        self.context = try ModelCoding.encode(report.context)
+        legacy = report.legacy
+        modifiedAt = report.modifiedAt
+
+        for case let existing as ResponseEntity in responses ?? [] {
+            context.delete(existing)
+        }
+        for (index, response) in report.responses.enumerated() {
+            let entity = ResponseEntity(context: context)
+            entity.order = Int16(index)
+            entity.questionID = response.questionID
+            entity.prompt = response.prompt
+            entity.value = try response.value.map { try ModelCoding.encode($0) }
+            entity.report = self
+        }
+    }
+
+    func report() throws -> Report {
+        guard let id, let date, let timeZone, let modifiedAt else {
+            throw EntityMappingError.missingField(
+                entity: "Report",
+                field: "id/date/timeZone/modifiedAt"
+            )
+        }
+        guard let kind = kind.flatMap(ReportKind.init(rawValue:)) else {
+            throw EntityMappingError.unknownValue(
+                entity: "Report", field: "kind", value: self.kind ?? "nil")
+        }
+        guard let trigger = trigger.flatMap(ReportTrigger.init(rawValue:)) else {
+            throw EntityMappingError.unknownValue(
+                entity: "Report",
+                field: "trigger",
+                value: self.trigger ?? "nil"
+            )
+        }
+        guard let state = state.flatMap(ReportState.init(rawValue:)) else {
+            throw EntityMappingError.unknownValue(
+                entity: "Report", field: "state", value: self.state ?? "nil")
+        }
+        let responseEntities = (responses as? Set<ResponseEntity> ?? []).sorted {
+            $0.order < $1.order
+        }
+        return Report(
+            id: id,
+            date: date,
+            timeZone: timeZone,
+            kind: kind,
+            trigger: trigger,
+            state: state,
+            promptedAt: promptedAt,
+            completedAt: completedAt,
+            context: try self.context.map { try ModelCoding.decode(Context.self, from: $0) }
+                ?? Context(),
+            responses: try responseEntities.map { try $0.response() },
+            legacy: legacy,
+            modifiedAt: modifiedAt
+        )
+    }
+}
+
+extension ResponseEntity {
+    func response() throws -> Response {
+        guard let questionID, let prompt else {
+            throw EntityMappingError.missingField(entity: "Response", field: "questionID/prompt")
+        }
+        return Response(
+            questionID: questionID,
+            prompt: prompt,
+            value: try value.map { try ModelCoding.decode(ResponseValue.self, from: $0) }
+        )
+    }
+}

diff --git a/Shared/Persistence/LegacyBlob.swift b/Shared/Persistence/LegacyBlob.swift

@@ -0,0 +1,13 @@
+import Foundation
+
+/// Compression for `Report.legacy`, which holds the original Reporter snapshot
+/// JSON byte for byte.
+enum LegacyBlob {
+    static func compress(_ data: Data) throws -> Data {
+        try (data as NSData).compressed(using: .zlib) as Data
+    }
+
+    static func decompress(_ data: Data) throws -> Data {
+        try (data as NSData).decompressed(using: .zlib) as Data
+    }
+}

diff --git a/Shared/Persistence/PersistenceController.swift b/Shared/Persistence/PersistenceController.swift

@@ -0,0 +1,64 @@
+import CoreData
+import Foundation
+
+/// Wraps the app's `NSPersistentContainer`. Plain Core Data with no CloudKit
+/// mirroring: sync is the job of a separate `CKSyncEngine` layer that drives
+/// CloudKit directly on top of this store.
+///
+/// `@unchecked Sendable` because the only stored property is the container,
+/// whose `viewContext` is main-queue confined and whose
+/// `newBackgroundContext()` is safe to call from any thread.
+final class PersistenceController: @unchecked Sendable {
+    let container: NSPersistentContainer
+
+    var viewContext: NSManagedObjectContext { container.viewContext }
+
+    init(inMemory: Bool = false, storeURL: URL? = nil) {
+        container = NSPersistentContainer(
+            name: "ReportageModel", managedObjectModel: Self.sharedModel)
+
+        if inMemory {
+            // NSInMemoryStoreType keeps each store isolated in process memory,
+            // so tests can't collide through shared SQLite files.
+            let description = NSPersistentStoreDescription()
+            description.type = NSInMemoryStoreType
+            container.persistentStoreDescriptions = [description]
+        } else if let storeURL {
+            container.persistentStoreDescriptions = [NSPersistentStoreDescription(url: storeURL)]
+        }
+        for description in container.persistentStoreDescriptions {
+            description.shouldMigrateStoreAutomatically = true
+            description.shouldInferMappingModelAutomatically = true
+        }
+
+        container.loadPersistentStores { _, error in
+            if let error {
+                fatalError("Failed to load Core Data store: \(error)")
+            }
+        }
+
+        container.viewContext.automaticallyMergesChangesFromParent = true
+        container.viewContext.mergePolicy = NSMergePolicy.mergeByPropertyObjectTrump
+    }
+
+    func newBackgroundContext() -> NSManagedObjectContext {
+        let context = container.newBackgroundContext()
+        context.mergePolicy = NSMergePolicy.mergeByPropertyObjectTrump
+        return context
+    }
+
+    /// Loaded once per process. Each `NSManagedObjectModel` instance registers
+    /// its entity classes, so loading the model per container (as tests do)
+    /// would make several descriptions claim the same class. A model is
+    /// immutable once a coordinator uses it, so sharing it is safe.
+    nonisolated(unsafe) private static let sharedModel: NSManagedObjectModel = {
+        for bundle in Bundle.allBundles + Bundle.allFrameworks {
+            if let url = bundle.url(forResource: "ReportageModel", withExtension: "momd"),
+                let model = NSManagedObjectModel(contentsOf: url)
+            {
+                return model
+            }
+        }
+        fatalError("ReportageModel.momd not found in any loaded bundle")
+    }()
+}

diff --git a/Shared/Persistence/ReportageModel.xcdatamodeld/ReportageModel.xcdatamodel/contents b/Shared/Persistence/ReportageModel.xcdatamodeld/ReportageModel.xcdatamodel/contents

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23000" systemVersion="25A0" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithSwiftData="NO" userDefinedModelVersionIdentifier="">
+    <entity name="QuestionEntity" representedClassName="QuestionEntity" syncable="YES" codeGenerationType="class">
+        <attribute name="archivedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="askOn" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="id" attributeType="String"/>
+        <attribute name="kind" attributeType="String"/>
+        <attribute name="modifiedAt" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="options" optional="YES" attributeType="Binary"/>
+        <attribute name="order" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="placeholder" optional="YES" attributeType="String"/>
+        <attribute name="prompt" attributeType="String"/>
+        <uniquenessConstraints>
+            <uniquenessConstraint>
+                <constraint value="id"/>
+            </uniquenessConstraint>
+        </uniquenessConstraints>
+    </entity>
+    <entity name="ReportEntity" representedClassName="ReportEntity" syncable="YES" codeGenerationType="class">
+        <attribute name="completedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="context" optional="YES" attributeType="Binary"/>
+        <attribute name="date" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="id" attributeType="UUID" usesScalarValueType="NO"/>
+        <attribute name="kind" attributeType="String"/>
+        <attribute name="legacy" optional="YES" attributeType="Binary"/>
+        <attribute name="modifiedAt" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="promptedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="state" attributeType="String"/>
+        <attribute name="timeZone" attributeType="String"/>
+        <attribute name="trigger" attributeType="String"/>
+        <relationship name="responses" toMany="YES" deletionRule="Cascade" destinationEntity="ResponseEntity" inverseName="report" inverseEntity="ResponseEntity"/>
+        <uniquenessConstraints>
+            <uniquenessConstraint>
+                <constraint value="id"/>
+            </uniquenessConstraint>
+        </uniquenessConstraints>
+        <fetchIndex name="byDate">
+            <fetchIndexElement property="date" type="Binary" order="ascending"/>
+        </fetchIndex>
+        <fetchIndex name="byState">
+            <fetchIndexElement property="state" type="Binary" order="ascending"/>
+        </fetchIndex>
+    </entity>
+    <entity name="ResponseEntity" representedClassName="ResponseEntity" syncable="YES" codeGenerationType="class">
+        <attribute name="order" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="prompt" attributeType="String"/>
+        <attribute name="questionID" attributeType="String"/>
+        <attribute name="value" optional="YES" attributeType="Binary"/>
+        <relationship name="report" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="ReportEntity" inverseName="responses" inverseEntity="ReportEntity"/>
+        <fetchIndex name="byQuestionID">
+            <fetchIndexElement property="questionID" type="Binary" order="ascending"/>
+        </fetchIndex>
+    </entity>
+</model>

diff --git a/Tests/Support/TestHelpers.swift b/Tests/Support/TestHelpers.swift

@@ -0,0 +1,50 @@
+import Foundation
+import Testing
+
+@testable import Reportage
+
+/// Creates a fresh PersistenceController with in-memory storage for isolated testing.
+func makeTestPersistence() -> PersistenceController {
+    PersistenceController(inMemory: true)
+}
+
+enum Fixtures {
+    /// A hand-made Reporter export with invented data that mirrors the real
+    /// export's quirks: the junk prefix, +0900 timestamps for reports made
+    /// elsewhere, three weather eras, mixed number types, missing and unknown
+    /// `reportImpetus` values, skipped questions and so on.
+    static func reporterExport() throws -> Data {
+        let url = try #require(
+            Bundle(for: BundleToken.self).url(
+                forResource: "reporter-fixture", withExtension: "json")
+        )
+        return try Data(contentsOf: url)
+    }
+
+    static func reporterArchive() throws -> ReporterArchive {
+        try ReporterArchive(data: reporterExport())
+    }
+
+    /// Report IDs in the fixture, by the order they were made.
+    static func reportID(_ number: Int) -> UUID {
+        let hex = String(number, radix: 16, uppercase: true)
+        let short = String(repeating: "0", count: 4 - hex.count) + hex
+        let long = String(repeating: "0", count: 12 - hex.count) + hex
+        return UUID(uuidString: "0A1B2C3D-\(short)-4000-8000-\(long)")!
+    }
+
+    /// The fixture with its last `count` snapshots removed, as an older export
+    /// would be. The remaining bytes are untouched, so legacy blobs still
+    /// match the full fixture's.
+    static func reporterExport(droppingLast count: Int) throws -> Data {
+        let data = try reporterExport()
+        let start = try #require(data.firstIndex(of: UInt8(ascii: "{")))
+        let members = try JSONSlicer.objectMembers(in: data, at: start)
+        let array = try #require(members.first { $0.key == "snapshots" }).range
+        let elements = try JSONSlicer.arrayElements(in: data, range: array)
+        let keptEnd = elements[elements.count - count - 1].upperBound
+        return data[..<keptEnd] + Data("]".utf8) + data[array.upperBound...]
+    }
+}
+
+private final class BundleToken {}

diff --git a/Tests/Support/reporter-fixture.json b/Tests/Support/reporter-fixture.json

@@ -0,0 +1,97 @@
+￿{"snapshots":[
+{"battery":1,"connection":1,"steps":2048,"background":0,"draft":0,"sectionIdentifier":"1-2015-3-1","reportImpetus":2,"uniqueIdentifier":"0A1B2C3D-0001-4000-8000-000000000001","date":"2015-03-01T09:15:00+0900",
+ "audio":{"avg":-42,"peak":-20.5,"uniqueIdentifier":"A0000001-0000-4000-8000-000000000000"},
+ "altitude":{"floorsAscended":3,"floorsDescended":1,"gpsRawAltitude":41.2,"uniqueIdentifier":"A0000002-0000-4000-8000-000000000000"},
+ "location":{"latitude":35.6581,"longitude":139.7017,"altitude":38,"horizontalAccuracy":65,"verticalAccuracy":10.5,"speed":-1,"course":-1,"timestamp":"2015-03-01T09:14:51+0900","uniqueIdentifier":"A0000003-0000-4000-8000-000000000000",
+  "placemark":{"name":"1-2-3 Example","country":"日本","administrativeArea":"東京都","locality":"渋谷区","subLocality":"例町","thoroughfare":"例通り","subThoroughfare":"1","postalCode":"150-0000","region":"<+35.65810000,+139.70170000> radius 70.00","uniqueIdentifier":"A0000004-0000-4000-8000-000000000000"}},
+ "weather":{"stationID":"IEXAMPLE1","weather":"Partly Cloudy","tempC":12,"tempF":53.6,"feelslikeC":"11","feelslikeF":"52","dewpointC":4,"relativeHumidity":"62%","pressureMb":"1016","pressureIn":"30.00","windKPH":9.7,"windMPH":6,"windGustKPH":0,"windGustMPH":0,"windDegrees":270,"windDirection":"West","visibilityKM":"10.0","visibilityMi":"6.2","uv":"2","precipTodayIn":-999,"precipTodayMetric":0,"latitude":35.66,"longitude":139.7,"uniqueIdentifier":"A0000005-0000-4000-8000-000000000000"},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["Yes"],"uniqueIdentifier":"B0000001-0000-4000-8000-000000000000"},
+  {"questionPrompt":"What are you doing?","tokens":[{"text":"Walking","uniqueIdentifier":"C0000001-0000-4000-8000-000000000000"},{"text":"Podcast","uniqueIdentifier":"C0000002-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B0000002-0000-4000-8000-000000000000"},
+  {"questionPrompt":"Where are you?","locationResponse":{"text":"Corner Café","foursquareVenueId":"4b0000000000000000000001","uniqueIdentifier":"C0000003-0000-4000-8000-000000000000","location":{"latitude":35.6582,"longitude":139.7016,"altitude":37,"horizontalAccuracy":30,"verticalAccuracy":8,"speed":0,"course":-1,"timestamp":"2015-03-01T09:14:58+0900","uniqueIdentifier":"C0000004-0000-4000-8000-000000000000"}},"uniqueIdentifier":"B0000003-0000-4000-8000-000000000000"},
+  {"questionPrompt":"Who are you with?","tokens":[{"text":"Alex","uniqueIdentifier":"C0000005-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B0000004-0000-4000-8000-000000000000"}]},
+{"battery":0.5,"connection":0,"steps":9000,"background":0,"draft":0,"sectionIdentifier":"1-2015-3-2","reportImpetus":4,"uniqueIdentifier":"0A1B2C3D-0003-4000-8000-000000000003","date":"2015-03-02T07:05:00+0900",
+ "location":{"latitude":35.7,"longitude":139.6,"horizontalAccuracy":10,"verticalAccuracy":-1,"speed":-1,"course":-1,"timestamp":"2015-03-02T07:04:00+0900","uniqueIdentifier":"A0000006-0000-4000-8000-000000000000","placemark":{"name":"Home","country":"Japan","administrativeArea":"Tokyo","uniqueIdentifier":"A0000007-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"How did you sleep?","answeredOptions":["Well"],"uniqueIdentifier":"B0000005-0000-4000-8000-000000000000"},
+  {"questionPrompt":"How many hours did you sleep?","numericResponse":"6.5","uniqueIdentifier":"B0000006-0000-4000-8000-000000000000"}]},
+{"battery":0.73,"connection":1,"steps":12000,"background":0,"draft":0,"sectionIdentifier":"1-2015-3-1","reportImpetus":3,"uniqueIdentifier":"0A1B2C3D-0002-4000-8000-000000000002","date":"2015-03-01T23:30:00+0900",
+ "location":{"latitude":35.7,"longitude":139.6,"altitude":40.5,"horizontalAccuracy":10,"verticalAccuracy":4,"speed":-1,"course":-1,"timestamp":"2015-03-01T23:29:00+0900","uniqueIdentifier":"A0000008-0000-4000-8000-000000000000","placemark":{"name":"Home","country":"Japan","administrativeArea":"Tokyo","uniqueIdentifier":"A0000009-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"Anything to note?","textResponses":[{"text":"Long day.","uniqueIdentifier":"C0000006-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B0000007-0000-4000-8000-000000000000"},
+  {"questionPrompt":"How many hours did you sleep?","numericResponse":"7","uniqueIdentifier":"B0000008-0000-4000-8000-000000000000"}]},
+{"battery":0.31,"connection":1,"steps":500,"background":0,"draft":0,"sectionIdentifier":"1-2019-12-31","reportImpetus":0,"uniqueIdentifier":"0A1B2C3D-0004-4000-8000-000000000004","date":"2019-12-31T23:30:00+0900",
+ "altitude":{"floorsAscended":0,"floorsDescended":2,"pressure":101.2,"adjustedPressure":0.01,"gpsRawAltitude":12,"uniqueIdentifier":"A000000A-0000-4000-8000-000000000000"},
+ "location":{"latitude":-33.8688,"longitude":151.2093,"altitude":5,"horizontalAccuracy":5,"verticalAccuracy":3,"speed":1.2,"course":-1,"timestamp":"2019-12-31T23:29:30+0900","uniqueIdentifier":"A000000B-0000-4000-8000-000000000000","placemark":{"name":"Example Wharf","country":"オーストラリア","administrativeArea":"NSW","locality":"Sydney","region":"<-33.86880000,+151.20930000> radius 50.00","uniqueIdentifier":"A000000C-0000-4000-8000-000000000000"}},
+ "weather":{"weather":"Clear","tempC":24.4,"tempF":76,"feelslikeC":24.4,"feelslikeF":76,"dewpointC":17,"dewpointF":62.6,"heatIndexC":0,"heatIndexF":0,"relativeHumidity":"55","pressureMb":1012.3,"pressureIn":29.89,"windKPH":14,"windMPH":8.7,"windGustKPH":22.5,"windGustMPH":14,"windDegrees":45,"visibilityKM":16.1,"visibilityMi":10,"uv":0,"cloudCover":0.12,"ozone":290.1,"precipIntensity":0,"precipProbability":0.05,"precipTodayIn":0,"precipTodayMetric":0,"nearestStormDistanceKM":0,"latitude":-33.87,"longitude":151.21,"uniqueIdentifier":"A000000D-0000-4000-8000-000000000000"},
+ "photoSet":{"uniqueIdentifier":"A000000E-0000-4000-8000-000000000000","photos":[
+  {"assetUrl":"assets-library://asset/asset.HEIC?id=00000000-0000-4000-8000-0000000000AA&ext=HEIC","dateTime":"2019-12-31T21:02:11+0900","latitude":33.8688,"latitudeRef":"S","longitude":151.2093,"longitudeRef":"E","altitude":4.5,"pixelWidth":4032,"pixelHeight":3024,"make":"Apple","model":"iPhone X","software":"13.3","fNumber":1.8,"isoSpeed":25,"depth":8,"orientation":1,"uniqueIdentifier":"A000000F-0000-4000-8000-000000000000"},
+  {"assetUrl":"assets-library://asset/asset.JPG?id=00000000-0000-4000-8000-0000000000BB&ext=JPG","dateTime":"2019-12-31T22:45:00+0900","pixelWidth":1080,"pixelHeight":1920,"depth":8,"uniqueIdentifier":"A0000010-0000-4000-8000-000000000000"}]},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["No"],"uniqueIdentifier":"B0000009-0000-4000-8000-000000000000"},
+  {"questionPrompt":"What are you doing?","tokens":[{"text":"Fireworks","uniqueIdentifier":"C0000007-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B000000A-0000-4000-8000-000000000000"},
+  {"questionPrompt":"Where are you?","uniqueIdentifier":"B000000B-0000-4000-8000-000000000000"},
+  {"questionPrompt":"Who are you with?","tokens":[{"text":"Alex","uniqueIdentifier":"C0000008-0000-4000-8000-000000000000"},{"text":"Sam","uniqueIdentifier":"C0000009-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B000000C-0000-4000-8000-000000000000"}]},
+{"battery":0.29,"connection":2,"steps":800,"background":1,"draft":0,"sectionIdentifier":"1-2020-1-1","reportImpetus":2,"uniqueIdentifier":"0A1B2C3D-0005-4000-8000-000000000005","date":"2020-01-01T03:00:00+0900",
+ "location":{"latitude":-33.87,"longitude":151.2,"horizontalAccuracy":1414,"verticalAccuracy":-1,"speed":-1,"course":-1,"timestamp":"2020-01-01T02:58:00+0900","uniqueIdentifier":"A0000011-0000-4000-8000-000000000000","placemark":{"uniqueIdentifier":"A0000012-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["Yes"],"uniqueIdentifier":"B000000D-0000-4000-8000-000000000000"},
+  {"questionPrompt":"What are you doing?","tokens":[{"text":"Walking","uniqueIdentifier":"C000000A-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B000000E-0000-4000-8000-000000000000"}]},
+{"battery":0.9,"connection":1,"steps":3000,"background":0,"draft":0,"sectionIdentifier":"1-2020-1-5","reportImpetus":2,"uniqueIdentifier":"0A1B2C3D-0006-4000-8000-000000000006","date":"2020-01-05T10:00:00+0900",
+ "location":{"latitude":10.7769,"longitude":106.7009,"altitude":9,"horizontalAccuracy":20,"verticalAccuracy":6,"speed":0.5,"course":180,"timestamp":"2020-01-05T09:59:00+0900","uniqueIdentifier":"A0000013-0000-4000-8000-000000000000","placemark":{"name":"Example Street","country":"ベトナム","administrativeArea":"Thành Phố Hồ Chí Minh","uniqueIdentifier":"A0000014-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["Yes"],"uniqueIdentifier":"B000000F-0000-4000-8000-000000000000"},
+  {"questionPrompt":"What are you doing?","tokens":[{"text":"Eating","uniqueIdentifier":"C000000B-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B0000010-0000-4000-8000-000000000000"}]},
+{"battery":0.8,"connection":1,"steps":4000,"background":0,"draft":0,"sectionIdentifier":"1-2020-1-6","reportImpetus":2,"uniqueIdentifier":"0A1B2C3D-0007-4000-8000-000000000007","date":"2020-01-06T10:00:00+0900",
+ "location":{"latitude":22.2793,"longitude":114.1628,"altitude":15,"horizontalAccuracy":10,"verticalAccuracy":5,"speed":-1,"course":-1,"timestamp":"2020-01-06T09:59:00+0900","uniqueIdentifier":"A0000015-0000-4000-8000-000000000000","placemark":{"name":"Example Road","country":"香港","administrativeArea":"香港","uniqueIdentifier":"A0000016-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["No"],"tokens":[{"text":"Stray","uniqueIdentifier":"C000000C-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B0000011-0000-4000-8000-000000000000"}]},
+{"battery":0.7,"connection":1,"steps":5000,"background":0,"draft":0,"sectionIdentifier":"1-2020-1-7","uniqueIdentifier":"0A1B2C3D-0008-4000-8000-000000000008","date":"2020-01-07T12:00:00+0900",
+ "location":{"latitude":48.8584,"longitude":2.2945,"altitude":35,"horizontalAccuracy":12,"verticalAccuracy":-1,"speed":-2.5,"course":-1,"timestamp":"2020-01-07T11:59:00+0900","uniqueIdentifier":"A0000017-0000-4000-8000-000000000000","placemark":{"name":"Example Avenue","country":"France","administrativeArea":"Île-de-France","uniqueIdentifier":"A0000018-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["Yes"],"uniqueIdentifier":"B0000012-0000-4000-8000-000000000000"},
+  {"questionPrompt":"What are you doing?","tokens":[{"text":"Sightseeing","uniqueIdentifier":"C000000D-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B0000013-0000-4000-8000-000000000000"},
+  {"questionPrompt":"Where are you?","uniqueIdentifier":"B0000014-0000-4000-8000-000000000000"}]},
+{"battery":0.6,"connection":0,"steps":0,"background":0,"draft":0,"sectionIdentifier":"1-2020-1-8","reportImpetus":1,"uniqueIdentifier":"0A1B2C3D-0009-4000-8000-000000000009","date":"2020-01-08T08:00:00+0900",
+ "responses":[
+  {"questionPrompt":"How did you sleep?","answeredOptions":["Poorly"],"uniqueIdentifier":"B0000015-0000-4000-8000-000000000000"},
+  {"questionPrompt":"How many hours did you sleep?","numericResponse":"5","uniqueIdentifier":"B0000016-0000-4000-8000-000000000000"}]},
+{"battery":0.55,"connection":1,"steps":6000,"background":0,"draft":0,"sectionIdentifier":"1-2023-5-1","reportImpetus":2,"uniqueIdentifier":"0A1B2C3D-000A-4000-8000-00000000000A","date":"2023-05-01T12:00:00+0900",
+ "location":{"latitude":25.033,"longitude":121.5654,"altitude":20,"horizontalAccuracy":15,"verticalAccuracy":4,"speed":-1,"course":-1,"timestamp":"2023-05-01T11:59:00+0900","uniqueIdentifier":"A0000019-0000-4000-8000-000000000000","placemark":{"name":"Example Lane","country":"台湾","administrativeArea":"台北","uniqueIdentifier":"A000001A-0000-4000-8000-000000000000"}},
+ "weather":{"tempC":-17.77777777777778,"feelslikeC":-17.77777777777778,"dewpointC":-17.77777777777778,"heatIndexC":0,"heatIndexF":0,"pressureIn":0,"visibilityKM":0,"windKPH":0,"windGustKPH":0,"precipTodayIn":0,"precipTodayMetric":0,"nearestStormDistanceKM":0,"latitude":0,"longitude":0,"uniqueIdentifier":"A000001B-0000-4000-8000-000000000000"},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["No"],"uniqueIdentifier":"B0000017-0000-4000-8000-000000000000"}]},
+{"battery":0.45,"connection":1,"steps":7000,"background":0,"draft":0,"sectionIdentifier":"1-2023-6-1","reportImpetus":2,"uniqueIdentifier":"0A1B2C3D-000B-4000-8000-00000000000B","date":"2023-06-01T12:00:00+0900",
+ "location":{"latitude":31.2304,"longitude":121.4737,"altitude":4,"horizontalAccuracy":10,"verticalAccuracy":3,"speed":-1,"course":-1,"timestamp":"2023-06-01T11:59:00+0900","uniqueIdentifier":"A000001C-0000-4000-8000-000000000000","placemark":{"name":"Example Square","country":"China","administrativeArea":"Shanghai","uniqueIdentifier":"A000001D-0000-4000-8000-000000000000"}},
+ "weather":{"uniqueIdentifier":"A000001E-0000-4000-8000-000000000000"},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["Yes"],"uniqueIdentifier":"B0000018-0000-4000-8000-000000000000"},
+  {"questionPrompt":"What did you eat?","tokens":[{"text":"Dumplings","uniqueIdentifier":"C000000E-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B0000019-0000-4000-8000-000000000000"}]},
+{"battery":0.2,"connection":1,"steps":15000,"background":0,"draft":0,"sectionIdentifier":"1-2024-1-1","reportImpetus":3,"uniqueIdentifier":"0A1B2C3D-000C-4000-8000-00000000000C","date":"2024-01-01T23:00:00+0900",
+ "location":{"latitude":35.7,"longitude":139.6,"altitude":40,"horizontalAccuracy":10,"verticalAccuracy":4,"speed":-1,"course":-1,"timestamp":"2024-01-01T22:59:00+0900","uniqueIdentifier":"A000001F-0000-4000-8000-000000000000","placemark":{"name":"Home","country":"日本","administrativeArea":"東京都","uniqueIdentifier":"A0000020-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"Anything to note?","uniqueIdentifier":"B000001A-0000-4000-8000-000000000000"},
+  {"questionPrompt":"How many hours did you sleep?","numericResponse":"8","uniqueIdentifier":"B000001B-0000-4000-8000-000000000000"}]},
+{"battery":0.95,"connection":1,"steps":100,"background":0,"draft":0,"sectionIdentifier":"1-2024-1-2","reportImpetus":4,"uniqueIdentifier":"0A1B2C3D-000D-4000-8000-00000000000D","date":"2024-01-02T07:00:00+0900",
+ "location":{"latitude":35.7,"longitude":139.6,"altitude":40,"horizontalAccuracy":10,"verticalAccuracy":4,"speed":-1,"course":-1,"timestamp":"2024-01-02T06:59:00+0900","uniqueIdentifier":"A0000021-0000-4000-8000-000000000000","placemark":{"name":"Home","country":"日本","administrativeArea":"東京都","uniqueIdentifier":"A0000022-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"How did you sleep?","answeredOptions":["Well"],"uniqueIdentifier":"B000001C-0000-4000-8000-000000000000"},
+  {"questionPrompt":"How many hours did you sleep?","numericResponse":"7.25","uniqueIdentifier":"B000001D-0000-4000-8000-000000000000"}]},
+{"battery":0.9,"connection":1,"steps":2500,"background":0,"draft":0,"sectionIdentifier":"1-2024-1-2","reportImpetus":2,"uniqueIdentifier":"0A1B2C3D-000E-4000-8000-00000000000E","date":"2024-01-02T12:00:00+0900",
+ "location":{"latitude":35.66,"longitude":139.7,"altitude":38,"horizontalAccuracy":10,"verticalAccuracy":4,"speed":-1,"course":-1,"timestamp":"2024-01-02T11:59:00+0900","uniqueIdentifier":"A0000023-0000-4000-8000-000000000000","placemark":{"name":"Example Building","country":"日本","administrativeArea":"東京都","uniqueIdentifier":"A0000024-0000-4000-8000-000000000000"}},
+ "responses":[
+  {"questionPrompt":"Are you outside?","answeredOptions":["No"],"uniqueIdentifier":"B000001E-0000-4000-8000-000000000000"},
+  {"questionPrompt":"What are you doing?","tokens":[{"text":"Working","uniqueIdentifier":"C000000F-0000-4000-8000-000000000000"}],"uniqueIdentifier":"B000001F-0000-4000-8000-000000000000"},
+  {"questionPrompt":"Where are you?","locationResponse":{"text":"Office","uniqueIdentifier":"C0000010-0000-4000-8000-000000000000","location":{"latitude":35.66,"longitude":139.7,"altitude":38,"horizontalAccuracy":-1,"verticalAccuracy":4,"speed":-1,"course":-1,"timestamp":"2024-01-02T11:59:00+0900","uniqueIdentifier":"C0000011-0000-4000-8000-000000000000"}},"uniqueIdentifier":"B0000020-0000-4000-8000-000000000000"},
+  {"questionPrompt":"Who are you with?","uniqueIdentifier":"B0000021-0000-4000-8000-000000000000"}]}
+],
+"questions":[
+{"uniqueIdentifier":"default-question-2","prompt":"Are you outside?","questionType":2,"selectedVisualizations":[{"typeId":4,"uniqueIdentifier":"D0000001-0000-4000-8000-000000000000"}]},
+{"uniqueIdentifier":"default-question-3","prompt":"What are you doing?","questionType":0,"selectedVisualizations":[{"typeId":1,"uniqueIdentifier":"D0000002-0000-4000-8000-000000000000"}]},
+{"uniqueIdentifier":"default-question-7","prompt":"Anything to note?","questionType":6,"selectedVisualizations":[{"typeId":2,"uniqueIdentifier":"D0000003-0000-4000-8000-000000000000"}]},
+{"uniqueIdentifier":"default-question-6","prompt":"How many coffees today?","questionType":5,"selectedVisualizations":[{"typeId":3,"uniqueIdentifier":"D0000004-0000-4000-8000-000000000000"}]},
+{"uniqueIdentifier":"default-question-1","prompt":"How did you sleep?","questionType":1,"selectedVisualizations":[{"typeId":4,"uniqueIdentifier":"D0000005-0000-4000-8000-000000000000"}]},
+{"uniqueIdentifier":"default-question-4","prompt":"Where are you?","questionType":3,"selectedVisualizations":[{"typeId":1,"uniqueIdentifier":"D0000006-0000-4000-8000-000000000000"}]},
+{"uniqueIdentifier":"default-question-5","prompt":"Who are you with?","questionType":4,"selectedVisualizations":[{"typeId":1,"uniqueIdentifier":"D0000007-0000-4000-8000-000000000000"}]},
+{"uniqueIdentifier":"9F3E1C2A-5B6D-4E7F-8A9B-0C1D2E3F4A5B","prompt":"How many hours did you sleep?","questionType":5,"placeholderString":"Hours","selectedVisualizations":[{"typeId":3,"uniqueIdentifier":"D0000008-0000-4000-8000-000000000000"}]}
+]}

diff --git a/Tests/Unit/JSONSlicerTests.swift b/Tests/Unit/JSONSlicerTests.swift

@@ -0,0 +1,62 @@
+import Foundation
+import Testing
+
+@testable import Reportage
+
+@Suite("JSONSlicer")
+struct JSONSlicerTests {
+
+    private func string(_ data: Data, _ range: Range<Int>) -> String {
+        String(decoding: data[range], as: UTF8.self)
+    }
+
+    @Test("Object members are sliced byte for byte, in order")
+    func objectMembers() throws {
+        let data = Data(#"junk{ "b" : [1, {"x": "]}"}] , "a":-1.5e3,"c":null, "d":"q\"}"}"#.utf8)
+        let start = try #require(data.firstIndex(of: UInt8(ascii: "{")))
+        let members = try JSONSlicer.objectMembers(in: data, at: start)
+
+        #expect(members.map(\.key) == ["b", "a", "c", "d"])
+        #expect(
+            members.map { string(data, $0.range) } == [
+                #"[1, {"x": "]}"}]"#, "-1.5e3", "null", #""q\"}""#,
+            ])
+    }
+
+    @Test("Array elements are sliced byte for byte")
+    func arrayElements() throws {
+        let data = Data(#"[ {"a":"[{"} ,{}, [ ], "s" ,7]"#.utf8)
+        let elements = try JSONSlicer.arrayElements(in: data, range: 0..<data.count)
+
+        #expect(elements.map { string(data, $0) } == [#"{"a":"[{"}"#, "{}", "[ ]", #""s""#, "7"])
+    }
+
+    @Test("Empty containers have no members")
+    func emptyContainers() throws {
+        #expect(try JSONSlicer.objectMembers(in: Data("{ }".utf8), at: 0).isEmpty)
+        #expect(try JSONSlicer.arrayElements(in: Data("[]".utf8), range: 0..<2).isEmpty)
+    }
+
+    @Test("Escaped keys are decoded")
+    func escapedKeys() throws {
+        let data = Data(#"{"ab":1}"#.utf8)
+        #expect(try JSONSlicer.objectMembers(in: data, at: 0).map(\.key) == ["ab"])
+    }
+
+    @Test("Ranges are correct for sliced Data")
+    func slicedData() throws {
+        let whole = Data(#"xx{"a":[1,2]}"#.utf8)
+        let data = whole[2...]
+        let members = try JSONSlicer.objectMembers(in: data, at: data.startIndex)
+        let elements = try JSONSlicer.arrayElements(in: data, range: members[0].range)
+
+        #expect(elements.map { string(whole, $0) } == ["1", "2"])
+    }
+
+    @Test("Truncated input throws")
+    func truncated() {
+        #expect(throws: JSONSlicer.Error.unexpectedEnd) {
+            try JSONSlicer.arrayElements(in: Data(#"[{"a":"b"#.utf8), range: 0..<8)
+        }
+    }
+}

diff --git a/Tests/Unit/ModelCodingTests.swift b/Tests/Unit/ModelCodingTests.swift

@@ -0,0 +1,52 @@
+import Foundation
+import Testing
+
+@testable import Reportage
+
+@Suite("ModelCoding")
+struct ModelCodingTests {
+
+    @Test("Response values encode as single-key objects")
+    func responseValueShape() throws {
+        let data = try ModelCoding.encode(ResponseValue.tokens(["coffee", "work"]))
+        #expect(String(decoding: data, as: UTF8.self) == #"{"tokens":["coffee","work"]}"#)
+    }
+
+    @Test(
+        "Response values round-trip",
+        arguments: [
+            ResponseValue.options(["Yes"]),
+            .tokens(["a", "b"]),
+            .number(Decimal(string: "7.25")!),
+            .text("Note\nwith a line break"),
+            .place(
+                Place(
+                    name: "Somewhere",
+                    coordinate: Coordinate(latitude: 1.5, longitude: -2.25),
+                    accuracy: 10,
+                    externalID: ExternalPlaceID(source: .mapKit, value: "I123")
+                )
+            ),
+        ]
+    )
+    func responseValueRoundTrip(value: ResponseValue) throws {
+        #expect(
+            try ModelCoding.decode(ResponseValue.self, from: ModelCoding.encode(value)) == value)
+    }
+
+    @Test("A response value with no key or several keys is rejected")
+    func malformedResponseValue() {
+        for json in ["{}", #"{"text":"a","tokens":[]}"#] {
+            #expect(throws: DecodingError.self) {
+                try ModelCoding.decode(ResponseValue.self, from: Data(json.utf8))
+            }
+        }
+    }
+
+    @Test("Survey kinds follow report kinds")
+    func surveyKinds() {
+        #expect(SurveyKinds(surveyFor: .manual) == .random)
+        #expect(SurveyKinds(surveyFor: .wake) == .wake)
+        #expect(SurveyKinds.all.rawValue == 7)
+    }
+}

diff --git a/Tests/Unit/RealExportVerificationTests.swift b/Tests/Unit/RealExportVerificationTests.swift

@@ -0,0 +1,87 @@
+import Foundation
+import Testing
+
+@testable import Reportage
+
+/// Imports the real Reporter export and verifies the store against it, report
+/// by report. Opt-in, because the export is personal data that only exists on
+/// the developer's machine:
+///
+///     TEST_RUNNER_REPORTAGE_REAL_EXPORT="$PWD/reporter-export.json" bash Scripts/test-unit.sh
+///
+/// Only aggregate findings are printed, never individual entries.
+@Suite("Real export verification")
+struct RealExportVerificationTests {
+
+    private static let exportPath = ProcessInfo.processInfo.environment["REPORTAGE_REAL_EXPORT"]
+
+    @Test(
+        "The real export imports without failures or mismatches",
+        .enabled(
+            if: exportPath != nil, "Set TEST_RUNNER_REPORTAGE_REAL_EXPORT to the export's path"),
+        .timeLimit(.minutes(10))
+    )
+    func realExport() async throws {
+        let url = URL(fileURLWithPath: try #require(Self.exportPath))
+        let data = try Data(contentsOf: url, options: .mappedIfSafe)
+        let persistence = makeTestPersistence()
+        let importer = ReporterImporter(persistence: persistence)
+
+        let clock = ContinuousClock()
+        let start = clock.now
+        let summary = try await importer.importArchive(data)
+        let importDuration = clock.now - start
+
+        let archive = try ReporterArchive(data: data)
+        let context = persistence.newBackgroundContext()
+        let mismatches = try await context.perform {
+            try ReporterImportVerifier.verify(archive, in: context)
+        }
+
+        let reimport = try await importer.importArchive(data)
+
+        var fallbackCounts: [String: Int] = [:]
+        for fallback in summary.fallbacks {
+            let label: String
+            switch fallback.reason {
+            case .timeZoneFromNeighbour(let country):
+                label = "zone from neighbour (country: \(country ?? "none"))"
+            case .timeZoneFromOffset: label = "zone from offset"
+            case .kindInferred(let impetus):
+                label = "kind inferred (impetus: \(impetus.map(String.init) ?? "none"))"
+            case .extraAnswerIgnored: label = "extra answer ignored"
+            case .unmatchedPrompt: label = "unmatched prompt"
+            }
+            fallbackCounts[label, default: 0] += 1
+        }
+        var mismatchCounts: [String: Int] = [:]
+        for mismatch in mismatches {
+            mismatchCounts[mismatch.problem, default: 0] += 1
+        }
+        let questions = try await context.perform {
+            try context.fetch(QuestionEntity.fetchRequest()).map { try $0.question() }
+        }
+
+        print(
+            """
+            REAL EXPORT SUMMARY
+              import time: \(importDuration)
+              questions: \(summary.questionCount), reports: \(summary.reportCount), failures: \(summary.failures.count)
+              by kind: \(summary.reportsByKind.sorted { $0.key.rawValue < $1.key.rawValue })
+              by year: \(summary.reportsByYear.sorted { $0.key < $1.key })
+              by zone: \(summary.reportsByTimeZone.sorted { $0.key < $1.key })
+              answers by question: \(summary.answersByQuestion.sorted { $0.key < $1.key })
+              question kinds/askOn/option count: \(questions.sorted { $0.order < $1.order }.map { "\($0.id): \($0.kind) \($0.askOn.rawValue) \($0.options.count)" })
+              fallbacks: \(fallbackCounts.sorted { $0.key < $1.key })
+              warnings: \(summary.warnings.count)
+              mismatches: \(mismatchCounts.sorted { $0.key < $1.key })
+              re-import: inserted \(reimport.reportsInserted), already present \(reimport.reportsAlreadyPresent)
+            """
+        )
+
+        #expect(summary.failures.isEmpty)
+        #expect(mismatches.isEmpty)
+        #expect(reimport.reportsInserted == 0)
+        #expect(reimport.reportsAlreadyPresent == summary.reportCount)
+    }
+}

diff --git a/Tests/Unit/ReporterArchiveTests.swift b/Tests/Unit/ReporterArchiveTests.swift

@@ -0,0 +1,75 @@
+import Foundation
+import Testing
+
+@testable import Reportage
+
+@Suite("ReporterArchive")
+struct ReporterArchiveTests {
+
+    @Test("The junk prefix before the opening brace is skipped")
+    func junkPrefix() throws {
+        let data = try Fixtures.reporterExport()
+        #expect(data.prefix(3) == Data([0xEF, 0xBF, 0xBF]))
+
+        let archive = try ReporterArchive(data: data)
+        #expect(archive.questions.count == 8)
+        #expect(archive.snapshots.count == 14)
+        #expect(archive.snapshots.allSatisfy { $0.fields != nil })
+    }
+
+    @Test("Each snapshot keeps its exact source bytes")
+    func rawBytes() throws {
+        let data = try Fixtures.reporterExport()
+        let archive = try ReporterArchive(data: data)
+        let text = String(decoding: data, as: UTF8.self)
+
+        for snapshot in archive.snapshots {
+            let raw = String(decoding: snapshot.raw, as: UTF8.self)
+            #expect(raw.hasPrefix("{") && raw.hasSuffix("}"))
+            #expect(text.contains(raw))
+        }
+    }
+
+    @Test("Data without an object is rejected")
+    func noObject() {
+        #expect(throws: ReporterArchive.Error.noJSONObject) {
+            try ReporterArchive(data: Data([0xEF, 0xBF, 0xBF]))
+        }
+    }
+
+    @Test("Missing arrays are rejected")
+    func missingArray() {
+        #expect(throws: ReporterArchive.Error.missingArray("snapshots")) {
+            try ReporterArchive(data: Data(#"{"questions":[]}"#.utf8))
+        }
+    }
+
+    @Test("A snapshot that can't be decoded is kept with its error")
+    func undecodableSnapshot() throws {
+        let archive = try ReporterArchive(
+            data: Data(#"{"questions":[],"snapshots":[{"date":1}]}"#.utf8))
+        #expect(archive.snapshots.count == 1)
+        #expect(archive.snapshots[0].fields == nil)
+        #expect(archive.snapshots[0].decodingError != nil)
+    }
+
+    @Test("Numbers decode from ints, floats and strings")
+    func lenientNumbers() throws {
+        let decoder = JSONDecoder()
+        let numbers = try decoder.decode(
+            [LenientNumber].self, from: Data(#"[1, 2.5, "50%", " 64 ", "-3"]"#.utf8))
+        #expect(numbers.map(\.value) == [1, 2.5, 50, 64, -3])
+        #expect(numbers[0].int == 1)
+
+        #expect(throws: DecodingError.self) {
+            try decoder.decode(LenientNumber.self, from: Data(#""N/A""#.utf8))
+        }
+    }
+
+    @Test("Numeric answers decode exactly")
+    func lenientDecimals() throws {
+        let decimals = try JSONDecoder().decode(
+            [LenientDecimal].self, from: Data(#"["0", "6.5", 7.25]"#.utf8))
+        #expect(decimals.map(\.value) == [0, Decimal(string: "6.5")!, Decimal(string: "7.25")!])
+    }
+}

diff --git a/Tests/Unit/ReporterImportPlanTests.swift b/Tests/Unit/ReporterImportPlanTests.swift

@@ -0,0 +1,333 @@
+import Foundation
+import Testing
+
+@testable import Reportage
+
+@Suite("ReporterImportPlan")
+struct ReporterImportPlanTests {
+
+    private let plan: ReporterImportPlan
+
+    init() throws {
+        plan = ReporterImportPlan(
+            archive: try Fixtures.reporterArchive(), now: Date(timeIntervalSince1970: 0))
+    }
+
+    private func report(_ number: Int) throws -> Report {
+        try #require(plan.reports.first { $0.id == Fixtures.reportID(number) })
+    }
+
+    private func question(_ id: String) throws -> Question {
+        try #require(plan.questions.first { $0.id == id })
+    }
+
+    private func fallbacks(_ number: Int) -> [ReporterImportSummary.FallbackReason] {
+        plan.summary.fallbacks.filter { $0.reportID == Fixtures.reportID(number).uuidString }.map(
+            \.reason)
+    }
+
+    private static let customQuestionID = "9F3E1C2A-5B6D-4E7F-8A9B-0C1D2E3F4A5B"
+
+    // MARK: Reports
+
+    @Test("Every snapshot becomes a report, sorted by date")
+    func reportsSorted() {
+        #expect(plan.reports.count == 14)
+        #expect(plan.summary.failures.isEmpty)
+        #expect(plan.reports.map(\.date) == plan.reports.map(\.date).sorted())
+    }
+
+    @Test("Imported reports are complete, keep their dates and say they were imported")
+    func reportBasics() throws {
+        let first = try report(1)
+        #expect(first.date == Date(timeIntervalSince1970: 1_425_168_900))  // 2015-03-01T00:15:00Z
+        #expect(first.trigger == .imported)
+        #expect(first.state == .complete)
+        #expect(first.promptedAt == nil)
+        #expect(first.modifiedAt == first.date)
+    }
+
+    @Test("Legacy holds the snapshot's original bytes")
+    func legacy() throws {
+        let archive = try Fixtures.reporterArchive()
+        for snapshot in archive.snapshots {
+            let fields = try #require(snapshot.fields)
+            let id = try #require(UUID(uuidString: fields.uniqueIdentifier))
+            let report = try #require(plan.reports.first { $0.id == id })
+            let legacy = try #require(report.legacy)
+            #expect(try LegacyBlob.decompress(legacy) == snapshot.raw)
+        }
+    }
+
+    // MARK: Time zones
+
+    @Test(
+        "Zones come from the placemark, in either language",
+        arguments: [
+            (1, "Asia/Tokyo"),  // 日本
+            (3, "Asia/Tokyo"),  // Japan
+            (4, "Australia/Sydney"),  // オーストラリア, NSW
+            (6, "Asia/Ho_Chi_Minh"),
+            (7, "Asia/Hong_Kong"),
+            (10, "Asia/Taipei"),
+            (11, "Asia/Shanghai"),
+        ]
+    )
+    func zoneFromPlacemark(number: Int, zone: String) throws {
+        #expect(try report(number).timeZone == zone)
+        #expect(
+            !fallbacks(number).contains {
+                if case .timeZoneFromNeighbour = $0 { true } else { false }
+            })
+    }
+
+    @Test("Reports without a usable placemark take the nearest report's zone")
+    func zoneFromNeighbour() throws {
+        // Empty placemark, three hours after a report in Sydney.
+        #expect(try report(5).timeZone == "Australia/Sydney")
+        #expect(fallbacks(5).contains(.timeZoneFromNeighbour(country: nil)))
+        // An unknown country is logged with its name.
+        #expect(try report(8).timeZone == "Asia/Hong_Kong")
+        #expect(fallbacks(8).contains(.timeZoneFromNeighbour(country: "France")))
+        // No location at all.
+        #expect(try report(9).timeZone == "Asia/Hong_Kong")
+        #expect(fallbacks(9).contains(.timeZoneFromNeighbour(country: nil)))
+    }
+
+    @Test("Years are counted in each report's own zone")
+    func yearsInLocalZone() {
+        // Report 4 is 2019-12-31T23:30+0900, which is already 2020 in Sydney.
+        #expect(plan.summary.reportsByYear == [2015: 3, 2020: 6, 2023: 2, 2024: 3])
+    }
+
+    @Test("Without any placemark, the zone is the timestamp's fixed offset")
+    func zoneFromOffset() throws {
+        let json =
+            #"{"questions":[],"snapshots":[{"uniqueIdentifier":"00000000-0000-4000-8000-000000000001","date":"2016-01-01T12:00:00+0900"}]}"#
+        let plan = ReporterImportPlan(archive: try ReporterArchive(data: Data(json.utf8)))
+        #expect(plan.reports.first?.timeZone == "GMT+0900")
+        #expect(
+            plan.summary.fallbacks.map(\.reason) == [
+                .timeZoneFromOffset, .kindInferred(impetus: nil),
+            ])
+    }
+
+    @Test("Fixed offsets parse from Reporter timestamps")
+    func offsetZones() {
+        #expect(ReporterDates.offsetZone("2016-01-01T12:00:00+0900") == "GMT+0900")
+        #expect(ReporterDates.offsetZone("2016-01-01T12:00:00-0530") == "GMT-0530")
+        #expect(ReporterDates.offsetZone("garbage") == "GMT")
+    }
+
+    // MARK: Kinds
+
+    @Test("Report kinds follow reportImpetus")
+    func kindsFromImpetus() throws {
+        #expect(try report(1).kind == .random)
+        #expect(try report(2).kind == .bedtime)
+        #expect(try report(3).kind == .wake)
+        #expect(try report(4).kind == .manual)
+        #expect(plan.summary.reportsByKind == [.random: 7, .manual: 2, .bedtime: 2, .wake: 3])
+    }
+
+    @Test("Missing and unknown impetus values are inferred from the questions")
+    func inferredKinds() throws {
+        // Random-survey questions with no impetus: manual, since nothing shows
+        // a prompt fired.
+        #expect(try report(8).kind == .manual)
+        #expect(fallbacks(8).contains(.kindInferred(impetus: nil)))
+        // Impetus 1 with wake questions.
+        #expect(try report(9).kind == .wake)
+        #expect(fallbacks(9).contains(.kindInferred(impetus: 1)))
+    }
+
+    // MARK: Questions
+
+    @Test("Question types map to kinds")
+    func questionKinds() throws {
+        #expect(try question("default-question-1").kind == .choice)
+        #expect(try question("default-question-2").kind == .yesNo)
+        #expect(try question("default-question-3").kind == .tokens)
+        #expect(try question("default-question-4").kind == .location)
+        #expect(try question("default-question-5").kind == .people)
+        #expect(try question("default-question-6").kind == .number)
+        #expect(try question("default-question-7").kind == .note)
+        let custom = try question(Self.customQuestionID)
+        #expect(custom.kind == .number)
+        #expect(custom.placeholder == "Hours")
+    }
+
+    @Test("Questions keep the export's order")
+    func questionOrder() {
+        #expect(plan.questions.prefix(8).map(\.order) == Array(0..<8))
+        #expect(plan.questions.first?.id == "default-question-2")
+    }
+
+    @Test("Surveys are inferred from the latest report of each kind")
+    func askOn() throws {
+        for id in [
+            "default-question-2", "default-question-3", "default-question-4", "default-question-5",
+        ] {
+            #expect(try question(id).askOn == .random)
+        }
+        #expect(try question("default-question-1").askOn == .wake)
+        #expect(try question("default-question-7").askOn == .bedtime)
+        #expect(try question(Self.customQuestionID).askOn == [.wake, .bedtime])
+        #expect(try question("default-question-6").askOn == [])
+    }
+
+    @Test("Choice options are rebuilt from the answers, most common first")
+    func choiceOptions() throws {
+        #expect(try question("default-question-1").options == ["Well", "Poorly"])
+        #expect(try question("default-question-2").options.isEmpty)
+    }
+
+    @Test("A prompt matching no question gets an archived question of its own")
+    func unmatchedPrompt() throws {
+        let synthesised = try #require(plan.questions.first { $0.prompt == "What did you eat?" })
+        #expect(synthesised.id.hasPrefix("reporter-prompt-"))
+        #expect(synthesised.kind == .tokens)
+        #expect(synthesised.archivedAt == (try report(11)).date)
+        #expect(synthesised.askOn == .random)
+        #expect(fallbacks(11) == [.unmatchedPrompt(questionID: synthesised.id)])
+        #expect(try report(11).responses[1].questionID == synthesised.id)
+    }
+
+    // MARK: Responses
+
+    @Test("Responses keep their prompts and map each answer shape")
+    func responseValues() throws {
+        let first = try report(1)
+        #expect(
+            first.responses.map(\.questionID) == [
+                "default-question-2", "default-question-3", "default-question-4",
+                "default-question-5",
+            ])
+        #expect(first.responses[0].prompt == "Are you outside?")
+        #expect(first.responses[0].value == .options(["Yes"]))
+        #expect(first.responses[1].value == .tokens(["Walking", "Podcast"]))
+        #expect(first.responses[3].value == .tokens(["Alex"]))
+        #expect(
+            first.responses[2].value
+                == .place(
+                    Place(
+                        name: "Corner Café",
+                        coordinate: Coordinate(latitude: 35.6582, longitude: 139.7016),
+                        accuracy: 30,
+                        externalID: ExternalPlaceID(
+                            source: .foursquare, value: "4b0000000000000000000001")
+                    )
+                )
+        )
+        #expect(try report(2).responses[0].value == .text("Long day."))
+        #expect(try report(3).responses[1].value == .number(Decimal(string: "6.5")!))
+    }
+
+    @Test("Skipped questions are kept with no value")
+    func skippedQuestions() throws {
+        let response = try report(4).responses[2]
+        #expect(response.questionID == "default-question-4")
+        #expect(response.value == nil)
+        #expect(plan.summary.answersByQuestion["default-question-4"] == 2)
+    }
+
+    @Test("Places with an invalid accuracy and no venue ID")
+    func placeWithoutExtras() throws {
+        guard case .place(let place) = try report(14).responses[2].value else {
+            Issue.record("Expected a place")
+            return
+        }
+        #expect(place.accuracy == nil)
+        #expect(place.externalID == nil)
+    }
+
+    @Test("An answer in an unexpected extra field is ignored and logged")
+    func extraAnswer() throws {
+        #expect(try report(7).responses[0].value == .options(["No"]))
+        #expect(fallbacks(7) == [.extraAnswerIgnored(questionID: "default-question-2")])
+    }
+
+    // MARK: Context
+
+    @Test("Weather Underground records are normalised")
+    func wundergroundWeather() throws {
+        let weather = try #require(try report(1).context.weather)
+        #expect(weather.source == .wunderground)
+        #expect(weather.condition == "Partly Cloudy")
+        #expect(weather.temperature == 12)
+        #expect(weather.feelsLike == 11)
+        #expect(weather.humidity == 0.62)
+        #expect(weather.pressure == 1016)
+        #expect(weather.windSpeed == 9.7)
+        #expect(weather.windDirection == 270)
+        #expect(weather.visibility == 10)
+        #expect(weather.uvIndex == 2)
+        #expect(weather.precipitationToday == 0)
+        #expect(weather.cloudCover == nil)
+    }
+
+    @Test("Dark Sky records are normalised")
+    func darkSkyWeather() throws {
+        let weather = try #require(try report(4).context.weather)
+        #expect(weather.source == .darkSky)
+        #expect(weather.condition == "Clear")
+        #expect(weather.temperature == 24.4)
+        #expect(weather.humidity == 0.55)
+        #expect(weather.cloudCover == 0.12)
+        #expect(weather.precipitationChance == 0.05)
+    }
+
+    @Test("Placeholder and empty weather records count as no weather")
+    func noWeather() throws {
+        #expect(try report(10).context.weather == nil)
+        #expect(try report(11).context.weather == nil)
+        #expect(try report(2).context.weather == nil)
+    }
+
+    @Test("Invalid location readings are dropped")
+    func location() throws {
+        let first = try #require(try report(1).context.location)
+        #expect(first.coordinate == Coordinate(latitude: 35.6581, longitude: 139.7017))
+        #expect(first.altitude == 38)
+        #expect(first.horizontalAccuracy == 65)
+        #expect(first.speed == nil)
+        #expect(first.course == nil)
+        #expect(first.timestamp == Date(timeIntervalSince1970: 1_425_168_891))
+        #expect(first.placemark?.country == "日本")
+        #expect(first.placemark?.postalCode == "150-0000")
+
+        // A negative vertical accuracy means the altitude is invalid too.
+        let wake = try #require(try report(3).context.location)
+        #expect(wake.verticalAccuracy == nil)
+        #expect(wake.altitude == nil)
+
+        #expect(try report(6).context.location?.course == 180)
+        #expect(try report(5).context.location?.placemark == nil)
+        #expect(try report(9).context.location == nil)
+    }
+
+    @Test("Audio, motion and device context")
+    func otherContext() throws {
+        let first = try report(1).context
+        #expect(first.audio == AudioContext(source: .microphone, average: -42, peak: -20.5))
+        #expect(first.motion == MotionContext(steps: 2048, floorsAscended: 3, floorsDescended: 1))
+        #expect(first.device == DeviceContext(batteryLevel: 1, connectivity: .wifi))
+
+        #expect(try report(4).context.motion?.pressure == 101.2)
+        #expect(try report(3).context.device?.connectivity == .cellular)
+        #expect(try report(5).context.device?.connectivity == DeviceContext.Connectivity.none)
+    }
+
+    @Test("Photos keep lightweight metadata with signed coordinates")
+    func photos() throws {
+        let photos = try #require(try report(4).context.photos)
+        #expect(photos.count == 2)
+        #expect(photos.photos[0].coordinate == Coordinate(latitude: -33.8688, longitude: 151.2093))
+        #expect(photos.photos[0].make == "Apple")
+        #expect(photos.photos[0].pixelWidth == 4032)
+        #expect(photos.photos[1].coordinate == nil)
+        // 2019-12-31T13:45:00Z
+        #expect(photos.photos[1].date == Date(timeIntervalSince1970: 1_577_799_900))
+        #expect(try report(1).context.photos == nil)
+    }
+}

diff --git a/Tests/Unit/ReporterImporterTests.swift b/Tests/Unit/ReporterImporterTests.swift

@@ -0,0 +1,119 @@
+import CoreData
+import Foundation
+import Testing
+
+@testable import Reportage
+
+@Suite("ReporterImporter")
+struct ReporterImporterTests {
+
+    private let persistence = makeTestPersistence()
+
+    private var importer: ReporterImporter { ReporterImporter(persistence: persistence) }
+
+    private func storedReports() async throws -> [Report] {
+        let context = persistence.newBackgroundContext()
+        return try await context.perform {
+            let request = ReportEntity.fetchRequest()
+            request.sortDescriptors = [NSSortDescriptor(key: "date", ascending: true)]
+            return try context.fetch(request).map { try $0.report() }
+        }
+    }
+
+    private func storedQuestions() async throws -> [Question] {
+        let context = persistence.newBackgroundContext()
+        return try await context.perform {
+            let request = QuestionEntity.fetchRequest()
+            request.sortDescriptors = [NSSortDescriptor(key: "order", ascending: true)]
+            return try context.fetch(request).map { try $0.question() }
+        }
+    }
+
+    @Test("The store holds exactly what the plan describes")
+    func roundTrip() async throws {
+        let now = Date(timeIntervalSince1970: 0)
+        let summary = try await importer.importArchive(try Fixtures.reporterExport(), now: now)
+        let plan = ReporterImportPlan(archive: try Fixtures.reporterArchive(), now: now)
+
+        #expect(summary.questionsInserted == 9)
+        #expect(summary.reportsInserted == 14)
+        #expect(summary.reportsAlreadyPresent == 0)
+        #expect(try await storedReports() == plan.reports)
+        #expect(Set(try await storedQuestions()) == Set(plan.questions))
+    }
+
+    @Test("Re-importing the same export changes nothing")
+    func idempotent() async throws {
+        let data = try Fixtures.reporterExport()
+        _ = try await importer.importArchive(data)
+        let before = try await storedReports()
+
+        let summary = try await importer.importArchive(data)
+        #expect(summary.questionsInserted == 0)
+        #expect(summary.questionsUpdated == 0)
+        #expect(summary.reportsInserted == 0)
+        #expect(summary.reportsAlreadyPresent == 14)
+        #expect(try await storedReports() == before)
+        #expect(try await storedQuestions().count == 9)
+    }
+
+    @Test("Importing a newer export adds only the new reports")
+    func incremental() async throws {
+        let older = try await importer.importArchive(try Fixtures.reporterExport(droppingLast: 2))
+        #expect(older.reportsInserted == 12)
+
+        let newer = try await importer.importArchive(try Fixtures.reporterExport())
+        #expect(newer.reportsInserted == 2)
+        #expect(newer.reportsAlreadyPresent == 12)
+        #expect(try await storedReports().count == 14)
+    }
+
+    @Test("Re-importing keeps question edits and only adds new choice options")
+    func questionEditsSurvive() async throws {
+        _ = try await importer.importArchive(try Fixtures.reporterExport())
+
+        let context = persistence.newBackgroundContext()
+        try await context.perform {
+            let request = QuestionEntity.fetchRequest()
+            for entity in try context.fetch(request) where entity.id == "default-question-1" {
+                var question = try entity.question()
+                question.prompt = "Slept well?"
+                question.options = ["Poorly"]
+                try entity.update(from: question)
+            }
+            try context.save()
+        }
+
+        let summary = try await importer.importArchive(try Fixtures.reporterExport())
+        #expect(summary.questionsUpdated == 1)
+        let question = try #require(
+            try await storedQuestions().first { $0.id == "default-question-1" })
+        #expect(question.prompt == "Slept well?")
+        #expect(question.options == ["Poorly", "Well"])
+    }
+
+    @Test("The verifier finds no differences after an import")
+    func verifierPasses() async throws {
+        let data = try Fixtures.reporterExport()
+        _ = try await importer.importArchive(data)
+        let archive = try ReporterArchive(data: data)
+
+        let context = persistence.newBackgroundContext()
+        let mismatches = try await context.perform {
+            try ReporterImportVerifier.verify(archive, in: context)
+        }
+        #expect(mismatches.isEmpty)
+    }
+
+    @Test("The verifier reports a missing report")
+    func verifierCatchesMissing() async throws {
+        _ = try await importer.importArchive(try Fixtures.reporterExport(droppingLast: 1))
+        let archive = try Fixtures.reporterArchive()
+
+        let context = persistence.newBackgroundContext()
+        let mismatches = try await context.perform {
+            try ReporterImportVerifier.verify(archive, in: context)
+        }
+        #expect(mismatches.map(\.problem) == ["not in store"])
+    }
+}

diff --git a/project.yml b/project.yml

@@ -0,0 +1,98 @@
+name: Reportage
+
+options:
+  bundleIdPrefix: net.inqk.reportage
+  deploymentTarget:
+    iOS: "26.0"
+
+configFiles:
+  Debug: Generated/Config.xcconfig
+  Release: Generated/Config.xcconfig
+
+settings:
+  SWIFT_VERSION: 6
+  DEAD_CODE_STRIPPING: YES
+  ENABLE_USER_SCRIPT_SANDBOXING: YES
+  ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_EXTENSIONS: YES
+  ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: YES
+  SWIFT_EMIT_LOC_STRINGS: YES
+  STRING_CATALOG_GENERATE_SYMBOLS: YES
+  DEVELOPMENT_TEAM: 7TD7PZBNXP
+
+targets:
+  Reportage:
+    type: application
+    platform: iOS
+    sources:
+      - Reportage
+      - Shared
+    info:
+      path: Reportage/Info.plist
+      properties:
+        CFBundleDisplayName: Reportage
+        CFBundleShortVersionString: "1.0.0"
+        CFBundleVersion: $(CURRENT_PROJECT_VERSION)
+        ITSAppUsesNonExemptEncryption: false
+        LSRequiresIPhoneOS: true
+        UILaunchScreen: {}
+        UISupportedInterfaceOrientations:
+          - UIInterfaceOrientationPortrait
+    settings:
+      base:
+        PRODUCT_BUNDLE_IDENTIFIER: net.inqk.reportage
+        INFOPLIST_FILE: Reportage/Info.plist
+        TARGETED_DEVICE_FAMILY: "1"
+        CODE_SIGN_STYLE: Automatic
+      configs:
+        # Disable linker identical-code-folding in Release so crash reports
+        # name the real Swift async functions instead of collapsing them to
+        # <deduplicated_symbol>.
+        Release:
+          OTHER_LDFLAGS: $(inherited) -Wl,-no_deduplicate
+
+  Reportage Unit Tests:
+    type: bundle.unit-test
+    platform: iOS
+    sources:
+      - Tests/Unit
+      - Tests/Support
+    dependencies:
+      - target: Reportage
+    settings:
+      PRODUCT_BUNDLE_IDENTIFIER: net.inqk.reportage.unittests
+      CODE_SIGN_STYLE: Automatic
+      TEST_HOST: $(BUILT_PRODUCTS_DIR)/Reportage.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Reportage
+      BUNDLE_LOADER: $(TEST_HOST)
+      GENERATE_INFOPLIST_FILE: YES
+
+schemes:
+  Reportage:
+    build:
+      targets:
+        Reportage: all
+      preActions:
+        - script: |
+            cd "${SRCROOT}"
+            mkdir -p Generated
+            unset SWIFT_DEBUG_INFORMATION_FORMAT SWIFT_DEBUG_INFORMATION_VERSION
+            buildYear=`git log -1 --format=%cd --date=format:%Y`
+            buildVersion=`git rev-list HEAD | wc -l | tr -d ' '`
+            {
+              echo '#include? "Local.xcconfig"'
+              echo "CURRENT_PROJECT_VERSION = $buildYear.$buildVersion"
+            } > Generated/Config.xcconfig
+          settingsTarget: Reportage
+    run:
+      config: Debug
+    test:
+      config: Debug
+      targets:
+        - name: Reportage Unit Tests
+          parallelizable: false
+          randomExecutionOrder: true
+    profile:
+      config: Release
+    analyze:
+      config: Debug
+    archive:
+      config: Release