for Pharma
Toggle menu
Blog

From Excel data specification to data contract in an afternoon

Turn your manufacturer partner's Excel data specification into data checks that run before the data file leaves. The first version takes an afternoon.

From Excel data specification to data contract in an afternoon

Key points

  • Manufacturer partners score specialty pharmacy data files on a periodic scorecard, and in IQVIA's published example a monthly score of 85% to 94% cuts the data access fee by 5%.
  • A data contract is a manufacturer partner's Excel specification written as plain-language checks, each run as code on every outgoing data file before it leaves.
  • Every specification item carries five columns (field, required, format, allowed values, and rule), and those five columns are the contract.
  • Three checks the specification never writes down are worth adding on day one: one delivery per period, row counts against an eight-week history, and status order.
  • Quarantining failing records costs completeness, while a hold or a fix-first delay costs timeliness. Agree the handling with the manufacturer partner in advance.
  • An afternoon produces a back-tested first version for one manufacturer partner and the patient status data file using the free TestGen tool, while running it on every delivery takes longer.

Summary

Your manufacturer partner’s data specification lives in Excel. Nobody uses it before the data file leaves. The manufacturer partner finds your errors on its scorecard, and the score can cut your data fee.

Turn the specification into a data contract: plain-language data checks, each written as code, that run on each outgoing data file before it leaves. You run them with the free TestGen tool and find your own errors first. You start with one manufacturer partner, one data file, and your previous data files as test data. You run the checks on those past data files to see how the checks behave and to test the checks themselves before they run on new data files. This post shows how to build the first version in an afternoon.

The spreadsheet

Your manufacturer partner’s data specification is a spreadsheet. It has a tab per data file type, a column of notes, and at least one cell that says “see tab 3.” You build the data file to match the specification. You send the data file. The manufacturer partner scores what comes back.

That score matters. IQVIA describes manufacturer partners scoring their data partners (“typically specialty pharmacies”) on a periodic scorecard. The score can be tied to your data fee. In IQVIA’s published example, the manufacturer partner pays the pharmacy a data access fee, and a monthly data quality score sets the reduction: 95% to 100% means no reduction, 85% to 94% means a 5% reduction. Take a placeholder fee of $20,000 a month. Applying the 5% reduction for the 85% to 94% band puts $1,000 at risk that month. That’s IQVIA’s example, not a standard. IQVIA also sells this kind of scorecard monitoring to manufacturer partners, so read it as a vendor’s view.

What specialty pharmacy data is, and why it’s hard

You send manufacturer partners two kinds of data. Dispensing records cover product name, NDC, date dispensed, quantity, prescriber, and refill information. Patient or referral status covers codes (pending, active, denied, discontinued) with sub-statuses (benefit investigation, prior approval, appeal, no insurance coverage). Manufacturer partners typically pay the pharmacy a data access fee as part of the contract. They score the data they get for that fee.

A table of three fields a pharmacy sends, patient status, status reason and consent date, each named differently by three manufacturer partners, with the consent date row highlighted Figure 1: The same fields, named three ways. Field names are invented.

None of it arrives clean. In practice there’s no single standard. A 2020 National Association of Specialty Pharmacy (NASP) panel, reported by Pharmacy Times, described “highly variable, nonstandardized data sources.” Pharmacies run many configurable dispensing systems. The National Council for Prescription Drug Programs (NCPDP) publishes a Specialty Pharmacy Data Reporting implementation guide. Specifications vary by manufacturer partner. A referral status can change several times within a short timeframe. Consent limits what you can share. For background, Pharmacy Times reported in 2015 that “Patient consent is a key driver of the level of information that manufacturers can expect to receive.” Your HIPAA authorizations and agreements govern patient-level sharing at your pharmacy, and your counsel owns that. Payer fields show up blinded, null, or “N/A.”

That’s why every manufacturer partner’s Excel specification differs. Each one is a different answer to the same messy question.

Here’s what I have seen working on reporting to manufacturer partners. At most specialty pharmacies, that reporting is an afterthought to the business. Your job is patients and dispensing, and that’s the right priority. Your team builds the reporting once to satisfy the contract (“one and done”) and leaves it alone. Often nobody watches what goes out.

That’s understandable. It’s also one reason errors reach the manufacturer partner’s scorecard. Your team implements the Excel specification once and never checks it again. Turn the specification into a contract that runs on every data file, and the gap closes.

Step 1: pull the requirements out of the spreadsheet

When the specification lives only in Excel, the manufacturer partner does the checking, after the data file has left. A data contract is the same specification written as checks that run before the data file leaves. IQVIA’s scorecard KPIs include timely submission, high-quality and complete data, and fast resolution of errors. As IQVIA puts it, “The presence of data doesn’t mean it’s accurate or complete.” (IQVIA, Feb 2023)

One specification item for consent_date split into its five columns: field, required, format, allowed values and rule Figure 2: Every specification item carries the same five columns. Together they are the contract.

Open the workbook. Every item in the specification carries a field, whether it’s required, a format, allowed values, and sometimes a rule tying it to another field. Those five columns are the contract. Notes buried in comment cells count. So does “see tab 3.” Pull every requirement onto one page.

IQVIA warns manufacturer partners against running a scorecard in an Excel workbook kept by one person, who may leave with the knowledge. The warning is addressed to manufacturer partners, but the same risk applies on your side. Your specification lives in a workbook, and one person may be the only one who understands the specification.

Step 2: write each specification item as a check

Real manufacturer partner specifications are confidential. This post publishes a generic sample specification instead. I built it from fields commonly described in published sources. It is not any manufacturer partner’s specification and not the NCPDP standard. It’s also a deliberately partial subset of what manufacturer partners commonly ask for. It leaves out some fields from dispensing records (refill information, for example).

Five specification items, each rewritten as a plain-language check with its result on the last data file: four pass and the payer fields check fails on three rows Figure 3: Each item becomes a sentence a person can review and a check the job can run.

FieldRequiredFormatAllowed valuesRule
Pharmacy patient IDYestextSame patient keeps the same ID across data files
Referral dateYesYYYY-MM-DDNot in the future
Patient statusYescodePending, Active, Denied, DiscontinuedOne status per patient in a snapshot data file; a data file that reports each status event can carry several rows per patient
Sub-statusWhen status is PendingcodeBenefit investigation, Prior approval, Appeal, No insurance coverageBlank only when status is not Pending
Consent dateYesYYYY-MM-DDPresent before any patient-level detail is sent; not after the data file date
NDCYes when dispensed11 digitsProducts under the agreementMust be a product on the contract
Date dispensedYes when dispensedYYYY-MM-DDOn or after the referral date
QuantityYes when dispensednumberGreater than zero
Fill dispense statusYes when dispensedcodeper specificationReported per fill, not per patient medication
PrescriberYesNPIPresent and well formed
Payer fieldsYestextNot blank, not “N/A”, not blinded unless the specification allows it

Now rewrite each specification item as a sentence a person can read and a check can run. The plain-language sentence is the version you review. The code is what runs. Each check becomes code (a SQL query or a script, for example) that runs against the outgoing data file as a step in the job that builds and sends the data file, before the transfer to the manufacturer partner. A failure notifies a named owner. The On failure column below shows what happens to the failing records. It is an illustration, not a term from any agreement. Step 4 covers how to handle failures.

Specification itemCheckOn failure
Patient statuspatient_status must be one of Pending, Active, Denied, DiscontinuedQuarantine the failing records
Sub-statussub_status required when patient_status is PendingQuarantine the failing records
Consent dateconsent_date present and not after file_dateQuarantine the failing records
Payer fieldsNot blank and not “N/A”Quarantine the failing records (or warn, if the specification makes the field optional)
Date dispenseddate_dispensed on or after referral_dateQuarantine the failing records

The consent check is a partial version of the specification’s consent rule. It flags a missing or impossible date. It does not check the “present before any patient-level detail is sent” half. A populated date does not establish that sharing is authorized. Your compliance and privacy team owns the determination of whether you can send patient-level detail, under your agreements. A field check cannot make that call.

Step 3: add the checks the specification never writes down

The specification implies requirements it doesn’t list. Three are worth adding as checks on day one.

Three unwritten checks: one delivery per period with an extra Wednesday data file, a row count dropping below its eight-week band, and status moves including legitimate moves back Figure 4: One delivery per period, row counts against history, and status order: the checks the specification implies.

One delivery per period. You hold an unexplained off-cycle data file or a duplicate and ask why it exists. A corrected data file or resubmission is routine, though. A data file flagged as a correction replaces the earlier data file instead of counting as a duplicate.

Row counts against history. Compare today’s count with the median for the same weekday over the last eight weeks. A count inside a set tolerance passes. Say 20 percent, as an illustration you tune per data file. Take a placeholder median of 1,000 rows. A 20 percent tolerance gives a band of 800 to 1,200. A count of 950 passes. A count of 700 warns a person. A count near zero or several times the normal holds the data file. Holiday weeks dip, so a count outside the tolerance only warns. A new data file with no history gets a warning, not a hold, until it has some.

Status order. Check the order that statuses move in between data files. An order check needs a table of allowed transitions. The sample specification doesn’t have one. The manufacturer partner or hub program owner must agree on that table. Real patients legitimately move back (Discontinued to Active on a restart or re-referral, Denied to Pending after an appeal). Until you have the table, flag unusual moves for a person to look at and hold nothing.

The same-patient-ID check, the status order check, and row counts against history all need state: the prior data files, or a stored history of what you sent. The afternoon can run them against last month’s data files on disk. A running version needs an automatic history of what you sent.

Step 4: decide what a failure does

Row-level failures give you two options. You can quarantine the failing records: the rest of the data file goes out, and you resend the fixed records later. That option only works once you’ve agreed with the manufacturer partner how the quarantine works. Or you can investigate and fix the failing records before anything goes out. The whole data file ships late but complete. File-level failures hold the whole data file (a wrong or duplicate delivery, a count near zero or several times the normal, or a structural break). Warnings go to a person with a deadline. Name the owner of each, by role.

Three cards showing what goes out and what stays for a row-level failure, a file-level failure and a warning, above a note to agree the handling with the manufacturer partner first Figure 5: Quarantine costs completeness. A hold or a fix-first delay costs timeliness. Agree the handling with the manufacturer partner first.

Each option costs something. Fixing the failing records first costs timeliness, and so does a hold. A held data file is a late data file, and timeliness is a scorecard KPI. A quarantined record is a missing record until you fix it and resend. The scorecard scores completeness too. A quarantined patient can look like a drop-off in the manufacturer partner’s data. A patient’s status rows and dispensing rows can go out of step. Resent records may arrive after the period closes.

So decide in advance, with the manufacturer partner, how you handle held or quarantined records. Agree how to flag pending records. Agree that a resend updates the original records and is not a new delivery that trips the duplicate check from Step 3. Then decide who chooses between late and wrong. Put the person who owns that relationship in the room.

Step 5: run it on every data file and keep the results

Run the checks on every outgoing data file. Store what passed, what failed, and what you did about each failure. Those results are your own scorecard. When the manufacturer partner’s scorecard disagrees with you, you have the record.

A log of outgoing status data files with check results: two sent, one partial send with three records quarantined, and one held as an unexplained second data file for the same day Figure 6: Your own record of every outgoing data file. Illustrative log.

Then reuse the checks. The next manufacturer partner’s specification is mostly the same fields with different names and codes, so most of the contract carries over. That is my observation about how these specifications look, not a promise about yours.

What an afternoon covers

The afternoon produces the first version of the contract for one manufacturer partner’s specification and one data file, the patient status data file. You write each specification item as a check. Then you back-test: you run the checks on last month’s data files as test data. That shows which records would have failed, and it tests the checks themselves before they run on new data files. Running those checks on every outgoing data file is the next step.

Two columns: what the afternoon delivers, three checked items, and what comes next, four open items Figure 7: The afternoon delivers a back-tested first version. Running it for real takes longer.

It doesn’t cover wiring the checks into the job that builds and sends your data files so they run on every delivery. It doesn’t cover every other data file type and manufacturer partner. And it doesn’t cover agreeing with the manufacturer partner on what their specification meant where it’s ambiguous, or on how you handle held and quarantined records. Those take longer.

How to start

You run the free TestGen tool on your own systems. Create data checks for your data file, with your specification as the source. You can use an AI tool like Claude Code to convert the Excel data specification into a data contract. Ask for one that follows the Open Data Contract Standard (ODCS). Run the checks in TestGen on each outgoing data file before you send. Judge the results. A failure notifies a named owner, and you keep the results as your own record. Your team owns the decisions: late versus wrong, consent rules, and what to say to the manufacturer partner.

Inside the pharmacy's own systems: build the data file, run the checks in the free TestGen tool, transfer only what passed, with failures notifying an owner and every result kept Figure 8: The checks run in your environment, before the transfer to the manufacturer partner.

The checks catch format, allowed-value, cross-field, and delivery errors before the data file leaves. They cannot catch a value that is well formed but wrong (a wrong status or quantity, for example). They cover only what the specification and your added checks describe.

Start with one manufacturer partner’s specification for the patient status data file. Run the checks on last month’s data files as test data and see what would have failed. Find out more about running the checks in TestGen.


FAQ

What are the key points in this blog?

A data contract turns a manufacturer partner’s Excel specification into plain-language checks that run on every outgoing data file. Scorecards matter because, in IQVIA’s published example, a score of 85% to 94% cuts the data fee by 5%. An afternoon gets you a back-tested first version for the patient status data file.

What is a data contract for a specialty pharmacy data file?

A data contract is a manufacturer partner’s data specification written as plain-language data checks that run on each outgoing data file before it leaves your pharmacy. Each item in the specification (field, required, format, allowed values, and any rule tying it to another field) becomes a check with a defined action on failure, such as holding the data file or warning a named person.

Can a data quality score really reduce my data fee?

Yes, in IQVIA’s published example. IQVIA describes a monthly data quality score tiered to payment: 95% to 100% means no reduction in fees, 85% to 94% means a 5% reduction, and so on. That’s an example, not a standard. Parties negotiate data fees within a fair market value range, and your agreement sets your actual terms. In IQVIA’s example, pharmacies can correct errors during a grace period.

Is the sample specification in this post the NCPDP standard?

No. The sample specification is a generic table built for this post from fields commonly described in published sources. It isn’t any manufacturer partner’s specification and it isn’t the NCPDP standard. NCPDP publishes a Specialty Pharmacy Data Reporting implementation guide, but specifications vary by manufacturer partner, so your own specification governs what you send.

What should happen when a check fails?

You can quarantine row-level failures and send the rest of the data file, or fix them before anything goes out. File-level failures hold the whole data file, and warnings go to a person with a deadline. Quarantine costs completeness and a hold costs timeliness. Agree the handling with the manufacturer partner in advance and name an owner by role.

How long does it take to turn a manufacturer partner specification into a data contract?

Turning one manufacturer partner’s specification for one data file into the first version of a data contract takes about an afternoon. That covers reading the specification, writing each item as a check, and back-testing on last month’s data files as test data to see what would have failed. Running the checks in TestGen on every outgoing data file, covering other file types and partners, and settling ambiguous language take longer.

Talk to the team that wrote this.

Half an hour on your stack, your launch window, and what the first sprint would look like.